Skip to content

Commit 09a52fd

Browse files
authored
docs: add code samples for Series.{between, cumprod} (#353)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] `Series.between()`: https://screenshot.googleplex.com/BhHpZsL7S9d3FsG - [x] `Series.cumprod()`: https://screenshot.googleplex.com/7o7gDNwJZEWst84 Fixes #<issue_number_goes_here> 🦕
1 parent 5aad3a1 commit 09a52fd

File tree

1 file changed

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

1 file changed

+60
-0
lines changed

third_party/bigframes_vendored/pandas/core/series.py

+60
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,42 @@ def between(
17771777
corresponding Series element is between the boundary values `left` and
17781778
`right`. NA values are treated as `False`.
17791779
1780+
**Examples:**
1781+
1782+
>>> import bigframes.pandas as bpd
1783+
>>> bpd.options.display.progress_bar = None
1784+
1785+
Boundary values are included by default:
1786+
1787+
>>> s = bpd.Series([2, 0, 4, 8, np.nan])
1788+
>>> s.between(1, 4)
1789+
0 True
1790+
1 False
1791+
2 True
1792+
3 False
1793+
4 <NA>
1794+
dtype: boolean
1795+
1796+
With inclusive set to "neither" boundary values are excluded:
1797+
1798+
>>> s.between(1, 4, inclusive="neither")
1799+
0 True
1800+
1 False
1801+
2 False
1802+
3 False
1803+
4 <NA>
1804+
dtype: boolean
1805+
1806+
left and right can be any scalar value:
1807+
1808+
>>> s = bpd.Series(['Alice', 'Bob', 'Carol', 'Eve'])
1809+
>>> s.between('Anna', 'Daniel')
1810+
0 False
1811+
1 True
1812+
2 True
1813+
3 False
1814+
dtype: boolean
1815+
17801816
Args:
17811817
left (scalar or list-like):
17821818
Left boundary.
@@ -1799,6 +1835,30 @@ def cumprod(self):
17991835
Returns a DataFrame or Series of the same size containing the cumulative
18001836
product.
18011837
1838+
**Examples:**
1839+
1840+
>>> import bigframes.pandas as bpd
1841+
>>> bpd.options.display.progress_bar = None
1842+
1843+
>>> s = bpd.Series([2, np.nan, 5, -1, 0])
1844+
>>> s
1845+
0 2.0
1846+
1 <NA>
1847+
2 5.0
1848+
3 -1.0
1849+
4 0.0
1850+
dtype: Float64
1851+
1852+
By default, NA values are ignored.
1853+
1854+
>>> s.cumprod()
1855+
0 2.0
1856+
1 <NA>
1857+
2 10.0
1858+
3 -10.0
1859+
4 0.0
1860+
dtype: Float64
1861+
18021862
Returns:
18031863
bigframes.series.Series: Return cumulative sum of scalar or Series.
18041864
"""

0 commit comments

Comments
 (0)