Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix interpolate docstrings to render examples
  • Loading branch information
TrevorBergeron committed Nov 8, 2023
commit 5fe6dec6d612b0279545681b75d01088bc898b00
28 changes: 14 additions & 14 deletions third_party/bigframes_vendored/pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2788,20 +2788,6 @@ def interpolate(self, method: str = "linear"):
"""
Fill NaN values using an interpolation method.

Args:
method (str, default 'linear'):
Interpolation technique to use. Only 'linear' supported.
'linear': Ignore the index and treat the values as equally spaced.
This is the only method supported on MultiIndexes.
'index', 'values': use the actual numerical values of the index.
'pad': Fill in NaNs using existing values.
'nearest', 'zero', 'slinear': Emulates `scipy.interpolate.interp1d`

Returns:
DataFrame:
Returns the same object type as the caller, interpolated at
some or all ``NaN`` values

**Examples:**

>>> import bigframes.pandas as bpd
Expand Down Expand Up @@ -2831,6 +2817,20 @@ def interpolate(self, method: str = "linear"):
1.0 6.0 3.0
<BLANKLINE>
[6 rows x 2 columns]

Args:
method (str, default 'linear'):
Interpolation technique to use. Only 'linear' supported.
'linear': Ignore the index and treat the values as equally spaced.
This is the only method supported on MultiIndexes.
'index', 'values': use the actual numerical values of the index.
Comment thread
TrevorBergeron marked this conversation as resolved.
'pad': Fill in NaNs using existing values.
'nearest', 'zero', 'slinear': Emulates `scipy.interpolate.interp1d`

Returns:
DataFrame:
Returns the same object type as the caller, interpolated at
some or all ``NaN`` values
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down
46 changes: 31 additions & 15 deletions third_party/bigframes_vendored/pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,37 @@ def interpolate(self, method: str = "linear"):
"""
Fill NaN values using an interpolation method.

**Examples:**

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

>>> df = bpd.DataFrame({
... 'A': [1, 2, 3, None, None, 6],
... 'B': [None, 6, None, 2, None, 3],
... }, index=[0, 0.1, 0.3, 0.7, 0.9, 1.0])
>>> df.interpolate()
A B
0.0 1.0 <NA>
0.1 2.0 6.0
0.3 3.0 4.0
0.7 4.0 2.0
0.9 5.0 2.5
1.0 6.0 3.0
<BLANKLINE>
[6 rows x 2 columns]
>>> df.interpolate(method="values")
A B
0.0 1.0 <NA>
0.1 2.0 6.0
0.3 3.0 4.666667
0.7 4.714286 2.0
0.9 5.571429 2.666667
1.0 6.0 3.0
<BLANKLINE>
[6 rows x 2 columns]


Args:
method (str, default 'linear'):
Interpolation technique to use. Only 'linear' supported.
Expand All @@ -932,21 +963,6 @@ def interpolate(self, method: str = "linear"):
Series:
Returns the same object type as the caller, interpolated at
some or all ``NaN`` values

**Examples:**

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

>>> series = bpd.Series([1, 2, 3, None, None, 6])
>>> series.interpolate()
0 1.0
1 2.0
2 3.0
3 4.0
4 5.0
5 6.0
dtype: Float64
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down