Skip to content

Commit

Permalink
docs: add code samples for series methods (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleyxuu authored Jan 18, 2024
1 parent bd531a1 commit 32cc6fa
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions third_party/bigframes_vendored/pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,31 @@ def argmax(self):
If the minimum is achieved in multiple locations, the first row position is returned.
**Examples:**
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
Consider dataset containing cereal calories.
>>> s = bpd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
>>> s
Corn Flakes 100.0
Almond Delight 110.0
Cinnamon Toast Crunch 120.0
Cocoa Puff 110.0
dtype: Float64
>>> s.argmax()
2
>>> s.argmin()
0
The maximum cereal calories is the third element and the minimum cereal
calories is the first element, since series is zero-indexed.
Returns:
Series: Row position of the maximum value.
"""
Expand All @@ -2722,6 +2747,31 @@ def argmin(self):
If the maximum is achieved in multiple locations, the first row position is returned.
**Examples:**
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
Consider dataset containing cereal calories.
>>> s = bpd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
>>> s
Corn Flakes 100.0
Almond Delight 110.0
Cinnamon Toast Crunch 120.0
Cocoa Puff 110.0
dtype: Float64
>>> s.argmax()
2
>>> s.argmin()
0
The maximum cereal calories is the third element and the minimum cereal
calories is the first element, since series is zero-indexed.
Returns:
Series: Row position of the minimum value.
"""
Expand Down Expand Up @@ -2971,6 +3021,19 @@ def is_monotonic_increasing(self) -> bool:
"""
Return boolean if values in the object are monotonically increasing.
**Examples:**
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
>>> s = bpd.Series([1, 2, 2])
>>> s.is_monotonic_increasing
True
>>> s = bpd.Series([3, 2, 1])
>>> s.is_monotonic_increasing
False
Returns:
bool: Boolean.
"""
Expand All @@ -2981,6 +3044,19 @@ def is_monotonic_decreasing(self) -> bool:
"""
Return boolean if values in the object are monotonically decreasing.
**Examples:**
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
>>> s = bpd.Series([3, 2, 2, 1])
>>> s.is_monotonic_decreasing
True
>>> s = bpd.Series([1, 2, 3])
>>> s.is_monotonic_decreasing
False
Returns:
bool: Boolean.
"""
Expand Down

0 comments on commit 32cc6fa

Please sign in to comment.