19
19
)
20
20
import pandas ._testing as tm
21
21
from pandas .api .types import is_unsigned_integer_dtype
22
- from pandas .core .api import (
23
- Float64Index ,
24
- Int64Index ,
25
- UInt64Index ,
26
- )
22
+ from pandas .core .api import NumericIndex
27
23
from pandas .core .arrays import IntervalArray
28
24
import pandas .core .common as com
29
25
@@ -44,9 +40,9 @@ class ConstructorTests:
44
40
params = [
45
41
([3 , 14 , 15 , 92 , 653 ], np .int64 ),
46
42
(np .arange (10 , dtype = "int64" ), np .int64 ),
47
- (Int64Index (range (- 10 , 11 )), np .int64 ),
48
- (UInt64Index (range (10 , 31 )), np .uint64 ),
49
- (Float64Index (np .arange (20 , 30 , 0.5 )), np .float64 ),
43
+ (NumericIndex (range (- 10 , 11 ), dtype = np . int64 ), np .int64 ),
44
+ (NumericIndex (range (10 , 31 ), dtype = np . uint64 ), np .uint64 ),
45
+ (NumericIndex (np .arange (20 , 30 , 0.5 ), dtype = np . float64 ), np .float64 ),
50
46
(date_range ("20180101" , periods = 10 ), "<M8[ns]" ),
51
47
(
52
48
date_range ("20180101" , periods = 10 , tz = "US/Eastern" ),
@@ -74,10 +70,10 @@ def test_constructor(self, constructor, breaks_and_expected_subtype, closed, nam
74
70
@pytest .mark .parametrize (
75
71
"breaks, subtype" ,
76
72
[
77
- (Int64Index ([0 , 1 , 2 , 3 , 4 ]), "float64" ),
78
- (Int64Index ([0 , 1 , 2 , 3 , 4 ]), "datetime64[ns]" ),
79
- (Int64Index ([0 , 1 , 2 , 3 , 4 ]), "timedelta64[ns]" ),
80
- (Float64Index ([0 , 1 , 2 , 3 , 4 ]), "int64" ),
73
+ (NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . int64 ), "float64" ),
74
+ (NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . int64 ), "datetime64[ns]" ),
75
+ (NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . int64 ), "timedelta64[ns]" ),
76
+ (NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . float64 ), "int64" ),
81
77
(date_range ("2017-01-01" , periods = 5 ), "int64" ),
82
78
(timedelta_range ("1 day" , periods = 5 ), "int64" ),
83
79
],
@@ -96,9 +92,9 @@ def test_constructor_dtype(self, constructor, breaks, subtype):
96
92
@pytest .mark .parametrize (
97
93
"breaks" ,
98
94
[
99
- Int64Index ([0 , 1 , 2 , 3 , 4 ]),
100
- UInt64Index ([0 , 1 , 2 , 3 , 4 ]),
101
- Float64Index ([0 , 1 , 2 , 3 , 4 ]),
95
+ NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . int64 ),
96
+ NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . uint64 ),
97
+ NumericIndex ([0 , 1 , 2 , 3 , 4 ], dtype = np . float64 ),
102
98
date_range ("2017-01-01" , periods = 5 ),
103
99
timedelta_range ("1 day" , periods = 5 ),
104
100
],
@@ -255,8 +251,8 @@ def test_mixed_float_int(self, left_subtype, right_subtype):
255
251
right = np .arange (1 , 10 , dtype = right_subtype )
256
252
result = IntervalIndex .from_arrays (left , right )
257
253
258
- expected_left = Float64Index (left )
259
- expected_right = Float64Index (right )
254
+ expected_left = NumericIndex (left , dtype = np . float64 )
255
+ expected_right = NumericIndex (right , dtype = np . float64 )
260
256
expected_subtype = np .float64
261
257
262
258
tm .assert_index_equal (result .left , expected_left )
@@ -307,9 +303,9 @@ class TuplesClassConstructorTests(ConstructorTests):
307
303
params = [
308
304
([3 , 14 , 15 , 92 , 653 ], np .int64 ),
309
305
(np .arange (10 , dtype = "int64" ), np .int64 ),
310
- (Int64Index (range (- 10 , 11 )), np .int64 ),
311
- (UInt64Index (range (10 , 31 )), np .int64 ),
312
- (Float64Index (np .arange (20 , 30 , 0.5 )), np .float64 ),
306
+ (NumericIndex (range (- 10 , 11 ), dtype = np . int64 ), np .int64 ),
307
+ (NumericIndex (range (10 , 31 ), dtype = np . uint64 ), np .int64 ),
308
+ (NumericIndex (np .arange (20 , 30 , 0.5 ), dtype = np . float64 ), np .float64 ),
313
309
(date_range ("20180101" , periods = 10 ), "<M8[ns]" ),
314
310
(
315
311
date_range ("20180101" , periods = 10 , tz = "US/Eastern" ),
0 commit comments