Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0523a31

Browse files
authoredDec 1, 2023
docs: add examples for dataframe.cummin, dataframe.cummax, dataframe.cumsum, dataframe.cumprod (#243)
1 parent 1737acc commit 0523a31

File tree

1 file changed

+92
-4
lines changed
  • third_party/bigframes_vendored/pandas/core

1 file changed

+92
-4
lines changed
 

‎third_party/bigframes_vendored/pandas/core/frame.py

+92-4
Original file line numberDiff line numberDiff line change
@@ -3367,40 +3367,128 @@ def nunique(self):
33673367
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
33683368

33693369
def cummin(self) -> DataFrame:
3370-
"""Return cumulative minimum over a DataFrame axis.
3370+
"""Return cumulative minimum over columns.
33713371
33723372
Returns a DataFrame of the same size containing the cumulative minimum.
33733373
3374+
**Examples:**
3375+
3376+
>>> import bigframes.pandas as bpd
3377+
>>> bpd.options.display.progress_bar = None
3378+
3379+
>>> df = bpd.DataFrame({"A": [3, 1, 2], "B": [1, 2, 3]})
3380+
>>> df
3381+
A B
3382+
0 3 1
3383+
1 1 2
3384+
2 2 3
3385+
<BLANKLINE>
3386+
[3 rows x 2 columns]
3387+
3388+
>>> df.cummin()
3389+
A B
3390+
0 3 1
3391+
1 1 1
3392+
2 1 1
3393+
<BLANKLINE>
3394+
[3 rows x 2 columns]
3395+
33743396
Returns:
33753397
bigframes.dataframe.DataFrame: Return cumulative minimum of DataFrame.
33763398
"""
33773399
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
33783400

33793401
def cummax(self) -> DataFrame:
3380-
"""Return cumulative maximum over a DataFrame axis.
3402+
"""Return cumulative maximum over columns.
33813403
33823404
Returns a DataFrame of the same size containing the cumulative maximum.
33833405
3406+
**Examples:**
3407+
3408+
>>> import bigframes.pandas as bpd
3409+
>>> bpd.options.display.progress_bar = None
3410+
3411+
>>> df = bpd.DataFrame({"A": [3, 1, 2], "B": [1, 2, 3]})
3412+
>>> df
3413+
A B
3414+
0 3 1
3415+
1 1 2
3416+
2 2 3
3417+
<BLANKLINE>
3418+
[3 rows x 2 columns]
3419+
3420+
>>> df.cummax()
3421+
A B
3422+
0 3 1
3423+
1 3 2
3424+
2 3 3
3425+
<BLANKLINE>
3426+
[3 rows x 2 columns]
3427+
33843428
Returns:
33853429
bigframes.dataframe.DataFrame: Return cumulative maximum of DataFrame.
33863430
"""
33873431
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
33883432

33893433
def cumsum(self) -> DataFrame:
3390-
"""Return cumulative sum over a DataFrame axis.
3434+
"""Return cumulative sum over columns.
33913435
33923436
Returns a DataFrame of the same size containing the cumulative sum.
33933437
3438+
**Examples:**
3439+
3440+
>>> import bigframes.pandas as bpd
3441+
>>> bpd.options.display.progress_bar = None
3442+
3443+
>>> df = bpd.DataFrame({"A": [3, 1, 2], "B": [1, 2, 3]})
3444+
>>> df
3445+
A B
3446+
0 3 1
3447+
1 1 2
3448+
2 2 3
3449+
<BLANKLINE>
3450+
[3 rows x 2 columns]
3451+
3452+
>>> df.cumsum()
3453+
A B
3454+
0 3 1
3455+
1 4 3
3456+
2 6 6
3457+
<BLANKLINE>
3458+
[3 rows x 2 columns]
3459+
33943460
Returns:
33953461
bigframes.dataframe.DataFrame: Return cumulative sum of DataFrame.
33963462
"""
33973463
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
33983464

33993465
def cumprod(self) -> DataFrame:
3400-
"""Return cumulative product over a DataFrame axis.
3466+
"""Return cumulative product over columns.
34013467
34023468
Returns a DataFrame of the same size containing the cumulative product.
34033469
3470+
**Examples:**
3471+
3472+
>>> import bigframes.pandas as bpd
3473+
>>> bpd.options.display.progress_bar = None
3474+
3475+
>>> df = bpd.DataFrame({"A": [3, 1, 2], "B": [1, 2, 3]})
3476+
>>> df
3477+
A B
3478+
0 3 1
3479+
1 1 2
3480+
2 2 3
3481+
<BLANKLINE>
3482+
[3 rows x 2 columns]
3483+
3484+
>>> df.cumprod()
3485+
A B
3486+
0 3 1
3487+
1 3 2
3488+
2 6 6
3489+
<BLANKLINE>
3490+
[3 rows x 2 columns]
3491+
34043492
Returns:
34053493
bigframes.dataframe.DataFrame: Return cumulative product of DataFrame.
34063494
"""

0 commit comments

Comments
 (0)
Failed to load comments.