We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c4d281 commit b90f421Copy full SHA for b90f421
pandas/compat/numpy/function.py
@@ -376,6 +376,8 @@ def validate_minmax_axis(axis):
376
ValueError
377
"""
378
ndim = 1 # hard-coded for Index
379
- if axis is not None and axis >= ndim:
+ if axis is None:
380
+ return
381
+ if axis >= ndim or (axis < 0 and ndim - axis < 0):
382
raise ValueError("`axis` must be fewer than the number of "
383
"dimensions ({ndim})".format(ndim=ndim))
pandas/tests/indexes/datetimelike.py
@@ -15,6 +15,10 @@ def test_argmax_axis_invalid(self):
15
rng.argmax(axis=1)
16
with pytest.raises(ValueError):
17
rng.argmin(axis=2)
18
+ with pytest.raises(ValueError):
19
+ rng.min(axis=-2)
20
21
+ rng.max(axis=-3)
22
23
def test_can_hold_identifiers(self):
24
idx = self.create_index()
0 commit comments