Skip to content

Commit 22dab2d

Browse files
committed
DEPS: drop numpy < 1.12
1 parent ca7d518 commit 22dab2d

File tree

20 files changed

+86
-133
lines changed

20 files changed

+86
-133
lines changed

ci/azure-macos-35.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
- matplotlib
1212
- nomkl
1313
- numexpr
14-
- numpy=1.10.4
14+
- numpy=1.12.1
1515
- openpyxl=2.5.5
1616
- pytables
1717
- python=3.5*

ci/circle-27-compat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- cython=0.28.2
88
- jinja2=2.8
99
- numexpr=2.4.4 # we test that we correctly don't use an unsupported numexpr
10-
- numpy=1.9.3
10+
- numpy=1.12.1
1111
- openpyxl=2.5.5
1212
- psycopg2
1313
- pytables=3.2.2

ci/travis-27-locale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- cython=0.28.2
88
- lxml
99
- matplotlib=1.4.3
10-
- numpy=1.9.3
10+
- numpy=1.12.1
1111
- openpyxl=2.4.0
1212
- python-dateutil
1313
- python-blosc

doc/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Dependencies
225225
------------
226226

227227
* `setuptools <https://setuptools.readthedocs.io/en/latest/>`__: 24.2.0 or higher
228-
* `NumPy <http://www.numpy.org>`__: 1.9.0 or higher
228+
* `NumPy <http://www.numpy.org>`__: 1.12.0 or higher
229229
* `python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__: 2.5.0 or higher
230230
* `pytz <http://pytz.sourceforge.net/>`__
231231

doc/source/whatsnew/v0.24.0.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,22 @@ Other Enhancements
199199

200200
Backwards incompatible API changes
201201
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202+
202203
- A newly constructed empty :class:`DataFrame` with integer as the ``dtype`` will now only be cast to ``float64`` if ``index`` is specified (:issue:`22858`)
203204

205+
.. _whatsnew_0240.api_breaking.deps:
206+
207+
Dependencies have increased minimum versions
208+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209+
210+
We have updated our minimum supported versions of dependencies (:issue:`21242`).
211+
We now require:
212+
213+
+-----------------+-----------------+----------+---------------+
214+
| Package | Minimum Version | Required | Issue |
215+
+=================+=================+==========+===============+
216+
| numpy | 1.12.0 | X | :issue:`21242`|
217+
+-----------------+-----------------+----------+---------------+
204218

205219
.. _whatsnew_0240.api_breaking.interval_values:
206220

pandas/compat/numpy/__init__.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,16 @@
99
# numpy versioning
1010
_np_version = np.__version__
1111
_nlv = LooseVersion(_np_version)
12-
_np_version_under1p10 = _nlv < LooseVersion('1.10')
13-
_np_version_under1p11 = _nlv < LooseVersion('1.11')
14-
_np_version_under1p12 = _nlv < LooseVersion('1.12')
1512
_np_version_under1p13 = _nlv < LooseVersion('1.13')
1613
_np_version_under1p14 = _nlv < LooseVersion('1.14')
1714
_np_version_under1p15 = _nlv < LooseVersion('1.15')
1815

1916

20-
if _nlv < '1.9':
17+
if _nlv < '1.12':
2118
raise ImportError('this version of pandas is incompatible with '
22-
'numpy < 1.9.0\n'
19+
'numpy < 1.12.0\n'
2320
'your numpy version is {0}.\n'
24-
'Please upgrade numpy to >= 1.9.0 to use '
21+
'Please upgrade numpy to >= 1.12.0 to use '
2522
'this pandas version'.format(_np_version))
2623

2724

@@ -43,9 +40,7 @@ def np_datetime64_compat(s, *args, **kwargs):
4340
tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation
4441
warning, when need to pass '2015-01-01 09:00:00'
4542
"""
46-
47-
if not _np_version_under1p11:
48-
s = tz_replacer(s)
43+
s = tz_replacer(s)
4944
return np.datetime64(s, *args, **kwargs)
5045

5146

@@ -56,23 +51,17 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
5651
tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation
5752
warning, when need to pass '2015-01-01 09:00:00'
5853
"""
59-
60-
if not _np_version_under1p11:
61-
62-
# is_list_like
63-
if hasattr(arr, '__iter__') and not \
64-
isinstance(arr, string_and_binary_types):
65-
arr = [tz_replacer(s) for s in arr]
66-
else:
67-
arr = tz_replacer(arr)
54+
# is_list_like
55+
if hasattr(arr, '__iter__') and not \
56+
isinstance(arr, string_and_binary_types):
57+
arr = [tz_replacer(s) for s in arr]
58+
else:
59+
arr = tz_replacer(arr)
6860

6961
return np.array(arr, *args, **kwargs)
7062

7163

7264
__all__ = ['np',
73-
'_np_version_under1p10',
74-
'_np_version_under1p11',
75-
'_np_version_under1p12',
7665
'_np_version_under1p13',
7766
'_np_version_under1p14',
7867
'_np_version_under1p15'

pandas/core/algorithms.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
ensure_platform_int, ensure_object,
3131
ensure_float64, ensure_uint64,
3232
ensure_int64)
33-
from pandas.compat.numpy import _np_version_under1p10
3433
from pandas.core.dtypes.missing import isna, na_value_for_dtype
3534

3635
from pandas.core import common as com
@@ -914,15 +913,7 @@ def _broadcast(arr_or_scalar, shape):
914913
"""
915914
Helper function to broadcast arrays / scalars to the desired shape.
916915
"""
917-
if _np_version_under1p10:
918-
if is_scalar(arr_or_scalar):
919-
out = np.empty(shape)
920-
out.fill(arr_or_scalar)
921-
else:
922-
out = arr_or_scalar
923-
else:
924-
out = np.broadcast_to(arr_or_scalar, shape)
925-
return out
916+
return np.broadcast_to(arr_or_scalar, shape)
926917

927918
# For performance reasons, we broadcast 'b' to the new array 'b2'
928919
# so that it has the same size as 'arr'.

pandas/tests/arithmetic/test_period.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
import pandas.core.indexes.period as period
1717
from pandas.core import ops
18-
from pandas import (
19-
Period, PeriodIndex, period_range, Series,
20-
_np_version_under1p10)
18+
from pandas import Period, PeriodIndex, period_range, Series
2119

2220

2321
# ------------------------------------------------------------------
@@ -837,20 +835,14 @@ def test_pi_ops_errors(self, ng):
837835
with pytest.raises(TypeError):
838836
np.add(obj, ng)
839837

840-
if _np_version_under1p10:
841-
assert np.add(ng, obj) is NotImplemented
842-
else:
843-
with pytest.raises(TypeError):
844-
np.add(ng, obj)
838+
with pytest.raises(TypeError):
839+
np.add(ng, obj)
845840

846841
with pytest.raises(TypeError):
847842
np.subtract(obj, ng)
848843

849-
if _np_version_under1p10:
850-
assert np.subtract(ng, obj) is NotImplemented
851-
else:
852-
with pytest.raises(TypeError):
853-
np.subtract(ng, obj)
844+
with pytest.raises(TypeError):
845+
np.subtract(ng, obj)
854846

855847
def test_pi_ops_nat(self):
856848
idx = PeriodIndex(['2011-01', '2011-02', 'NaT', '2011-04'],
@@ -954,10 +946,7 @@ def test_pi_sub_period(self):
954946
tm.assert_index_equal(result, exp)
955947

956948
result = np.subtract(pd.Period('2012-01', freq='M'), idx)
957-
if _np_version_under1p10:
958-
assert result is NotImplemented
959-
else:
960-
tm.assert_index_equal(result, exp)
949+
tm.assert_index_equal(result, exp)
961950

962951
exp = pd.TimedeltaIndex([np.nan, np.nan, np.nan, np.nan], name='idx')
963952
tm.assert_index_equal(idx - pd.Period('NaT', freq='M'), exp)

pandas/tests/frame/test_analytics.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from pandas.compat import lrange, PY35
1616
from pandas import (compat, isna, notna, DataFrame, Series,
1717
MultiIndex, date_range, Timestamp, Categorical,
18-
_np_version_under1p12,
1918
to_datetime, to_timedelta)
2019
import pandas as pd
2120
import pandas.core.nanops as nanops
@@ -2021,9 +2020,6 @@ def test_dot(self):
20212020

20222021
@pytest.mark.skipif(not PY35,
20232022
reason='matmul supported for Python>=3.5')
2024-
@pytest.mark.xfail(
2025-
_np_version_under1p12,
2026-
reason="unpredictable return types under numpy < 1.12")
20272023
def test_matmul(self):
20282024
# matmul test is for GH 10259
20292025
a = DataFrame(np.random.randn(3, 4), index=['a', 'b', 'c'],

pandas/tests/frame/test_quantile.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
import numpy as np
88

9-
from pandas import (DataFrame, Series, Timestamp, _np_version_under1p11)
9+
from pandas import DataFrame, Series, Timestamp
1010
import pandas as pd
1111

1212
from pandas.util.testing import assert_series_equal, assert_frame_equal
@@ -154,12 +154,8 @@ def test_quantile_interpolation(self):
154154
result = df.quantile([.25, .5], interpolation='midpoint')
155155

156156
# https://github.com/numpy/numpy/issues/7163
157-
if _np_version_under1p11:
158-
expected = DataFrame([[1.5, 1.5, 1.5], [2.5, 2.5, 2.5]],
159-
index=[.25, .5], columns=['a', 'b', 'c'])
160-
else:
161-
expected = DataFrame([[1.5, 1.5, 1.5], [2.0, 2.0, 2.0]],
162-
index=[.25, .5], columns=['a', 'b', 'c'])
157+
expected = DataFrame([[1.5, 1.5, 1.5], [2.0, 2.0, 2.0]],
158+
index=[.25, .5], columns=['a', 'b', 'c'])
163159
assert_frame_equal(result, expected)
164160

165161
def test_quantile_multi(self):

pandas/tests/indexes/datetimes/test_ops.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import pandas._libs.tslib as tslib
88
import pandas.util.testing as tm
99
from pandas import (DatetimeIndex, PeriodIndex, Series, Timestamp,
10-
date_range, _np_version_under1p10, Index,
11-
bdate_range)
10+
date_range, bdate_range, Index)
1211
from pandas.tseries.offsets import BMonthEnd, CDay, BDay, Day, Hour
1312
from pandas.tests.test_base import Ops
1413
from pandas.core.dtypes.generic import ABCDateOffset
@@ -89,12 +88,11 @@ def test_numpy_minmax(self):
8988
assert np.argmin(dr) == 0
9089
assert np.argmax(dr) == 5
9190

92-
if not _np_version_under1p10:
93-
errmsg = "the 'out' parameter is not supported"
94-
tm.assert_raises_regex(
95-
ValueError, errmsg, np.argmin, dr, out=0)
96-
tm.assert_raises_regex(
97-
ValueError, errmsg, np.argmax, dr, out=0)
91+
errmsg = "the 'out' parameter is not supported"
92+
tm.assert_raises_regex(
93+
ValueError, errmsg, np.argmin, dr, out=0)
94+
tm.assert_raises_regex(
95+
ValueError, errmsg, np.argmax, dr, out=0)
9896

9997
def test_repeat_range(self, tz_naive_fixture):
10098
tz = tz_naive_fixture

pandas/tests/indexes/period/test_ops.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import pandas as pd
66
import pandas._libs.tslib as tslib
77
import pandas.util.testing as tm
8-
from pandas import (DatetimeIndex, PeriodIndex, Series, Period,
9-
_np_version_under1p10, Index)
8+
from pandas import DatetimeIndex, PeriodIndex, Series, Period, Index
109

1110
from pandas.tests.test_base import Ops
1211

@@ -73,12 +72,11 @@ def test_numpy_minmax(self):
7372
assert np.argmin(pr) == 0
7473
assert np.argmax(pr) == 5
7574

76-
if not _np_version_under1p10:
77-
errmsg = "the 'out' parameter is not supported"
78-
tm.assert_raises_regex(
79-
ValueError, errmsg, np.argmin, pr, out=0)
80-
tm.assert_raises_regex(
81-
ValueError, errmsg, np.argmax, pr, out=0)
75+
errmsg = "the 'out' parameter is not supported"
76+
tm.assert_raises_regex(
77+
ValueError, errmsg, np.argmin, pr, out=0)
78+
tm.assert_raises_regex(
79+
ValueError, errmsg, np.argmax, pr, out=0)
8280

8381
def test_resolution(self):
8482
for freq, expected in zip(['A', 'Q', 'M', 'D', 'H',

pandas/tests/indexes/period/test_partial_slicing.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas as pd
66
from pandas.util import testing as tm
77
from pandas import (Series, period_range, DatetimeIndex, PeriodIndex,
8-
DataFrame, _np_version_under1p12, Period)
8+
DataFrame, Period)
99

1010

1111
class TestPeriodIndex(object):
@@ -68,16 +68,15 @@ def test_range_slice_day(self):
6868
didx = DatetimeIndex(start='2013/01/01', freq='D', periods=400)
6969
pidx = PeriodIndex(start='2013/01/01', freq='D', periods=400)
7070

71-
# changed to TypeError in 1.12
71+
# exception changed to TypeError in 1.12
7272
# https://github.com/numpy/numpy/pull/6271
73-
exc = IndexError if _np_version_under1p12 else TypeError
7473

7574
for idx in [didx, pidx]:
7675
# slices against index should raise IndexError
7776
values = ['2014', '2013/02', '2013/01/02', '2013/02/01 9H',
7877
'2013/02/01 09:00']
7978
for v in values:
80-
with pytest.raises(exc):
79+
with pytest.raises(TypeError):
8180
idx[v:]
8281

8382
s = Series(np.random.rand(len(idx)), index=idx)
@@ -89,7 +88,7 @@ def test_range_slice_day(self):
8988

9089
invalid = ['2013/02/01 9H', '2013/02/01 09:00']
9190
for v in invalid:
92-
with pytest.raises(exc):
91+
with pytest.raises(TypeError):
9392
idx[v:]
9493

9594
def test_range_slice_seconds(self):
@@ -98,16 +97,15 @@ def test_range_slice_seconds(self):
9897
periods=4000)
9998
pidx = PeriodIndex(start='2013/01/01 09:00:00', freq='S', periods=4000)
10099

101-
# changed to TypeError in 1.12
100+
# exception changed to TypeError in 1.12
102101
# https://github.com/numpy/numpy/pull/6271
103-
exc = IndexError if _np_version_under1p12 else TypeError
104102

105103
for idx in [didx, pidx]:
106104
# slices against index should raise IndexError
107105
values = ['2014', '2013/02', '2013/01/02', '2013/02/01 9H',
108106
'2013/02/01 09:00']
109107
for v in values:
110-
with pytest.raises(exc):
108+
with pytest.raises(TypeError):
111109
idx[v:]
112110

113111
s = Series(np.random.rand(len(idx)), index=idx)

pandas/tests/indexes/timedeltas/test_ops.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
import pandas as pd
77
import pandas.util.testing as tm
8-
from pandas import to_timedelta
98
from pandas import (Series, Timedelta, Timestamp, TimedeltaIndex,
10-
timedelta_range,
11-
_np_version_under1p10)
9+
timedelta_range, to_timedelta)
1210
from pandas._libs.tslib import iNaT
1311
from pandas.tests.test_base import Ops
1412
from pandas.tseries.offsets import Day, Hour
@@ -68,12 +66,11 @@ def test_numpy_minmax(self):
6866
assert np.argmin(td) == 0
6967
assert np.argmax(td) == 5
7068

71-
if not _np_version_under1p10:
72-
errmsg = "the 'out' parameter is not supported"
73-
tm.assert_raises_regex(
74-
ValueError, errmsg, np.argmin, td, out=0)
75-
tm.assert_raises_regex(
76-
ValueError, errmsg, np.argmax, td, out=0)
69+
errmsg = "the 'out' parameter is not supported"
70+
tm.assert_raises_regex(
71+
ValueError, errmsg, np.argmin, td, out=0)
72+
tm.assert_raises_regex(
73+
ValueError, errmsg, np.argmax, td, out=0)
7774

7875
def test_value_counts_unique(self):
7976
# GH 7735

0 commit comments

Comments
 (0)