diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt index 13764543ec665..ad104303b9dbd 100644 --- a/doc/source/whatsnew/v0.17.0.txt +++ b/doc/source/whatsnew/v0.17.0.txt @@ -613,10 +613,15 @@ Performance Improvements Bug Fixes ~~~~~~~~~ - Bug in ``DataFrame.to_html(index=False)`` renders unnecessary ``name`` row (:issue:`10344`) +======= + + +- Bug in ``DataFrame.to_html(index=False)`` renders unnecessary ``name`` row (:issue:`10344`) - Bug in ``DataFrame.apply`` when function returns categorical series. (:issue:`9573`) - Bug in ``to_datetime`` with invalid dates and formats supplied (:issue:`10154`) - Bug in ``Index.drop_duplicates`` dropping name(s) (:issue:`10115`) - Bug in ``pd.Series`` when setting a value on an empty ``Series`` whose index has a frequency. (:issue:`10193`) +- Bug in ``pd.Series.interpolate`` when setting no order value on ``Series.interpolate`` this needs to be at least 1. (:issue:`10633`) and (:issue:`10800`) - Bug in ``DataFrame.plot`` raises ``ValueError`` when color name is specified by multiple characters (:issue:`10387`) - Bug in ``Index`` construction with a mixed list of tuples (:issue:`10697`) - Bug in ``DataFrame.reset_index`` when index contains `NaT`. (:issue:`10388`) diff --git a/pandas/core/common.py b/pandas/core/common.py index aaa341240f538..48ad299cfd658 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -1718,6 +1718,9 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None, bounds_error=bounds_error) new_y = terp(new_x) elif method == 'spline': + # GH #10633 + if not order: + raise ValueError("order needs to be specified and greater than 0") terp = interpolate.UnivariateSpline(x, y, k=order, **kwargs) new_y = terp(new_x) else: diff --git a/pandas/io/tests/generate_legacy_storage_files.py b/pandas/io/tests/generate_legacy_storage_files.py index 86c5a9e0d7f19..0ec3575be04f6 100644 --- a/pandas/io/tests/generate_legacy_storage_files.py +++ b/pandas/io/tests/generate_legacy_storage_files.py @@ -83,9 +83,20 @@ def create_data(): index=MultiIndex.from_tuples(tuple(zip(*[[1, 1, 2, 2, 2], [3, 4, 3, 4, 5]])), names=['one', 'two'])), dup=Series(np.arange(5).astype(np.float64), index=['A', 'B', 'C', 'D', 'A']), +<<<<<<< HEAD +<<<<<<< HEAD cat=Series(Categorical(['foo', 'bar', 'baz']))) if LooseVersion(pandas.__version__) >= '0.17.0': series['period'] = Series([Period('2000Q1')] * 5) +======= + cat=Series(Categorical(['foo', 'bar', 'baz'])), + per=Series([Period('2000Q1')] * 5)) +>>>>>>> 0525684... ENH: pickle support for Period #10439 +======= + cat=Series(Categorical(['foo', 'bar', 'baz']))) + if LooseVersion(pandas.__version__) >= '0.17.0': + series['period'] = Series([Period('2000Q1')] * 5) +>>>>>>> aa04812... update legacy_storage for pickles mixed_dup_df = DataFrame(data) mixed_dup_df.columns = list("ABCDA") diff --git a/pandas/tests/test_generic.py b/pandas/tests/test_generic.py index c1f6045c61d54..d177d9359dfc8 100644 --- a/pandas/tests/test_generic.py +++ b/pandas/tests/test_generic.py @@ -799,7 +799,15 @@ def test_nan_interpolate(self): tm._skip_if_no_scipy() result = s.interpolate(method='polynomial', order=1) assert_series_equal(result, expected) - + + # GH #10633 + def test_interpolate_spline(self): + np.random.seed(1) + t = pd.Series(np.arange(10)**2) + t[np.random.randint(0,9,3)] = np.nan + with tm.assertRaises(ValueError): + t.interpolate(method='spline', order=0) + def test_nan_irregular_index(self): s = Series([1, 2, np.nan, 4], index=[1, 3, 5, 9]) result = s.interpolate() diff --git a/pandas/tseries/tests/test_period.py b/pandas/tseries/tests/test_period.py index eb5c6759bfa45..3a69670f43fb7 100644 --- a/pandas/tseries/tests/test_period.py +++ b/pandas/tseries/tests/test_period.py @@ -2537,7 +2537,17 @@ def test_searchsorted(self): def test_round_trip(self): +<<<<<<< HEAD +<<<<<<< HEAD p = Period('2000Q1') +======= + import pickle + p = Period('2000Q1') + +>>>>>>> 0525684... ENH: pickle support for Period #10439 +======= + p = Period('2000Q1') +>>>>>>> aa04812... update legacy_storage for pickles new_p = self.round_trip_pickle(p) self.assertEqual(new_p, p)