8000 BUG: Fix exceptions when Series.interpolate's `order` parameter is missing or invalid by nmusolino · Pull Request #25246 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix exceptions when Series.interpolate's order parameter is missing or invalid #25246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Next Next commit
CLN: break test into distinct test case
  • Loading branch information
nmusolino committed Feb 11, 2019
commit 33a0de29ef8bad1ec8f66935de8916ef23bfed9b
11 changes: 5 additions & 6 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,11 @@ def test_interpolate(self, datetime_series, string_series):
time_interp = ord_ts_copy.interpolate(method='time')
tm.assert_series_equal(time_interp, ord_ts)

# try time interpolation on a non-TimeSeries
# Only raises ValueError if there are NaNs.
non_ts = string_series.copy()
non_ts[0] = np.NaN
msg = ("time-weighted interpolation only works on Series or DataFrames"
" with a DatetimeIndex")
def test_interpolate_time_raises_for_non_timeseries(self):
# When method='time' is used on a non-TimeSeries that contains a null
# value, a ValueError should be raised.
non_ts = Series([0, 1, 2, np.NaN])
msg = "time-weighted interpolation only works on Series.* with a DatetimeIndex"
with pytest.raises(ValueError, match=msg):
non_ts.interpolate(method='time')

Expand Down
0