Skip to content

Commit

Permalink
doc and PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
zym1010 committed Mar 15, 2017
1 parent 9ed7524 commit 3cc6528
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ Other enhancements
- ``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.
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
- ``pd.test()`` will now pass with SciPy 0.19.0. (:issue:`15662`)

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

Expand Down
5 changes: 2 additions & 3 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,8 @@ def _pop_args(win_type, arg_names, kwargs):
return all_args

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

def _apply_window(self, mean=True, how=None, **kwargs):
"""
Expand Down
16 changes: 12 additions & 4 deletions pandas/tests/frame/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
from pandas.tests.frame.common import TestData, _check_mixed_float


try:
import scipy
_is_scipy_ge_0190 = scipy.__version__ >= LooseVersion('0.19.0')
except:
_is_scipy_ge_0190 = False


def _skip_if_no_pchip():
try:
from scipy.interpolate import pchip_interpolate # noqa
Expand Down Expand Up @@ -561,8 +568,10 @@ def test_interp_various(self):
assert_frame_equal(result, expected)

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

result = df.interpolate(method='quadratic')
if scipy.__version__ >= LooseVersion('0.19.0'):
if _is_scipy_ge_0190:
expected.A.loc[3] = 2.82150771
expected.A.loc[13] = 6.12648668
else:
Expand All @@ -594,7 +603,6 @@ def test_interp_various(self):
expected.A.loc[13] = 5
assert_frame_equal(result, expected, check_dtype=False)


def test_interp_alt_scipy(self):
tm._skip_if_no_scipy()
df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7],
Expand Down
12 changes: 10 additions & 2 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

from .common import TestData

try:
import scipy
_is_scipy_ge_0190 = scipy.__version__ >= LooseVersion('0.19.0')
except:
_is_scipy_ge_0190 = False


def _skip_if_no_pchip():
try:
Expand Down Expand Up @@ -853,8 +859,10 @@ def test_interp_scipy_basic(self):
result = s.interpolate(method='zero', downcast='infer')
assert_series_equal(result, expected)
# quadratic
import scipy
if scipy.__version__ >= LooseVersion('0.19.0'):
# GH #15662.
# new cubic and quadratic interpolation algorithms from scipy 0.19.0.
# previously `splmake` was used. See scipy/scipy#6710
if _is_scipy_ge_0190:
expected = Series([1, 3., 6.823529, 12., 18.058824, 25.])
else:
expected = Series([1, 3., 6.769231, 12., 18.230769, 25.])
Expand Down

0 comments on commit 3cc6528

Please sign in to comment.