Skip to content

Commit bcd1951

Browse files
committed
DEPS: set min versions
closes pandas-dev#15206, numpy >= 1.9 closes pandas-dev#15543, matplotlib >= 1.4.3 closes pandas-dev#15214, bottleneck >= 1.0.0 scipy >= 0.14.0
1 parent 81f8ace commit bcd1951

21 files changed

+60
-175
lines changed

Diff for: ci/requirements-2.7_COMPAT.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
python=2.7*
2-
numpy=1.7.1
2+
numpy=1.9.1
33
cython=0.23
44
dateutil=1.5
55
pytz=2013b

Diff for: ci/requirements-2.7_COMPAT.run

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
numpy=1.7.1
1+
numpy=1.9.1
22
dateutil=1.5
33
pytz=2013b
4-
scipy=0.11.0
4+
scipy=0.14.0
55
xlwt=0.7.5
66
xlrd=0.9.2
7-
bottleneck=0.8.0
7+
bottleneck=1.0.0
88
numexpr=2.2.2
99
pytables=3.0.0
1010
html5lib=1.0b2

Diff for: ci/requirements-2.7_LOCALE.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
python=2.7*
22
python-dateutil
33
pytz=2013b
4-
numpy=1.8.2
4+
numpy=1.9.1
55
cython=0.23

Diff for: ci/requirements-2.7_LOCALE.run

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
python-dateutil
22
pytz=2013b
3-
numpy=1.8.2
3+
numpy=1.9.1
44
xlwt=0.7.5
55
openpyxl=1.6.2
66
xlsxwriter=0.4.6
77
xlrd=0.9.2
8-
bottleneck=0.8.0
9-
matplotlib=1.3.1
8+
bottleneck=1.0.0
9+
matplotlib=1.4.3
1010
sqlalchemy=0.8.1
1111
html5lib=1.0b2
1212
lxml=3.2.1

Diff for: ci/requirements-2.7_SLOW.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
python=2.7*
22
python-dateutil
33
pytz
4-
numpy=1.8.2
4+
numpy=1.9.1
55
cython

Diff for: ci/requirements-2.7_SLOW.run

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
python-dateutil
22
pytz
3-
numpy=1.8.2
4-
matplotlib=1.3.1
3+
numpy=1.9.1
4+
matplotlib=1.4.3
55
scipy
66
patsy
77
xlwt

Diff for: pandas/_libs/sparse.pyx

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ from distutils.version import LooseVersion
1212

1313
# numpy versioning
1414
_np_version = np.version.short_version
15-
_np_version_under1p8 = LooseVersion(_np_version) < '1.8'
16-
_np_version_under1p9 = LooseVersion(_np_version) < '1.9'
1715
_np_version_under1p10 = LooseVersion(_np_version) < '1.10'
1816
_np_version_under1p11 = LooseVersion(_np_version) < '1.11'
1917

Diff for: pandas/compat/numpy/__init__.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
# numpy versioning
1010
_np_version = np.__version__
1111
_nlv = LooseVersion(_np_version)
12-
_np_version_under1p8 = _nlv < '1.8'
13-
_np_version_under1p9 = _nlv < '1.9'
1412
_np_version_under1p10 = _nlv < '1.10'
1513
_np_version_under1p11 = _nlv < '1.11'
1614
_np_version_under1p12 = _nlv < '1.12'
1715
_np_version_under1p13 = _nlv < '1.13'
1816
_np_version_under1p14 = _nlv < '1.14'
17+
_np_version_under1p15 = _nlv < '1.15'
1918

20-
if _nlv < '1.7.0':
19+
if _nlv < '1.9':
2120
raise ImportError('this version of pandas is incompatible with '
22-
'numpy < 1.7.0\n'
21+
'numpy < 1.9.0\n'
2322
'your numpy version is {0}.\n'
24-
'Please upgrade numpy to >= 1.7.0 to use '
23+
'Please upgrade numpy to >= 1.9.0 to use '
2524
'this pandas version'.format(_np_version))
2625

2726

@@ -70,11 +69,10 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
7069

7170

7271
__all__ = ['np',
73-
'_np_version_under1p8',
74-
'_np_version_under1p9',
7572
'_np_version_under1p10',
7673
'_np_version_under1p11',
7774
'_np_version_under1p12',
7875
'_np_version_under1p13',
79-
'_np_version_under1p14'
76+
'_np_version_under1p14',
77+
'_np_version_under1p15'
8078
]

Diff for: pandas/core/algorithms.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from warnings import warn, catch_warnings
77
import numpy as np
88

9-
from pandas import compat, _np_version_under1p8
9+
from pandas import compat
1010
from pandas.core.dtypes.cast import maybe_promote
1111
from pandas.core.dtypes.generic import (
1212
ABCSeries, ABCIndex,
@@ -398,11 +398,9 @@ def isin(comps, values):
398398
comps, dtype, _ = _ensure_data(comps)
399399
values, _, _ = _ensure_data(values, dtype=dtype)
400400

401-
# GH11232
402-
# work-around for numpy < 1.8 and comparisions on py3
403401
# faster for larger cases to use np.in1d
404402
f = lambda x, y: htable.ismember_object(x, values)
405-
if (_np_version_under1p8 and compat.PY3) or len(comps) > 1000000:
403+
if len(comps) > 1000000:
406404
f = lambda x, y: np.in1d(x, y)
407405
elif is_integer_dtype(comps):
408406
try:

Diff for: pandas/core/generic.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1744,11 +1744,8 @@ def _box_item_values(self, key, values):
17441744

17451745
def _maybe_cache_changed(self, item, value):
17461746
"""The object has called back to us saying maybe it has changed.
1747-
1748-
numpy < 1.8 has an issue with object arrays and aliasing
1749-
GH6026
17501747
"""
1751-
self._data.set(item, value, check=pd._np_version_under1p8)
1748+
self._data.set(item, value, check=False)
17521749

17531750
@property
17541751
def _is_cached(self):

Diff for: pandas/core/groupby.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414

1515
from pandas import compat
16-
from pandas.compat.numpy import function as nv, _np_version_under1p8
16+
from pandas.compat.numpy import function as nv
1717
from pandas.compat import set_function_name
1818

1919
from pandas.core.dtypes.common import (
@@ -3256,11 +3256,7 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
32563256
d = np.diff(np.r_[idx, len(ids)])
32573257
if dropna:
32583258
m = ids[lab == -1]
3259-
if _np_version_under1p8:
3260-
mi, ml = algorithms.factorize(m)
3261-
d[ml] = d[ml] - np.bincount(mi)
3262-
else:
3263-
np.add.at(d, m, -1)
3259+
np.add.at(d, m, -1)
32643260
acc = rep(d)[mask]
32653261
else:
32663262
acc = rep(d)

Diff for: pandas/core/internals.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666
import pandas.core.computation.expressions as expressions
6767
from pandas.util._decorators import cache_readonly
6868
from pandas.util._validators import validate_bool_kwarg
69-
70-
from pandas import compat, _np_version_under1p9
69+
from pandas import compat
7170
from pandas.compat import range, map, zip, u
7271

7372

@@ -1327,15 +1326,7 @@ def quantile(self, qs, interpolation='linear', axis=0, mgr=None):
13271326
tuple of (axis, block)
13281327
13291328
"""
1330-
if _np_version_under1p9:
1331-
if interpolation != 'linear':
1332-
raise ValueError("Interpolation methods other than linear "
1333-
"are not supported in numpy < 1.9.")
1334-
1335-
kw = {}
1336-
if not _np_version_under1p9:
1337-
kw.update({'interpolation': interpolation})
1338-
1329+
kw = {'interpolation': interpolation}
13391330
values = self.get_values()
13401331
values, _, _, _ = self._try_coerce_args(values, values)
13411332

Diff for: pandas/tests/frame/test_quantile.py

-42
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from pandas.util.testing import assert_series_equal, assert_frame_equal
1313

1414
import pandas.util.testing as tm
15-
from pandas import _np_version_under1p9
1615

1716
from pandas.tests.frame.common import TestData
1817

@@ -103,9 +102,6 @@ def test_quantile_axis_parameter(self):
103102

104103
def test_quantile_interpolation(self):
105104
# see gh-10174
106-
if _np_version_under1p9:
107-
pytest.skip("Numpy version under 1.9")
108-
109105
from numpy import percentile
110106

111107
# interpolation = linear (default case)
@@ -166,44 +162,6 @@ def test_quantile_interpolation(self):
166162
index=[.25, .5], columns=['a', 'b', 'c'])
167163
assert_frame_equal(result, expected)
168164

169-
def test_quantile_interpolation_np_lt_1p9(self):
170-
# see gh-10174
171-
if not _np_version_under1p9:
172-
pytest.skip("Numpy version is greater than 1.9")
173-
174-
from numpy import percentile
175-
176-
# interpolation = linear (default case)
177-
q = self.tsframe.quantile(0.1, axis=0, interpolation='linear')
178-
assert q['A'] == percentile(self.tsframe['A'], 10)
179-
q = self.intframe.quantile(0.1)
180-
assert q['A'] == percentile(self.intframe['A'], 10)
181-
182-
# test with and without interpolation keyword
183-
q1 = self.intframe.quantile(0.1)
184-
assert q1['A'] == np.percentile(self.intframe['A'], 10)
185-
assert_series_equal(q, q1)
186-
187-
# interpolation method other than default linear
188-
msg = "Interpolation methods other than linear"
189-
df = DataFrame({"A": [1, 2, 3], "B": [2, 3, 4]}, index=[1, 2, 3])
190-
with tm.assert_raises_regex(ValueError, msg):
191-
df.quantile(.5, axis=1, interpolation='nearest')
192-
193-
with tm.assert_raises_regex(ValueError, msg):
194-
df.quantile([.5, .75], axis=1, interpolation='lower')
195-
196-
# test degenerate case
197-
df = DataFrame({'x': [], 'y': []})
198-
with tm.assert_raises_regex(ValueError, msg):
199-
q = df.quantile(0.1, axis=0, interpolation='higher')
200-
201-
# multi
202-
df = DataFrame([[1, 1, 1], [2, 2, 2], [3, 3, 3]],
203-
columns=['a', 'b', 'c'])
204-
with tm.assert_raises_regex(ValueError, msg):
205-
df.quantile([.25, .5], interpolation='midpoint')
206-
207165
def test_quantile_multi(self):
208166
df = DataFrame([[1, 1, 1], [2, 2, 2], [3, 3, 3]],
209167
columns=['a', 'b', 'c'])

Diff for: pandas/tests/indexes/datetimes/test_datetime.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas.compat import lrange
1010
from pandas.compat.numpy import np_datetime64_compat
1111
from pandas import (DatetimeIndex, Index, date_range, Series, DataFrame,
12-
Timestamp, datetime, offsets, _np_version_under1p8)
12+
Timestamp, datetime, offsets)
1313

1414
from pandas.util.testing import assert_series_equal, assert_almost_equal
1515

@@ -276,11 +276,7 @@ def test_comparisons_nat(self):
276276
np_datetime64_compat('2014-06-01 00:00Z'),
277277
np_datetime64_compat('2014-07-01 00:00Z')])
278278

279-
if _np_version_under1p8:
280-
# cannot test array because np.datetime('nat') returns today's date
281-
cases = [(fidx1, fidx2), (didx1, didx2)]
282-
else:
283-
cases = [(fidx1, fidx2), (didx1, didx2), (didx1, darr)]
279+
cases = [(fidx1, fidx2), (didx1, didx2), (didx1, darr)]
284280

285281
# Check pd.NaT is handles as the same as np.nan
286282
with tm.assert_produces_warning(None):

Diff for: pandas/tests/indexes/period/test_indexing.py

+13-21
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pandas.compat import lrange
99
from pandas._libs import tslib
1010
from pandas import (PeriodIndex, Series, DatetimeIndex,
11-
period_range, Period, _np_version_under1p9)
11+
period_range, Period)
1212

1313

1414
class TestGetItem(object):
@@ -149,16 +149,12 @@ def test_getitem_seconds(self):
149149
values = ['2014', '2013/02', '2013/01/02', '2013/02/01 9H',
150150
'2013/02/01 09:00']
151151
for v in values:
152-
if _np_version_under1p9:
153-
with pytest.raises(ValueError):
154-
idx[v]
155-
else:
156-
# GH7116
157-
# these show deprecations as we are trying
158-
# to slice with non-integer indexers
159-
# with pytest.raises(IndexError):
160-
# idx[v]
161-
continue
152+
# GH7116
153+
# these show deprecations as we are trying
154+
# to slice with non-integer indexers
155+
# with pytest.raises(IndexError):
156+
# idx[v]
157+
continue
162158

163159
s = Series(np.random.rand(len(idx)), index=idx)
164160
tm.assert_series_equal(s['2013/01/01 10:00'], s[3600:3660])
@@ -178,16 +174,12 @@ def test_getitem_day(self):
178174
'2013/02/01 09:00']
179175
for v in values:
180176

181-
if _np_version_under1p9:
182-
with pytest.raises(ValueError):
183-
idx[v]
184-
else:
185-
# GH7116
186-
# these show deprecations as we are trying
187-
# to slice with non-integer indexers
188-
# with pytest.raises(IndexError):
189-
# idx[v]
190-
continue
177+
# GH7116
178+
# these show deprecations as we are trying
179+
# to slice with non-integer indexers
180+
# with pytest.raises(IndexError):
181+
# idx[v]
182+
continue
191183

192184
s = Series(np.random.rand(len(idx)), index=idx)
193185
tm.assert_series_equal(s['2013/01'], s[0:31])

Diff for: pandas/tests/indexes/timedeltas/test_timedelta.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pandas.util.testing as tm
88
from pandas import (timedelta_range, date_range, Series, Timedelta,
99
DatetimeIndex, TimedeltaIndex, Index, DataFrame,
10-
Int64Index, _np_version_under1p8)
10+
Int64Index)
1111
from pandas.util.testing import (assert_almost_equal, assert_series_equal,
1212
assert_index_equal)
1313

@@ -379,11 +379,7 @@ def test_comparisons_nat(self):
379379
np.timedelta64(1, 'D') + np.timedelta64(2, 's'),
380380
np.timedelta64(5, 'D') + np.timedelta64(3, 's')])
381381

382-
if _np_version_under1p8:
383-
# cannot test array because np.datetime('nat') returns today's date
384-
cases = [(tdidx1, tdidx2)]
385-
else:
386-
cases = [(tdidx1, tdidx2), (tdidx1, tdarr)]
382+
cases = [(tdidx1, tdidx2), (tdidx1, tdarr)]
387383

388384
# Check pd.NaT is handles as the same as np.nan
389385
for idx1, idx2 in cases:

Diff for: pandas/tests/series/test_operators.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
import pandas as pd
1515

1616
from pandas import (Index, Series, DataFrame, isnull, bdate_range,
17-
NaT, date_range, timedelta_range,
18-
_np_version_under1p8)
17+
NaT, date_range, timedelta_range)
1918
from pandas.core.indexes.datetimes import Timestamp
2019
from pandas.core.indexes.timedeltas import Timedelta
2120
import pandas.core.nanops as nanops
@@ -687,14 +686,13 @@ def run_ops(ops, get_ser, test_ser):
687686
assert_series_equal(result, exp)
688687

689688
# odd numpy behavior with scalar timedeltas
690-
if not _np_version_under1p8:
691-
result = td1[0] + dt1
692-
exp = (dt1.dt.tz_localize(None) + td1[0]).dt.tz_localize(tz)
693-
assert_series_equal(result, exp)
689+
result = td1[0] + dt1
690+
exp = (dt1.dt.tz_localize(None) + td1[0]).dt.tz_localize(tz)
691+
assert_series_equal(result, exp)
694692

695-
result = td2[0] + dt2
696-
exp = (dt2.dt.tz_localize(None) + td2[0]).dt.tz_localize(tz)
697-
assert_series_equal(result, exp)
693+
result = td2[0] + dt2
694+
exp = (dt2.dt.tz_localize(None) + td2[0]).dt.tz_localize(tz)
695+
assert_series_equal(result, exp)
698696

699697
result = dt1 - td1[0]
700698
exp = (dt1.dt.tz_localize(None) - td1[0]).dt.tz_localize(tz)

0 commit comments

Comments
 (0)