@@ -42,7 +42,7 @@ def adjust_negative_zero(zero, expected):
42
42
# TODO: remove this kludge once mypy stops giving false positives here
43
43
# List comprehension has incompatible type List[PandasObject]; expected List[RangeIndex]
44
44
# See GH#29725
45
- ser_or_index : List [Any ] = [Series , pd . Index ]
45
+ ser_or_index : List [Any ] = [Series , Index ]
46
46
lefts : List [Any ] = [pd .RangeIndex (10 , 40 , 10 )]
47
47
lefts .extend (
48
48
[
@@ -100,7 +100,7 @@ def test_compare_invalid(self):
100
100
def test_numeric_cmp_string_numexpr_path (self , box_with_array ):
101
101
# GH#36377, GH#35700
102
102
box = box_with_array
103
- xbox = box if box is not pd . Index else np .ndarray
103
+ xbox = box if box is not Index else np .ndarray
104
104
105
105
obj = Series (np .random .randn (10 ** 5 ))
106
106
obj = tm .box_expected (obj , box , transpose = False )
@@ -126,7 +126,7 @@ def test_numeric_cmp_string_numexpr_path(self, box_with_array):
126
126
class TestNumericArraylikeArithmeticWithDatetimeLike :
127
127
128
128
# TODO: also check name retentention
129
- @pytest .mark .parametrize ("box_cls" , [np .array , pd . Index , Series ])
129
+ @pytest .mark .parametrize ("box_cls" , [np .array , Index , Series ])
130
130
@pytest .mark .parametrize (
131
131
"left" , lefts , ids = lambda x : type (x ).__name__ + str (x .dtype )
132
132
)
@@ -146,7 +146,7 @@ def test_mul_td64arr(self, left, box_cls):
146
146
tm .assert_equal (result , expected )
147
147
148
148
# TODO: also check name retentention
149
- @pytest .mark .parametrize ("box_cls" , [np .array , pd . Index , Series ])
149
+ @pytest .mark .parametrize ("box_cls" , [np .array , Index , Series ])
150
150
@pytest .mark .parametrize (
151
151
"left" , lefts , ids = lambda x : type (x ).__name__ + str (x .dtype )
152
152
)
@@ -318,7 +318,7 @@ class TestDivisionByZero:
318
318
def test_div_zero (self , zero , numeric_idx ):
319
319
idx = numeric_idx
320
320
321
- expected = pd . Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
321
+ expected = Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
322
322
# We only adjust for Index, because Series does not yet apply
323
323
# the adjustment correctly.
324
324
expected2 = adjust_negative_zero (zero , expected )
@@ -331,7 +331,7 @@ def test_div_zero(self, zero, numeric_idx):
331
331
def test_floordiv_zero (self , zero , numeric_idx ):
332
332
idx = numeric_idx
333
333
334
- expected = pd . Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
334
+ expected = Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
335
335
# We only adjust for Index, because Series does not yet apply
336
336
# the adjustment correctly.
337
337
expected2 = adjust_negative_zero (zero , expected )
@@ -344,7 +344,7 @@ def test_floordiv_zero(self, zero, numeric_idx):
344
344
def test_mod_zero (self , zero , numeric_idx ):
345
345
idx = numeric_idx
346
346
347
- expected = pd . Index ([np .nan , np .nan , np .nan , np .nan , np .nan ], dtype = np .float64 )
347
+ expected = Index ([np .nan , np .nan , np .nan , np .nan , np .nan ], dtype = np .float64 )
348
348
result = idx % zero
349
349
tm .assert_index_equal (result , expected )
350
350
ser_compat = Series (idx ).astype ("i8" ) % np .array (zero ).astype ("i8" )
@@ -353,8 +353,8 @@ def test_mod_zero(self, zero, numeric_idx):
353
353
def test_divmod_zero (self , zero , numeric_idx ):
354
354
idx = numeric_idx
355
355
356
- exleft = pd . Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
357
- exright = pd . Index ([np .nan , np .nan , np .nan , np .nan , np .nan ], dtype = np .float64 )
356
+ exleft = Index ([np .nan , np .inf , np .inf , np .inf , np .inf ], dtype = np .float64 )
357
+ exright = Index ([np .nan , np .nan , np .nan , np .nan , np .nan ], dtype = np .float64 )
358
358
exleft = adjust_negative_zero (zero , exleft )
359
359
360
360
result = divmod (idx , zero )
@@ -368,9 +368,7 @@ def test_div_negative_zero(self, zero, numeric_idx, op):
368
368
return
369
369
idx = numeric_idx - 3
370
370
371
- expected = pd .Index (
372
- [- np .inf , - np .inf , - np .inf , np .nan , np .inf ], dtype = np .float64
373
- )
371
+ expected = Index ([- np .inf , - np .inf , - np .inf , np .nan , np .inf ], dtype = np .float64 )
374
372
expected = adjust_negative_zero (zero , expected )
375
373
376
374
result = op (idx , zero )
@@ -1045,7 +1043,7 @@ class TestUFuncCompat:
1045
1043
[pd .Int64Index , pd .UInt64Index , pd .Float64Index , pd .RangeIndex , Series ],
1046
1044
)
1047
1045
def test_ufunc_compat (self , holder ):
1048
- box = Series if holder is Series else pd . Index
1046
+ box = Series if holder is Series else Index
1049
1047
1050
1048
if holder is pd .RangeIndex :
1051
1049
idx = pd .RangeIndex (0 , 5 )
@@ -1060,7 +1058,7 @@ def test_ufunc_compat(self, holder):
1060
1058
)
1061
1059
def test_ufunc_coercions (self , holder ):
1062
1060
idx = holder ([1 , 2 , 3 , 4 , 5 ], name = "x" )
1063
- box = Series if holder is Series else pd . Index
1061
+ box = Series if holder is Series else Index
1064
1062
1065
1063
result = np .sqrt (idx )
1066
1064
assert result .dtype == "f8" and isinstance (result , box )
@@ -1104,7 +1102,7 @@ def test_ufunc_coercions(self, holder):
1104
1102
)
1105
1103
def test_ufunc_multiple_return_values (self , holder ):
1106
1104
obj = holder ([1 , 2 , 3 ], name = "x" )
1107
- box = Series if holder is Series else pd . Index
1105
+ box = Series if holder is Series else Index
1108
1106
1109
1107
result = np .modf (obj )
1110
1108
assert isinstance (result , tuple )
@@ -1299,14 +1297,14 @@ def test_numeric_compat2(self):
1299
1297
def test_addsub_arithmetic (self , dtype , delta ):
1300
1298
# GH#8142
1301
1299
delta = dtype (delta )
1302
- index = pd . Index ([10 , 11 , 12 ], dtype = dtype )
1300
+ index = Index ([10 , 11 , 12 ], dtype = dtype )
1303
1301
result = index + delta
1304
- expected = pd . Index (index .values + delta , dtype = dtype )
1302
+ expected = Index (index .values + delta , dtype = dtype )
1305
1303
tm .assert_index_equal (result , expected )
1306
1304
1307
1305
# this subtraction used to fail
1308
1306
result = index - delta
1309
- expected = pd . Index (index .values - delta , dtype = dtype )
1307
+ expected = Index (index .values - delta , dtype = dtype )
1310
1308
tm .assert_index_equal (result , expected )
1311
1309
1312
1310
tm .assert_index_equal (index + index , 2 * index )
0 commit comments