File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,8 @@ def validate_minmax_axis(axis):
376
376
ValueError
377
377
"""
378
378
ndim = 1 # hard-coded for Index
379
- if axis is not None and axis >= ndim :
379
+ if axis is None :
380
+ return
381
+ if axis >= ndim or (axis < 0 and ndim - axis < 0 ):
380
382
raise ValueError ("`axis` must be fewer than the number of "
381
383
"dimensions ({ndim})" .format (ndim = ndim ))
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ def test_argmax_axis_invalid(self):
15
15
rng .argmax (axis = 1 )
16
16
with pytest .raises (ValueError ):
17
17
rng .argmin (axis = 2 )
18
+ with pytest .raises (ValueError ):
19
+ rng .min (axis = - 2 )
20
+ with pytest .raises (ValueError ):
21
+ rng .max (axis = - 3 )
18
22
19
23
def test_can_hold_identifiers (self ):
20
24
idx = self .create_index ()
You can’t perform that action at this time.
0 commit comments