From 4a9c8c77504156fb605fd758389d33d6ee2b0da6 Mon Sep 17 00:00:00 2001 From: Zhengbo Wang Date: Sat, 28 Dec 2024 23:30:39 +0800 Subject: [PATCH] docs: add return type descriptions to Series `arg_true`, `cast`, `clip`, `count` (#1667) --- narwhals/series.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/narwhals/series.py b/narwhals/series.py index 37d6b29db..b5b6e1746 100644 --- a/narwhals/series.py +++ b/narwhals/series.py @@ -598,6 +598,9 @@ def cast(self: Self, dtype: DType | type[DType]) -> Self: Arguments: dtype: Data type that the object will be cast into. + Returns: + A new Series with the specified data type. + Examples: >>> import pandas as pd >>> import polars as pl @@ -812,6 +815,9 @@ def skew(self: Self) -> Any: def count(self) -> Any: """Returns the number of non-null elements in the Series. + Returns: + The number of non-null elements in the Series. + Examples: >>> import pandas as pd >>> import polars as pl @@ -1117,6 +1123,9 @@ def clip( lower_bound: Lower bound value. upper_bound: Upper bound value. + Returns: + A new Series with values clipped to the specified bounds. + Examples: >>> import pandas as pd >>> import polars as pl @@ -1252,6 +1261,9 @@ def is_in(self, other: Any) -> Self: def arg_true(self) -> Self: """Find elements where boolean Series is True. + Returns: + A new Series with the indices of elements that are True. + Examples: >>> import pandas as pd >>> import polars as pl