diff --git a/narwhals/expr.py b/narwhals/expr.py index 405e26ae7..18b5d196d 100644 --- a/narwhals/expr.py +++ b/narwhals/expr.py @@ -485,36 +485,36 @@ def ewm_mean( │ 2.428571 │ └──────────┘ - pandas and Polars handle nulls differently. So, When calculating ewm over - a sequence with null values, leading to distinct results: + pandas and Polars handle nulls differently. So, calculating ewm over + a sequence with null values leads to distinct results: - >>> data = {"a": [2.0, 4.0, None, 3.0, float("nan"), 3.0]} - >>> df_pd2 = pd.DataFrame(data) - >>> df_pl2 = pl.DataFrame(data) + >>> data = {"a": [2.0, 4.0, None, 3.0, float("nan"), 3.0]} + >>> df_pd2 = pd.DataFrame(data) + >>> df_pl2 = pl.DataFrame(data) - >>> func(df_pd2) - a - 0 2.000000 - 1 3.333333 - 2 3.333333 - 3 3.090909 - 4 3.090909 - 5 3.023256 - - >>> func(df_pl2) # doctest: +NORMALIZE_WHITESPACE - shape: (6, 1) - ┌──────────┐ - │ a │ - │ --- │ - │ f64 │ - ╞══════════╡ - │ 2.0 │ - │ 3.333333 │ - │ null │ - │ 3.090909 │ - │ NaN │ - │ NaN │ - └──────────┘ + >>> func(df_pd2) + a + 0 2.000000 + 1 3.333333 + 2 3.333333 + 3 3.090909 + 4 3.090909 + 5 3.023256 + + >>> func(df_pl2) # doctest: +NORMALIZE_WHITESPACE + shape: (6, 1) + ┌──────────┐ + │ a │ + │ --- │ + │ f64 │ + ╞══════════╡ + │ 2.0 │ + │ 3.333333 │ + │ null │ + │ 3.090909 │ + │ NaN │ + │ NaN │ + └──────────┘ """ return self.__class__( lambda plx: self._call(plx).ewm_mean( diff --git a/narwhals/series.py b/narwhals/series.py index 54e273a45..72b2b8aac 100644 --- a/narwhals/series.py +++ b/narwhals/series.py @@ -464,8 +464,8 @@ def ewm_mean( 2.428571 ] - pandas and Polars handle nulls differently. So, When calculating ewm over - a sequence with null values, leading to distinct results: + pandas and Polars handle nulls differently. So, calculating ewm over + a sequence with null values leads to distinct results: >>> data = [2.0, 4.0, None, 3.0, float("nan"), 3.0] >>> s_pd2 = pd.Series(name="a", data=data)