Skip to content

Commit 3e0358d

Browse files
h-vetinariTomAugspurger
authored andcommitted
CLN: post-post numpy bump (#24365)
* CLN: post-post numpy bumpy * Lint
1 parent aa3d56e commit 3e0358d

File tree

6 files changed

+10
-22
lines changed

6 files changed

+10
-22
lines changed

pandas/_libs/lib.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ def is_scalar(val: object) -> bool:
153153
"""
154154

155155
return (cnp.PyArray_IsAnyScalar(val)
156-
# As of numpy-1.9, PyArray_IsAnyScalar misses bytearrays on Py3.
157-
or isinstance(val, (bytes, Fraction, Number))
158-
# We differ from numpy (as of 1.10), which claims that None is
159-
# not scalar in np.isscalar().
156+
# PyArray_IsAnyScalar is always False for bytearrays on Py3
157+
or isinstance(val, (Fraction, Number))
158+
# We differ from numpy, which claims that None is not scalar;
159+
# see np.isscalar
160160
or val is None
161161
or PyDate_Check(val)
162162
or PyDelta_Check(val)

pandas/_libs/tslibs/timedeltas.pyx

-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ cpdef convert_to_timedelta64(object ts, object unit):
161161
- None/NaT
162162
163163
Return an ns based int64
164-
165-
# kludgy here until we have a timedelta scalar
166-
# handle the numpy < 1.7 case
167164
"""
168165
if checknull_with_nat(ts):
169166
return np.timedelta64(NPY_NAT)

pandas/tests/arrays/categorical/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ def test_codes_immutable(self):
455455
c.codes = np.array([0, 1, 2, 0, 1], dtype='int8')
456456

457457
# changes in the codes array should raise
458-
# np 1.6.1 raises RuntimeError rather than ValueError
459458
codes = c.codes
460459

461460
with pytest.raises(ValueError):

pandas/tests/indexes/datetimes/test_misc.py

-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def test_datetimeindex_accessors(self):
188188
assert sum(dti.is_year_end) == 1
189189

190190
# Ensure is_start/end accessors throw ValueError for CustomBusinessDay,
191-
# CBD requires np >= 1.7
192191
bday_egypt = offsets.CustomBusinessDay(weekmask='Sun Mon Tue Wed Thu')
193192
dti = date_range(datetime(2013, 4, 30), periods=5, freq=bday_egypt)
194193
pytest.raises(ValueError, lambda: dti.is_month_start)

pandas/tests/indexes/timedeltas/test_arithmetic.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22

33
from datetime import timedelta
4-
from distutils.version import LooseVersion
54

65
import numpy as np
76
import pytest
@@ -197,15 +196,13 @@ def test_ops_ndarray(self):
197196
other = pd.to_timedelta(['1 day']).values
198197
expected = pd.to_timedelta(['2 days']).values
199198
tm.assert_numpy_array_equal(td + other, expected)
200-
if LooseVersion(np.__version__) >= LooseVersion('1.8'):
201-
tm.assert_numpy_array_equal(other + td, expected)
199+
tm.assert_numpy_array_equal(other + td, expected)
202200
pytest.raises(TypeError, lambda: td + np.array([1]))
203201
pytest.raises(TypeError, lambda: np.array([1]) + td)
204202

205203
expected = pd.to_timedelta(['0 days']).values
206204
tm.assert_numpy_array_equal(td - other, expected)
207-
if LooseVersion(np.__version__) >= LooseVersion('1.8'):
208-
tm.assert_numpy_array_equal(-other + td, expected)
205+
tm.assert_numpy_array_equal(-other + td, expected)
209206
pytest.raises(TypeError, lambda: td - np.array([1]))
210207
pytest.raises(TypeError, lambda: np.array([1]) - td)
211208

@@ -217,21 +214,18 @@ def test_ops_ndarray(self):
217214

218215
tm.assert_numpy_array_equal(td / other,
219216
np.array([1], dtype=np.float64))
220-
if LooseVersion(np.__version__) >= LooseVersion('1.8'):
221-
tm.assert_numpy_array_equal(other / td,
222-
np.array([1], dtype=np.float64))
217+
tm.assert_numpy_array_equal(other / td,
218+
np.array([1], dtype=np.float64))
223219

224220
# timedelta, datetime
225221
other = pd.to_datetime(['2000-01-01']).values
226222
expected = pd.to_datetime(['2000-01-02']).values
227223
tm.assert_numpy_array_equal(td + other, expected)
228-
if LooseVersion(np.__version__) >= LooseVersion('1.8'):
229-
tm.assert_numpy_array_equal(other + td, expected)
224+
tm.assert_numpy_array_equal(other + td, expected)
230225

231226
expected = pd.to_datetime(['1999-12-31']).values
232227
tm.assert_numpy_array_equal(-td + other, expected)
233-
if LooseVersion(np.__version__) >= LooseVersion('1.8'):
234-
tm.assert_numpy_array_equal(other - td, expected)
228+
tm.assert_numpy_array_equal(other - td, expected)
235229

236230
def test_tdi_ops_attributes(self):
237231
rng = timedelta_range('2 days', periods=5, freq='2D', name='x')

pandas/tests/util/test_util.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def test_rands_array_2d():
3030

3131

3232
def test_numpy_err_state_is_default():
33-
# The defaults since numpy 1.6.0
3433
expected = {"over": "warn", "divide": "warn",
3534
"invalid": "warn", "under": "ignore"}
3635
import numpy as np

0 commit comments

Comments
 (0)