-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
DEPS: drop numpy < 1.12 #23062
Changes from 5 commits
22dab2d
a495db9
124d511
12b9a79
c8bfe66
b2cffb4
e9c407e
aac634d
f18880d
f81ad9f
c29b478
7ecc5f2
6e533e7
2ab7f55
7ca1753
9b85061
5b54612
708b2f6
a41ed9f
1e0c553
317e042
31dc4fa
ec93bdb
d20077a
925b555
b971bfb
93eabad
d72b547
e075eff
305f12b
752b5d7
9dc846a
e7f5bf2
169974b
5b45639
308e943
9be3d10
61763f6
ededd73
079bdaf
162458b
cdd497d
d8587a8
8e37179
d097b43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,8 +199,28 @@ 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`). | ||
If installed, we now require: | ||
|
||
+-----------------+-----------------+----------+---------------+ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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`| | ||
+-----------------+-----------------+----------+---------------+ | ||
| bottleneck | 1.2.0 | | :issue:`21242`| | ||
+-----------------+-----------------+----------+---------------+ | ||
| matplotlib | 2.0.0 | | :issue:`21242`| | ||
+-----------------+-----------------+----------+---------------+ | ||
| numexpr | 2.6.2 | | :issue:`21242`| | ||
+-----------------+-----------------+----------+---------------+ | ||
|
||
.. _whatsnew_0240.api_breaking.interval_values: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) | ||
|
||
|
||
|
@@ -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) | ||
|
||
|
||
|
@@ -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): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,6 @@ | |
from pandas.tseries.frequencies import FreqGroup | ||
from pandas.core.indexes.period import Period, PeriodIndex | ||
|
||
from pandas.plotting._compat import _mpl_le_2_0_0 | ||
|
||
# constants | ||
HOURS_PER_DAY = 24. | ||
MIN_PER_HOUR = 60. | ||
|
@@ -371,13 +369,6 @@ def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d'): | |
if self._tz is dates.UTC: | ||
self._tz._utcoffset = self._tz.utcoffset(None) | ||
|
||
# For mpl > 2.0 the format strings are controlled via rcparams | ||
# so do not mess with them. For mpl < 2.0 change the second | ||
# break point and add a musec break point | ||
if _mpl_le_2_0_0(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since mpl has a min version of 2.0.0 don't we still need this check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was probably being used incorrectly. I don't think it would apply to 2.0.0 but not 2.0.1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made sure to test all available matplotlib versions, and while the removal of the code for 2.0.0 was an oversight, nothing in the test suite failed. As far as I can tell, 2.0.0 wasn't tested in the CI before, which is also the reason that several if-switches before this PR were strictly speaking wrong (when I removed the compat code in a way that just removed pre-2.0 branches, suddenly there were failures). |
||
self.scaled[1. / SEC_PER_DAY] = '%H:%M:%S' | ||
self.scaled[1. / MUSEC_PER_DAY] = '%H:%M:%S.%f' | ||
|
||
|
||
class PandasAutoDateLocator(dates.AutoDateLocator): | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,7 @@ | |
|
||
from pandas.io.formats.printing import pprint_thing | ||
|
||
from pandas.plotting._compat import (_mpl_ge_1_3_1, | ||
_mpl_ge_1_5_0, | ||
_mpl_ge_2_0_0, | ||
_mpl_ge_3_0_0) | ||
from pandas.plotting._compat import _mpl_ge_3_0_0 | ||
from pandas.plotting._style import (plot_params, | ||
_get_standard_colors) | ||
from pandas.plotting._tools import (_subplots, _flatten, table, | ||
|
@@ -551,14 +548,6 @@ def plt(self): | |
import matplotlib.pyplot as plt | ||
return plt | ||
|
||
@staticmethod | ||
def mpl_ge_1_3_1(): | ||
return _mpl_ge_1_3_1() | ||
|
||
@staticmethod | ||
def mpl_ge_1_5_0(): | ||
return _mpl_ge_1_5_0() | ||
|
||
_need_to_set_index = False | ||
|
||
def _get_xticks(self, convert_period=False): | ||
|
@@ -908,8 +897,7 @@ def _make_plot(self): | |
scatter = ax.scatter(data[x].values, data[y].values, c=c_values, | ||
label=label, cmap=cmap, **self.kwds) | ||
if cb: | ||
if self.mpl_ge_1_3_1(): | ||
cbar_label = c if c_is_column else '' | ||
cbar_label = c if c_is_column else '' | ||
self._plot_colorbar(ax, label=cbar_label) | ||
|
||
if label is not None: | ||
|
@@ -1012,10 +1000,9 @@ def _make_plot(self): | |
**kwds) | ||
self._add_legend_handle(newlines[0], label, index=i) | ||
|
||
if not _mpl_ge_2_0_0(): | ||
lines = _get_all_lines(ax) | ||
left, right = _get_xlim(lines) | ||
ax.set_xlim(left, right) | ||
lines = _get_all_lines(ax) | ||
left, right = _get_xlim(lines) | ||
ax.set_xlim(left, right) | ||
|
||
@classmethod | ||
def _plot(cls, ax, x, y, style=None, column_num=None, | ||
|
@@ -1141,8 +1128,7 @@ def _plot(cls, ax, x, y, style=None, column_num=None, | |
|
||
# need to remove label, because subplots uses mpl legend as it is | ||
line_kwds = kwds.copy() | ||
if cls.mpl_ge_1_5_0(): | ||
line_kwds.pop('label') | ||
line_kwds.pop('label') | ||
lines = MPLPlot._plot(ax, x, y_values, style=style, **line_kwds) | ||
|
||
# get data from the line to get coordinates for fill_between | ||
|
@@ -1165,17 +1151,10 @@ def _plot(cls, ax, x, y, style=None, column_num=None, | |
cls._update_stacker(ax, stacking_id, y) | ||
|
||
# LinePlot expects list of artists | ||
res = [rect] if cls.mpl_ge_1_5_0() else lines | ||
res = [rect] | ||
return res | ||
|
||
def _add_legend_handle(self, handle, label, index=None): | ||
if not self.mpl_ge_1_5_0(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason this can be removed completely is that after removing the compat stuff, there is no more difference to |
||
from matplotlib.patches import Rectangle | ||
# Because fill_between isn't supported in legend, | ||
# specifically add Rectangle handle here | ||
alpha = self.kwds.get('alpha', None) | ||
handle = Rectangle((0, 0), 1, 1, fc=handle.get_color(), | ||
alpha=alpha) | ||
LinePlot._add_legend_handle(self, handle, label, index=index) | ||
|
||
def _post_plot_logic(self, ax, data): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,12 @@ | |
|
||
import warnings | ||
from contextlib import contextmanager | ||
import re | ||
|
||
import numpy as np | ||
|
||
from pandas.core.dtypes.common import is_list_like | ||
from pandas.compat import lrange, lmap | ||
import pandas.compat as compat | ||
from pandas.plotting._compat import _mpl_ge_2_0_0 | ||
|
||
|
||
def _get_standard_colors(num_colors=None, colormap=None, color_type='default', | ||
|
@@ -72,18 +70,9 @@ def _maybe_valid_colors(colors): | |
# check whether each character can be convertible to colors | ||
maybe_color_cycle = _maybe_valid_colors(list(colors)) | ||
if maybe_single_color and maybe_color_cycle and len(colors) > 1: | ||
# Special case for single str 'CN' match and convert to hex | ||
# for supporting matplotlib < 2.0.0 | ||
if re.match(r'\AC[0-9]\Z', colors) and _mpl_ge_2_0_0(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think we still need the condition to check the pattern match here, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already said under |
||
hex_color = [c['color'] | ||
for c in list(plt.rcParams['axes.prop_cycle'])] | ||
colors = [hex_color[int(colors[1])]] | ||
else: | ||
# this may no longer be required | ||
msg = ("'{0}' can be parsed as both single color and " | ||
"color cycle. Specify each color using a list " | ||
"like ['{0}'] or {1}") | ||
raise ValueError(msg.format(colors, list(colors))) | ||
hex_color = [c['color'] | ||
for c in list(plt.rcParams['axes.prop_cycle'])] | ||
colors = [hex_color[int(colors[1])]] | ||
elif maybe_single_color: | ||
colors = [colors] | ||
else: | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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__
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.