Skip to content

Commit 5708d85

Browse files
committed
Add docstring for Expanding.nunique()
1 parent e2cc83a commit 5708d85

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

pandas/core/window/expanding.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,41 @@ def rank(
927927
numeric_only=numeric_only,
928928
)
929929

930+
@doc(
931+
template_header,
932+
".. versionadded:: 3.0.0 \n\n",
933+
create_section_header("Parameters"),
934+
kwargs_numeric_only,
935+
create_section_header("Returns"),
936+
template_returns,
937+
create_section_header("See Also"),
938+
template_see_also,
939+
create_section_header("Examples"),
940+
dedent(
941+
"""
942+
>>> s = pd.Series([1, 4, 2, 3, 5, 3])
943+
>>> s.expanding().nunique()
944+
0 1.0
945+
1 2.0
946+
2 3.0
947+
3 4.0
948+
4 5.0
949+
5 5.0
950+
dtype: float64
951+
"""
952+
).replace("\n", "", 1),
953+
window_method="expanding",
954+
aggregation_description="nunique",
955+
agg_method="nunique",
956+
)
957+
def nunique(
958+
self,
959+
numeric_only: bool = False,
960+
):
961+
return super().nunique(
962+
numeric_only=numeric_only,
963+
)
964+
930965
@doc(
931966
template_header,
932967
create_section_header("Parameters"),

0 commit comments

Comments
 (0)