Skip to content

Commit 32cc6fa

Browse files
authored
docs: add code samples for series methods (#323)
1 parent bd531a1 commit 32cc6fa

File tree

1 file changed

+76
-0
lines changed
  • third_party/bigframes_vendored/pandas/core

1 file changed

+76
-0
lines changed

third_party/bigframes_vendored/pandas/core/series.py

+76
Original file line numberDiff line numberDiff line change
@@ -2711,6 +2711,31 @@ def argmax(self):
27112711
27122712
If the minimum is achieved in multiple locations, the first row position is returned.
27132713
2714+
**Examples:**
2715+
2716+
>>> import bigframes.pandas as bpd
2717+
>>> bpd.options.display.progress_bar = None
2718+
2719+
Consider dataset containing cereal calories.
2720+
2721+
>>> s = bpd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
2722+
... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
2723+
>>> s
2724+
Corn Flakes 100.0
2725+
Almond Delight 110.0
2726+
Cinnamon Toast Crunch 120.0
2727+
Cocoa Puff 110.0
2728+
dtype: Float64
2729+
2730+
>>> s.argmax()
2731+
2
2732+
2733+
>>> s.argmin()
2734+
0
2735+
2736+
The maximum cereal calories is the third element and the minimum cereal
2737+
calories is the first element, since series is zero-indexed.
2738+
27142739
Returns:
27152740
Series: Row position of the maximum value.
27162741
"""
@@ -2722,6 +2747,31 @@ def argmin(self):
27222747
27232748
If the maximum is achieved in multiple locations, the first row position is returned.
27242749
2750+
**Examples:**
2751+
2752+
>>> import bigframes.pandas as bpd
2753+
>>> bpd.options.display.progress_bar = None
2754+
2755+
Consider dataset containing cereal calories.
2756+
2757+
>>> s = bpd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
2758+
... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
2759+
>>> s
2760+
Corn Flakes 100.0
2761+
Almond Delight 110.0
2762+
Cinnamon Toast Crunch 120.0
2763+
Cocoa Puff 110.0
2764+
dtype: Float64
2765+
2766+
>>> s.argmax()
2767+
2
2768+
2769+
>>> s.argmin()
2770+
0
2771+
2772+
The maximum cereal calories is the third element and the minimum cereal
2773+
calories is the first element, since series is zero-indexed.
2774+
27252775
Returns:
27262776
Series: Row position of the minimum value.
27272777
"""
@@ -2971,6 +3021,19 @@ def is_monotonic_increasing(self) -> bool:
29713021
"""
29723022
Return boolean if values in the object are monotonically increasing.
29733023
3024+
**Examples:**
3025+
3026+
>>> import bigframes.pandas as bpd
3027+
>>> bpd.options.display.progress_bar = None
3028+
3029+
>>> s = bpd.Series([1, 2, 2])
3030+
>>> s.is_monotonic_increasing
3031+
True
3032+
3033+
>>> s = bpd.Series([3, 2, 1])
3034+
>>> s.is_monotonic_increasing
3035+
False
3036+
29743037
Returns:
29753038
bool: Boolean.
29763039
"""
@@ -2981,6 +3044,19 @@ def is_monotonic_decreasing(self) -> bool:
29813044
"""
29823045
Return boolean if values in the object are monotonically decreasing.
29833046
3047+
**Examples:**
3048+
3049+
>>> import bigframes.pandas as bpd
3050+
>>> bpd.options.display.progress_bar = None
3051+
3052+
>>> s = bpd.Series([3, 2, 2, 1])
3053+
>>> s.is_monotonic_decreasing
3054+
True
3055+
3056+
>>> s = bpd.Series([1, 2, 3])
3057+
>>> s.is_monotonic_decreasing
3058+
False
3059+
29843060
Returns:
29853061
bool: Boolean.
29863062
"""

0 commit comments

Comments
 (0)