Skip to content

Commit ae69177

Browse files
committed
docs: add examples for dataframe.min, dataframe.max and dataframe.sum
1 parent ed8876d commit ae69177

File tree

1 file changed

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

1 file changed

+81
-0
lines changed

third_party/bigframes_vendored/pandas/core/frame.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,6 +2638,33 @@ def min(self, axis=0, *, numeric_only: bool = False):
26382638
If you want the *index* of the minimum, use ``idxmin``. This is the
26392639
equivalent of the ``numpy.ndarray`` method ``argmin``.
26402640
2641+
**Examples:**
2642+
2643+
>>> import bigframes.pandas as bpd
2644+
>>> bpd.options.display.progress_bar = None
2645+
2646+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2647+
>>> df
2648+
A B
2649+
0 1 2
2650+
1 3 4
2651+
<BLANKLINE>
2652+
[2 rows x 2 columns]
2653+
2654+
Finding the minimum value in each column(the default behavior without an explicit axis parameter).
2655+
2656+
>>> df.min()
2657+
A 1.0
2658+
B 2.0
2659+
dtype: Float64
2660+
2661+
Finding the minimum value in each row.
2662+
2663+
>>> df.min(axis=1)
2664+
0 1.0
2665+
1 3.0
2666+
dtype: Float64
2667+
26412668
Args:
26422669
axis ({index (0), columns (1)}):
26432670
Axis for the function to be applied on.
@@ -2656,6 +2683,33 @@ def max(self, axis=0, *, numeric_only: bool = False):
26562683
If you want the *index* of the maximum, use ``idxmax``. This is
26572684
the equivalent of the ``numpy.ndarray`` method ``argmax``.
26582685
2686+
**Examples:**
2687+
2688+
>>> import bigframes.pandas as bpd
2689+
>>> bpd.options.display.progress_bar = None
2690+
2691+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2692+
>>> df
2693+
A B
2694+
0 1 2
2695+
1 3 4
2696+
<BLANKLINE>
2697+
[2 rows x 2 columns]
2698+
2699+
Finding the maximum value in each column(the default behavior without an explicit axis parameter).
2700+
2701+
>>> df.max()
2702+
A 3.0
2703+
B 4.0
2704+
dtype: Float64
2705+
2706+
Finding the maximum value in each row.
2707+
2708+
>>> df.max(axis=1)
2709+
0 2.0
2710+
1 4.0
2711+
dtype: Float64
2712+
26592713
Args:
26602714
axis ({index (0), columns (1)}):
26612715
Axis for the function to be applied on.
@@ -2673,6 +2727,33 @@ def sum(self, axis=0, *, numeric_only: bool = False):
26732727
26742728
This is equivalent to the method ``numpy.sum``.
26752729
2730+
**Examples:**
2731+
2732+
>>> import bigframes.pandas as bpd
2733+
>>> bpd.options.display.progress_bar = None
2734+
2735+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2736+
>>> df
2737+
A B
2738+
0 1 2
2739+
1 3 4
2740+
<BLANKLINE>
2741+
[2 rows x 2 columns]
2742+
2743+
Calculating the sum of each column(the default behavior without an explicit axis parameter).
2744+
2745+
>>> df.sum()
2746+
A 4.0
2747+
B 6.0
2748+
dtype: Float64
2749+
2750+
Calculating the sum of each row.
2751+
2752+
>>> df.sum(axis=1)
2753+
0 3.0
2754+
1 7.0
2755+
dtype: Float64
2756+
26762757
Args:
26772758
axis ({index (0), columns (1)}):
26782759
Axis for the function to be applied on.

0 commit comments

Comments
 (0)