Skip to content

Commit 3a375e8

Browse files
authored
docs: add examples for dataframe.min, dataframe.max and dataframe.sum (#227)
* docs: add examples for dataframe.min, dataframe.max and dataframe.sum * update spacing
1 parent 71844b0 commit 3a375e8

File tree

1 file changed

+84
-3
lines changed
  • third_party/bigframes_vendored/pandas/core

1 file changed

+84
-3
lines changed

third_party/bigframes_vendored/pandas/core/frame.py

+84-3
Original file line numberDiff line numberDiff line change
@@ -2597,7 +2597,7 @@ def any(self, *, axis=0, bool_only: bool = False):
25972597
<BLANKLINE>
25982598
[2 rows x 2 columns]
25992599
2600-
Checking if each column contains at least one True element(the default behavior without an explicit axis parameter).
2600+
Checking if each column contains at least one True element (the default behavior without an explicit axis parameter).
26012601
26022602
>>> df.any()
26032603
A True
@@ -2644,7 +2644,7 @@ def all(self, axis=0, *, bool_only: bool = False):
26442644
<BLANKLINE>
26452645
[2 rows x 2 columns]
26462646
2647-
Checking if all values in each column are True(the default behavior without an explicit axis parameter).
2647+
Checking if all values in each column are True (the default behavior without an explicit axis parameter).
26482648
26492649
>>> df.all()
26502650
A True
@@ -2688,7 +2688,7 @@ def prod(self, axis=0, *, numeric_only: bool = False):
26882688
<BLANKLINE>
26892689
[3 rows x 2 columns]
26902690
2691-
Calculating the product of each column(the default behavior without an explicit axis parameter).
2691+
Calculating the product of each column (the default behavior without an explicit axis parameter).
26922692
26932693
>>> df.prod()
26942694
A 6.0
@@ -2721,6 +2721,33 @@ def min(self, axis=0, *, numeric_only: bool = False):
27212721
If you want the *index* of the minimum, use ``idxmin``. This is the
27222722
equivalent of the ``numpy.ndarray`` method ``argmin``.
27232723
2724+
**Examples:**
2725+
2726+
>>> import bigframes.pandas as bpd
2727+
>>> bpd.options.display.progress_bar = None
2728+
2729+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2730+
>>> df
2731+
A B
2732+
0 1 2
2733+
1 3 4
2734+
<BLANKLINE>
2735+
[2 rows x 2 columns]
2736+
2737+
Finding the minimum value in each column (the default behavior without an explicit axis parameter).
2738+
2739+
>>> df.min()
2740+
A 1.0
2741+
B 2.0
2742+
dtype: Float64
2743+
2744+
Finding the minimum value in each row.
2745+
2746+
>>> df.min(axis=1)
2747+
0 1.0
2748+
1 3.0
2749+
dtype: Float64
2750+
27242751
Args:
27252752
axis ({index (0), columns (1)}):
27262753
Axis for the function to be applied on.
@@ -2739,6 +2766,33 @@ def max(self, axis=0, *, numeric_only: bool = False):
27392766
If you want the *index* of the maximum, use ``idxmax``. This is
27402767
the equivalent of the ``numpy.ndarray`` method ``argmax``.
27412768
2769+
**Examples:**
2770+
2771+
>>> import bigframes.pandas as bpd
2772+
>>> bpd.options.display.progress_bar = None
2773+
2774+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2775+
>>> df
2776+
A B
2777+
0 1 2
2778+
1 3 4
2779+
<BLANKLINE>
2780+
[2 rows x 2 columns]
2781+
2782+
Finding the maximum value in each column (the default behavior without an explicit axis parameter).
2783+
2784+
>>> df.max()
2785+
A 3.0
2786+
B 4.0
2787+
dtype: Float64
2788+
2789+
Finding the maximum value in each row.
2790+
2791+
>>> df.max(axis=1)
2792+
0 2.0
2793+
1 4.0
2794+
dtype: Float64
2795+
27422796
Args:
27432797
axis ({index (0), columns (1)}):
27442798
Axis for the function to be applied on.
@@ -2756,6 +2810,33 @@ def sum(self, axis=0, *, numeric_only: bool = False):
27562810
27572811
This is equivalent to the method ``numpy.sum``.
27582812
2813+
**Examples:**
2814+
2815+
>>> import bigframes.pandas as bpd
2816+
>>> bpd.options.display.progress_bar = None
2817+
2818+
>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
2819+
>>> df
2820+
A B
2821+
0 1 2
2822+
1 3 4
2823+
<BLANKLINE>
2824+
[2 rows x 2 columns]
2825+
2826+
Calculating the sum of each column (the default behavior without an explicit axis parameter).
2827+
2828+
>>> df.sum()
2829+
A 4.0
2830+
B 6.0
2831+
dtype: Float64
2832+
2833+
Calculating the sum of each row.
2834+
2835+
>>> df.sum(axis=1)
2836+
0 3.0
2837+
1 7.0
2838+
dtype: Float64
2839+
27592840
Args:
27602841
axis ({index (0), columns (1)}):
27612842
Axis for the function to be applied on.

0 commit comments

Comments
 (0)