Skip to content

Commit 3cc6528

Browse files
committed
doc and PEP8
1 parent 9ed7524 commit 3cc6528

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ Other enhancements
308308
- ``pd.types.concat.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
309309
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
310310
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
311+
- ``pd.test()`` will now pass with SciPy 0.19.0. (:issue:`15662`)
311312

312313
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
313314

pandas/core/window.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,8 @@ def _pop_args(win_type, arg_names, kwargs):
544544
return all_args
545545

546546
win_type = _validate_win_type(self.win_type, kwargs)
547-
# GH #15662.
548-
# fftbins should be False; previously it was a mistake on pandas' side.
549-
return sig.get_window(win_type, window, fftbins=False).astype(float)
547+
# GH #15662. `False` makes symmetric window, rather than periodic.
548+
return sig.get_window(win_type, window, False).astype(float)
550549

551550
def _apply_window(self, mean=True, how=None, **kwargs):
552551
"""

pandas/tests/frame/test_missing.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
from pandas.tests.frame.common import TestData, _check_mixed_float
2020

2121

22+
try:
23+
import scipy
24+
_is_scipy_ge_0190 = scipy.__version__ >= LooseVersion('0.19.0')
25+
except:
26+
_is_scipy_ge_0190 = False
27+
28+
2229
def _skip_if_no_pchip():
2330
try:
2431
from scipy.interpolate import pchip_interpolate # noqa
@@ -561,8 +568,10 @@ def test_interp_various(self):
561568
assert_frame_equal(result, expected)
562569

563570
result = df.interpolate(method='cubic')
564-
import scipy
565-
if scipy.__version__ >= LooseVersion('0.19.0'):
571+
# GH #15662.
572+
# new cubic and quadratic interpolation algorithms from scipy 0.19.0.
573+
# previously `splmake` was used. See scipy/scipy#6710
574+
if _is_scipy_ge_0190:
566575
expected.A.loc[3] = 2.81547781
567576
expected.A.loc[13] = 5.52964175
568577
else:
@@ -576,7 +585,7 @@ def test_interp_various(self):
576585
assert_frame_equal(result, expected, check_dtype=False)
577586

578587
result = df.interpolate(method='quadratic')
579-
if scipy.__version__ >= LooseVersion('0.19.0'):
588+
if _is_scipy_ge_0190:
580589
expected.A.loc[3] = 2.82150771
581590
expected.A.loc[13] = 6.12648668
582591
else:
@@ -594,7 +603,6 @@ def test_interp_various(self):
594603
expected.A.loc[13] = 5
595604
assert_frame_equal(result, expected, check_dtype=False)
596605

597-
598606
def test_interp_alt_scipy(self):
599607
tm._skip_if_no_scipy()
600608
df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7],

pandas/tests/series/test_missing.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
from .common import TestData
2020

21+
try:
22+
import scipy
23+
_is_scipy_ge_0190 = scipy.__version__ >= LooseVersion('0.19.0')
24+
except:
25+
_is_scipy_ge_0190 = False
26+
2127

2228
def _skip_if_no_pchip():
2329
try:
@@ -853,8 +859,10 @@ def test_interp_scipy_basic(self):
853859
result = s.interpolate(method='zero', downcast='infer')
854860
assert_series_equal(result, expected)
855861
# quadratic
856-
import scipy
857-
if scipy.__version__ >= LooseVersion('0.19.0'):
862+
# GH #15662.
863+
# new cubic and quadratic interpolation algorithms from scipy 0.19.0.
864+
# previously `splmake` was used. See scipy/scipy#6710
865+
if _is_scipy_ge_0190:
858866
expected = Series([1, 3., 6.823529, 12., 18.058824, 25.])
859867
else:
860868
expected = Series([1, 3., 6.769231, 12., 18.230769, 25.])

0 commit comments

Comments
 (0)