Skip to content

DEPS: drop numpy < 1.12 #23062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
22dab2d
DEPS: drop numpy < 1.12
h-vetinari Oct 9, 2018
a495db9
Drop bottleneck < 1.2.0
h-vetinari Oct 9, 2018
124d511
Drop matplotlib < 2.0.0
h-vetinari Oct 9, 2018
12b9a79
Drop numexpr < 2.6.2
h-vetinari Oct 9, 2018
c8bfe66
Remove mpl compat code
h-vetinari Oct 9, 2018
b2cffb4
Remove redundant functions
h-vetinari Oct 9, 2018
e9c407e
Reinstante _unpack_cycler
h-vetinari Oct 10, 2018
aac634d
Drop pytables < 3.4.2
h-vetinari Oct 10, 2018
f18880d
Bump numpy requirement in install.py
h-vetinari Oct 10, 2018
f81ad9f
Add output for debugging tests/plotting/test_datetimelike
h-vetinari Oct 10, 2018
c29b478
Drop scipy < 0.18.1
h-vetinari Oct 10, 2018
7ecc5f2
Fix debugging output
h-vetinari Oct 10, 2018
6e533e7
Reduce min version for numexpr/pytables after conda investigation
h-vetinari Oct 10, 2018
2ab7f55
Review (jreback & jbrockmendel)
h-vetinari Oct 10, 2018
7ca1753
Next iteration debugging tests/plotting/test_datetimelike
h-vetinari Oct 10, 2018
9b85061
Spread matplotlib-version in CI for debugging
h-vetinari Oct 10, 2018
5b54612
Re-drop pytables < 3.4.2
h-vetinari Oct 10, 2018
708b2f6
Remove non-existent version
h-vetinari Oct 10, 2018
a41ed9f
Debugggggg
h-vetinari Oct 10, 2018
1e0c553
Fix typos
h-vetinari Oct 10, 2018
317e042
More mpl compat
h-vetinari Oct 10, 2018
31dc4fa
Revert xfails for missing MaskedArrays
h-vetinari Oct 10, 2018
ec93bdb
Clean up diff/switches in test_datetimelike
h-vetinari Oct 11, 2018
d20077a
Fix wording
h-vetinari Oct 11, 2018
925b555
Review (jreback)
h-vetinari Oct 11, 2018
b971bfb
Last round of mpl debugging
h-vetinari Oct 11, 2018
93eabad
Tiny fix
h-vetinari Oct 11, 2018
d72b547
Revert debugging helpers
h-vetinari Oct 11, 2018
e075eff
Partially revert mpl-pins used for debugging
h-vetinari Oct 11, 2018
305f12b
Merge remote-tracking branch 'upstream/master' into bump_numpy
h-vetinari Oct 11, 2018
752b5d7
Rename azure containers
h-vetinari Oct 11, 2018
9dc846a
Bump numexpr check
h-vetinari Oct 12, 2018
e7f5bf2
Merge remote-tracking branch 'upstream/master' into bump_numpy
h-vetinari Oct 12, 2018
169974b
Try retrigger CircleCI
h-vetinari Oct 12, 2018
5b45639
Better error log for failing tests
h-vetinari Oct 12, 2018
308e943
Debugging azure macos build
h-vetinari Oct 12, 2018
9be3d10
Revert "Partially revert mpl-pins used for debugging"
h-vetinari Oct 12, 2018
61763f6
Final debug???
h-vetinari Oct 12, 2018
ededd73
shift debugging pin away from doc build
h-vetinari Oct 12, 2018
079bdaf
MPLMPLMPLMPLMPLMPLMPLMPLMPLMPLMPL
h-vetinari Oct 12, 2018
162458b
Revert "shift debugging pin away from doc build"
h-vetinari Oct 12, 2018
cdd497d
Revert "Revert "Partially revert mpl-pins used for debugging""
h-vetinari Oct 12, 2018
d8587a8
Merge branch 'master' into bump_numpy
h-vetinari Oct 14, 2018
8e37179
Retrigger CI
h-vetinari Oct 14, 2018
d097b43
Merge remote-tracking branch 'upstream/master' into bump_numpy
h-vetinari Oct 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/azure-macos-35.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- matplotlib
- nomkl
- numexpr
- numpy=1.10.4
- numpy=1.12.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the code / docs point to 1.12.0 but this is 1.12.1 - any reason for the minor version bump here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, that was an oversight...

- openpyxl=2.5.5
- pytables
- python=3.5*
Expand Down
2 changes: 1 addition & 1 deletion ci/circle-27-compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- cython=0.28.2
- jinja2=2.8
- numexpr=2.4.4 # we test that we correctly don't use an unsupported numexpr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you remove code related this this?

Copy link
Contributor Author

@h-vetinari h-vetinari Oct 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where code related to this would be hiding? There was nothing in compat.__init__.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(bamboo-dev) jreback@dev:~/pandas-dev$ more pandas/core/computation/check.py 
import warnings
from distutils.version import LooseVersion

_NUMEXPR_INSTALLED = False
_MIN_NUMEXPR_VERSION = "2.4.6"

try:
    import numexpr as ne
    ver = LooseVersion(ne.__version__)
    _NUMEXPR_INSTALLED = ver >= LooseVersion(_MIN_NUMEXPR_VERSION)

    if not _NUMEXPR_INSTALLED:
        warnings.warn(
            "The installed version of numexpr {ver} is not supported "
            "in pandas and will be not be used\nThe minimum supported "
            "version is {min_ver}\n".format(
                ver=ver, min_ver=_MIN_NUMEXPR_VERSION), UserWarning)

except ImportError:  # pragma: no cover
    pass

__all__ = ['_NUMEXPR_INSTALLED']

- numpy=1.9.3
- numpy=1.12.1
- openpyxl=2.5.5
- psycopg2
- pytables=3.2.2
Expand Down
2 changes: 1 addition & 1 deletion ci/travis-27-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- cython=0.28.2
- lxml
- matplotlib=1.4.3
- numpy=1.9.3
- numpy=1.12.1
- openpyxl=2.4.0
- python-dateutil
- python-blosc
Expand Down
2 changes: 1 addition & 1 deletion doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Dependencies
------------

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

Expand Down
14 changes: 14 additions & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,22 @@ Other Enhancements

Backwards incompatible API changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- A newly constructed empty :class:`DataFrame` with integer as the ``dtype`` will now only be cast to ``float64`` if ``index`` is specified (:issue:`22858`)

.. _whatsnew_0240.api_breaking.deps:

Dependencies have increased minimum versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We have updated our minimum supported versions of dependencies (:issue:`21242`).
We now require:

+-----------------+-----------------+----------+---------------+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the issue part here it is not necessary

| Package | Minimum Version | Required | Issue |
+=================+=================+==========+===============+
| numpy | 1.12.0 | X | :issue:`21242`|
+-----------------+-----------------+----------+---------------+

.. _whatsnew_0240.api_breaking.interval_values:

Expand Down
31 changes: 10 additions & 21 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@
# numpy versioning
_np_version = np.__version__
_nlv = LooseVersion(_np_version)
_np_version_under1p10 = _nlv < LooseVersion('1.10')
_np_version_under1p11 = _nlv < LooseVersion('1.11')
_np_version_under1p12 = _nlv < LooseVersion('1.12')
_np_version_under1p13 = _nlv < LooseVersion('1.13')
_np_version_under1p14 = _nlv < LooseVersion('1.14')
_np_version_under1p15 = _nlv < LooseVersion('1.15')


if _nlv < '1.9':
if _nlv < '1.12':
raise ImportError('this version of pandas is incompatible with '
'numpy < 1.9.0\n'
'numpy < 1.12.0\n'
'your numpy version is {0}.\n'
'Please upgrade numpy to >= 1.9.0 to use '
'Please upgrade numpy to >= 1.12.0 to use '
'this pandas version'.format(_np_version))


Expand All @@ -43,9 +40,7 @@ def np_datetime64_compat(s, *args, **kwargs):
tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation
warning, when need to pass '2015-01-01 09:00:00'
"""

if not _np_version_under1p11:
s = tz_replacer(s)
s = tz_replacer(s)
return np.datetime64(s, *args, **kwargs)


Expand All @@ -56,23 +51,17 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
tz-changes in 1.11 that make '2015-01-01 09:00:00Z' show a deprecation
warning, when need to pass '2015-01-01 09:00:00'
"""

if not _np_version_under1p11:

# is_list_like
if hasattr(arr, '__iter__') and not \
isinstance(arr, string_and_binary_types):
arr = [tz_replacer(s) for s in arr]
else:
arr = tz_replacer(arr)
# is_list_like
if hasattr(arr, '__iter__') and not \
isinstance(arr, string_and_binary_types):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this without the backslash?

arr = [tz_replacer(s) for s in arr]
else:
arr = tz_replacer(arr)

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


__all__ = ['np',
'_np_version_under1p10',
'_np_version_under1p11',
'_np_version_under1p12',
'_np_version_under1p13',
'_np_version_under1p14',
'_np_version_under1p15'
Expand Down
11 changes: 1 addition & 10 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
ensure_platform_int, ensure_object,
ensure_float64, ensure_uint64,
ensure_int64)
from pandas.compat.numpy import _np_version_under1p10
from pandas.core.dtypes.missing import isna, na_value_for_dtype

from pandas.core import common as com
Expand Down Expand Up @@ -914,15 +913,7 @@ def _broadcast(arr_or_scalar, shape):
"""
Helper function to broadcast arrays / scalars to the desired shape.
"""
if _np_version_under1p10:
if is_scalar(arr_or_scalar):
out = np.empty(shape)
out.fill(arr_or_scalar)
else:
out = arr_or_scalar
else:
out = np.broadcast_to(arr_or_scalar, shape)
return out
return np.broadcast_to(arr_or_scalar, shape)

# For performance reasons, we broadcast 'b' to the new array 'b2'
# so that it has the same size as 'arr'.
Expand Down
23 changes: 6 additions & 17 deletions pandas/tests/arithmetic/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import pandas.core.indexes.period as period
from pandas.core import ops
from pandas import (
Period, PeriodIndex, period_range, Series,
_np_version_under1p10)
from pandas import Period, PeriodIndex, period_range, Series


# ------------------------------------------------------------------
Expand Down Expand Up @@ -837,20 +835,14 @@ def test_pi_ops_errors(self, ng):
with pytest.raises(TypeError):
np.add(obj, ng)

if _np_version_under1p10:
assert np.add(ng, obj) is NotImplemented
else:
with pytest.raises(TypeError):
np.add(ng, obj)
with pytest.raises(TypeError):
np.add(ng, obj)

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

if _np_version_under1p10:
assert np.subtract(ng, obj) is NotImplemented
else:
with pytest.raises(TypeError):
np.subtract(ng, obj)
with pytest.raises(TypeError):
np.subtract(ng, obj)

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

result = np.subtract(pd.Period('2012-01', freq='M'), idx)
if _np_version_under1p10:
assert result is NotImplemented
else:
tm.assert_index_equal(result, exp)
tm.assert_index_equal(result, exp)

exp = pd.TimedeltaIndex([np.nan, np.nan, np.nan, np.nan], name='idx')
tm.assert_index_equal(idx - pd.Period('NaT', freq='M'), exp)
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from pandas.compat import lrange, PY35
from pandas import (compat, isna, notna, DataFrame, Series,
MultiIndex, date_range, Timestamp, Categorical,
_np_version_under1p12,
to_datetime, to_timedelta)
import pandas as pd
import pandas.core.nanops as nanops
Expand Down Expand Up @@ -2021,9 +2020,6 @@ def test_dot(self):

@pytest.mark.skipif(not PY35,
reason='matmul supported for Python>=3.5')
@pytest.mark.xfail(
_np_version_under1p12,
reason="unpredictable return types under numpy < 1.12")
def test_matmul(self):
# matmul test is for GH 10259
a = DataFrame(np.random.randn(3, 4), index=['a', 'b', 'c'],
Expand Down
10 changes: 3 additions & 7 deletions pandas/tests/frame/test_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import numpy as np

from pandas import (DataFrame, Series, Timestamp, _np_version_under1p11)
from pandas import DataFrame, Series, Timestamp
import pandas as pd

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

# https://github.com/numpy/numpy/issues/7163
if _np_version_under1p11:
expected = DataFrame([[1.5, 1.5, 1.5], [2.5, 2.5, 2.5]],
index=[.25, .5], columns=['a', 'b', 'c'])
else:
expected = DataFrame([[1.5, 1.5, 1.5], [2.0, 2.0, 2.0]],
index=[.25, .5], columns=['a', 'b', 'c'])
expected = DataFrame([[1.5, 1.5, 1.5], [2.0, 2.0, 2.0]],
index=[.25, .5], columns=['a', 'b', 'c'])
assert_frame_equal(result, expected)

def test_quantile_multi(self):
Expand Down
14 changes: 6 additions & 8 deletions pandas/tests/indexes/datetimes/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import pandas._libs.tslib as tslib
import pandas.util.testing as tm
from pandas import (DatetimeIndex, PeriodIndex, Series, Timestamp,
date_range, _np_version_under1p10, Index,
bdate_range)
date_range, bdate_range, Index)
from pandas.tseries.offsets import BMonthEnd, CDay, BDay, Day, Hour
from pandas.tests.test_base import Ops
from pandas.core.dtypes.generic import ABCDateOffset
Expand Down Expand Up @@ -89,12 +88,11 @@ def test_numpy_minmax(self):
assert np.argmin(dr) == 0
assert np.argmax(dr) == 5

if not _np_version_under1p10:
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, dr, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, dr, out=0)
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, dr, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, dr, out=0)

def test_repeat_range(self, tz_naive_fixture):
tz = tz_naive_fixture
Expand Down
14 changes: 6 additions & 8 deletions pandas/tests/indexes/period/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import pandas as pd
import pandas._libs.tslib as tslib
import pandas.util.testing as tm
from pandas import (DatetimeIndex, PeriodIndex, Series, Period,
_np_version_under1p10, Index)
from pandas import DatetimeIndex, PeriodIndex, Series, Period, Index

from pandas.tests.test_base import Ops

Expand Down Expand Up @@ -73,12 +72,11 @@ def test_numpy_minmax(self):
assert np.argmin(pr) == 0
assert np.argmax(pr) == 5

if not _np_version_under1p10:
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, pr, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, pr, out=0)
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, pr, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, pr, out=0)

def test_resolution(self):
for freq, expected in zip(['A', 'Q', 'M', 'D', 'H',
Expand Down
14 changes: 6 additions & 8 deletions pandas/tests/indexes/period/test_partial_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd
from pandas.util import testing as tm
from pandas import (Series, period_range, DatetimeIndex, PeriodIndex,
DataFrame, _np_version_under1p12, Period)
DataFrame, Period)


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

# changed to TypeError in 1.12
# exception changed to TypeError in 1.12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this comment and the issue refernce

# https://github.com/numpy/numpy/pull/6271
exc = IndexError if _np_version_under1p12 else TypeError

for idx in [didx, pidx]:
# slices against index should raise IndexError
values = ['2014', '2013/02', '2013/01/02', '2013/02/01 9H',
'2013/02/01 09:00']
for v in values:
with pytest.raises(exc):
with pytest.raises(TypeError):
idx[v:]

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

invalid = ['2013/02/01 9H', '2013/02/01 09:00']
for v in invalid:
with pytest.raises(exc):
with pytest.raises(TypeError):
idx[v:]

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

# changed to TypeError in 1.12
# exception changed to TypeError in 1.12
# https://github.com/numpy/numpy/pull/6271
exc = IndexError if _np_version_under1p12 else TypeError

for idx in [didx, pidx]:
# slices against index should raise IndexError
values = ['2014', '2013/02', '2013/01/02', '2013/02/01 9H',
'2013/02/01 09:00']
for v in values:
with pytest.raises(exc):
with pytest.raises(TypeError):
idx[v:]

s = Series(np.random.rand(len(idx)), index=idx)
Expand Down
15 changes: 6 additions & 9 deletions pandas/tests/indexes/timedeltas/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

import pandas as pd
import pandas.util.testing as tm
from pandas import to_timedelta
from pandas import (Series, Timedelta, Timestamp, TimedeltaIndex,
timedelta_range,
_np_version_under1p10)
timedelta_range, to_timedelta)
from pandas._libs.tslib import iNaT
from pandas.tests.test_base import Ops
from pandas.tseries.offsets import Day, Hour
Expand Down Expand Up @@ -68,12 +66,11 @@ def test_numpy_minmax(self):
assert np.argmin(td) == 0
assert np.argmax(td) == 5

if not _np_version_under1p10:
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, td, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, td, out=0)
errmsg = "the 'out' parameter is not supported"
tm.assert_raises_regex(
ValueError, errmsg, np.argmin, td, out=0)
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, td, out=0)

def test_value_counts_unique(self):
# GH 7735
Expand Down
Loading