Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
docs: add code samples for Series.{between, cumprod}
  • Loading branch information
ashleyxuu committed Jan 26, 2024
commit c25ed02b4079917eb421d2a4e3d0cfb249a95a0b
60 changes: 60 additions & 0 deletions third_party/bigframes_vendored/pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,42 @@ def between(
corresponding Series element is between the boundary values `left` and
`right`. NA values are treated as `False`.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

Boundary values are included by default:

>>> s = bpd.Series([2, 0, 4, 8, np.nan])
>>> s.between(1, 4)
0 True
1 False
2 True
3 False
4 <NA>
dtype: boolean

With inclusive set to "neither" boundary values are excluded:

>>> s.between(1, 4, inclusive="neither")
0 True
1 False
2 False
3 False
4 <NA>
dtype: boolean

left and right can be any scalar value:

>>> s = bpd.Series(['Alice', 'Bob', 'Carol', 'Eve'])
>>> s.between('Anna', 'Daniel')
0 False
1 True
2 True
3 False
dtype: boolean

Args:
left (scalar or list-like):
Left boundary.
Expand All @@ -1796,6 +1832,30 @@ def cumprod(self):
Returns a DataFrame or Series of the same size containing the cumulative
product.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> s = bpd.Series([2, np.nan, 5, -1, 0])
>>> s
0 2.0
1 <NA>
2 5.0
3 -1.0
4 0.0
dtype: Float64

By default, NA values are ignored.

>>> s.cumprod()
0 2.0
1 <NA>
2 10.0
3 -10.0
4 0.0
dtype: Float64

Returns:
bigframes.series.Series: Return cumulative sum of scalar or Series.
"""
Expand Down