Skip to content

Commit 79e9112

Browse files
committed
BUG: 10720 adding all
slight update
1 parent e581e1e commit 79e9112

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

pandas/core/common.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,8 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None,
17181718
bounds_error=bounds_error)
17191719
new_y = terp(new_x)
17201720
elif method == 'spline':
1721-
# GH #10633
1721+
1722+
# GH 10633
17221723
if not order:
17231724
raise ValueError("order needs to be specified and greater than 0")
17241725
terp = interpolate.UnivariateSpline(x, y, k=order, **kwargs)

pandas/tests/test_generic.py

+8
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,14 @@ def test_nan_interpolate(self):
799799
tm._skip_if_no_scipy()
800800
result = s.interpolate(method='polynomial', order=1)
801801
assert_series_equal(result, expected)
802+
# GH #10633: first attempt
803+
def test_interpolate_spline(self):
804+
np.random.seed(1)
805+
s = pd.Series(np.arange(10)**2)
806+
s[np.random.randint(0,9,3)] = np.nan
807+
with tm.assertRaises(ValueError):
808+
s.interpolate(method='spline')
809+
802810

803811
def test_nan_irregular_index(self):
804812
s = Series([1, 2, np.nan, 4], index=[1, 3, 5, 9])

pandas/tseries/tests/test_timeseries.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,8 @@ def test_to_datetime_with_apply(self):
923923
assert_series_equal(result, expected)
924924

925925
td = pd.Series(['May 04', 'Jun 02', ''], index=[1,2,3])
926-
self.assertRaises(ValueError, lambda : pd.to_datetime(td,format='%b %y', errors='raise'))
927-
self.assertRaises(ValueError, lambda : td.apply(pd.to_datetime, format='%b %y', errors='raise'))
926+
self.assertRaises(ValueError, 'Unknown string format. You can coerce errors to NaT by passing coerce', lambda : pd.to_datetime(td,format='%b %y', errors='raise'))
927+
self.assertRaises(ValueError, 'Unknown string format. You can coerce errors to NaT by passing coerce',lambda : td.apply(pd.to_datetime, format='%b %y', errors='raise'))
928928
expected = pd.to_datetime(td, format='%b %y', errors='coerce')
929929

930930
result = td.apply(lambda x: pd.to_datetime(x, format='%b %y', errors='coerce'))

0 commit comments

Comments
 (0)