|
10 | 10 |
|
11 | 11 | import numpy as np
|
12 | 12 |
|
13 |
| -from pandas import (notna, Series, Index, Float64Index, |
| 13 | +from pandas import (isna, notna, Series, Index, Float64Index, |
14 | 14 | Int64Index, RangeIndex)
|
15 | 15 |
|
16 | 16 | import pandas.util.testing as tm
|
@@ -994,3 +994,22 @@ def test_append(self):
|
994 | 994 | # Append single item rather than list
|
995 | 995 | result2 = indices[0].append(indices[1])
|
996 | 996 | tm.assert_index_equal(result2, expected, exact=True)
|
| 997 | + |
| 998 | + @pytest.mark.parametrize('start,stop,step', |
| 999 | + [(0, 400, 3), (500, 0, -6), (-10**6, 10**6, 4), |
| 1000 | + (10**6, -10**6, -4), (0, 10, 20)]) |
| 1001 | + def test_max_min(self, start, stop, step): |
| 1002 | + # GH17607 |
| 1003 | + idx = RangeIndex(start, stop, step) |
| 1004 | + expected = idx._int64index.max() |
| 1005 | + result = idx.max() |
| 1006 | + assert result == expected |
| 1007 | + |
| 1008 | + expected = idx._int64index.min() |
| 1009 | + result = idx.min() |
| 1010 | + assert result == expected |
| 1011 | + |
| 1012 | + # empty |
| 1013 | + idx = RangeIndex(start, stop, -step) |
| 1014 | + assert isna(idx.max()) |
| 1015 | + assert isna(idx.min()) |
0 commit comments