diff --git a/narwhals/expr.py b/narwhals/expr.py index 3dbb5b91b..2d73c4bc1 100644 --- a/narwhals/expr.py +++ b/narwhals/expr.py @@ -451,6 +451,9 @@ def median(self) -> Self: """ Get median value. + Notes: + Results might slightly differ across backends due to differences in the underlying algorithms used to compute the median. + Examples: >>> import pandas as pd >>> import polars as pl @@ -4595,8 +4598,9 @@ def median(*columns: str) -> Expr: """ Get the median value. - Note: - Syntactic sugar for ``nw.col(columns).median()`` + Notes: + - Syntactic sugar for ``nw.col(columns).median()`` + - Results might slightly differ across backends due to differences in the underlying algorithms used to compute the median. Arguments: columns: Name(s) of the columns to use in the aggregation function diff --git a/narwhals/series.py b/narwhals/series.py index 23f0b1533..e3d293ca1 100644 --- a/narwhals/series.py +++ b/narwhals/series.py @@ -525,6 +525,9 @@ def median(self) -> Any: """ Reduce this Series to the median value. + Notes: + Results might slightly differ across backends due to differences in the underlying algorithms used to compute the median. + Examples: >>> import pandas as pd >>> import polars as pl diff --git a/narwhals/stable/v1/__init__.py b/narwhals/stable/v1/__init__.py index 5be18f937..41fc9ff9f 100644 --- a/narwhals/stable/v1/__init__.py +++ b/narwhals/stable/v1/__init__.py @@ -1361,8 +1361,9 @@ def median(*columns: str) -> Expr: """ Get the median value. - Note: - Syntactic sugar for ``nw.col(columns).median()`` + Notes: + - Syntactic sugar for ``nw.col(columns).median()`` + - Results might slightly differ across backends due to differences in the underlying algorithms used to compute the median. Arguments: columns: Name(s) of the columns to use in the aggregation function