28
28
isna ,
29
29
)
30
30
import pandas ._testing as tm
31
- from pandas .core .api import ( # noqa:F401
32
- Float64Index ,
33
- Int64Index ,
34
- NumericIndex ,
35
- UInt64Index ,
36
- )
31
+ from pandas .core .api import NumericIndex
37
32
from pandas .core .arrays import BaseMaskedArray
38
33
39
34
@@ -322,7 +317,9 @@ def test_numpy_argsort(self, index):
322
317
def test_repeat (self , simple_index ):
323
318
rep = 2
324
319
idx = simple_index .copy ()
325
- new_index_cls = Int64Index if isinstance (idx , RangeIndex ) else idx ._constructor
320
+ new_index_cls = (
321
+ NumericIndex if isinstance (idx , RangeIndex ) else idx ._constructor
322
+ )
326
323
expected = new_index_cls (idx .values .repeat (rep ), name = idx .name )
327
324
tm .assert_index_equal (idx .repeat (rep ), expected )
328
325
@@ -505,7 +502,6 @@ def test_equals_op(self, simple_index):
505
502
# assuming the 2nd to last item is unique in the data
506
503
item = index_a [- 2 ]
507
504
tm .assert_numpy_array_equal (index_a == item , expected3 )
508
- # For RangeIndex we can convert to Int64Index
509
505
tm .assert_series_equal (series_a == item , Series (expected3 ))
510
506
511
507
def test_format (self , simple_index ):
@@ -596,7 +592,7 @@ def test_map(self, simple_index):
596
592
idx = simple_index
597
593
598
594
result = idx .map (lambda x : x )
599
- # For RangeIndex we convert to Int64Index
595
+ # RangeIndex are equivalent to the similar NumericIndex with int64 dtype
600
596
tm .assert_index_equal (result , idx , exact = "equiv" )
601
597
602
598
@pytest .mark .parametrize (
@@ -619,7 +615,7 @@ def test_map_dictlike(self, mapper, simple_index):
619
615
identity = mapper (idx .values , idx )
620
616
621
617
result = idx .map (identity )
622
- # For RangeIndex we convert to Int64Index
618
+ # RangeIndex are equivalent to the similar NumericIndex with int64 dtype
623
619
tm .assert_index_equal (result , idx , exact = "equiv" )
624
620
625
621
# empty mappable
@@ -910,19 +906,19 @@ def test_arithmetic_explicit_conversions(self):
910
906
911
907
# float conversions
912
908
arr = np .arange (5 , dtype = "int64" ) * 3.2
913
- expected = Float64Index (arr )
909
+ expected = NumericIndex (arr , dtype = np . float64 )
914
910
fidx = idx * 3.2
915
911
tm .assert_index_equal (fidx , expected )
916
912
fidx = 3.2 * idx
917
913
tm .assert_index_equal (fidx , expected )
918
914
919
915
# interops with numpy arrays
920
- expected = Float64Index (arr )
916
+ expected = NumericIndex (arr , dtype = np . float64 )
921
917
a = np .zeros (5 , dtype = "float64" )
922
918
result = fidx - a
923
919
tm .assert_index_equal (result , expected )
924
920
925
- expected = Float64Index (- arr )
921
+ expected = NumericIndex (- arr , dtype = np . float64 )
926
922
a = np .zeros (5 , dtype = "float64" )
927
923
result = a - fidx
928
924
tm .assert_index_equal (result , expected )
0 commit comments