@@ -42,7 +42,7 @@ def adjust_negative_zero(zero, expected):
4242# TODO: remove this kludge once mypy stops giving false positives here
4343# List comprehension has incompatible type List[PandasObject]; expected List[RangeIndex]
4444# See GH#29725
45- ser_or_index : List [Any ] = [Series , pd . Index ]
45+ ser_or_index : List [Any ] = [Series , Index ]
4646lefts : List [Any ] = [pd .RangeIndex (10 , 40 , 10 )]
4747lefts .extend (
4848 [
@@ -100,7 +100,7 @@ def test_compare_invalid(self):
100100 def test_numeric_cmp_string_numexpr_path (self , box_with_array ):
101101 # GH#36377, GH#35700
102102 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
104104
105105 obj = Series (np .random .randn (10 ** 5 ))
106106 obj = tm .box_expected (obj , box , transpose = False )
@@ -126,7 +126,7 @@ def test_numeric_cmp_string_numexpr_path(self, box_with_array):
126126class TestNumericArraylikeArithmeticWithDatetimeLike :
127127
128128 # 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 ])
130130 @pytest .mark .parametrize (
131131 "left" , lefts , ids = lambda x : type (x ).__name__ + str (x .dtype )
132132 )
@@ -146,7 +146,7 @@ def test_mul_td64arr(self, left, box_cls):
146146 tm .assert_equal (result , expected )
147147
148148 # 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 ])
150150 @pytest .mark .parametrize (
151151 "left" , lefts , ids = lambda x : type (x ).__name__ + str (x .dtype )
152152 )
@@ -318,7 +318,7 @@ class TestDivisionByZero:
318318 def test_div_zero (self , zero , numeric_idx ):
319319 idx = numeric_idx
320320
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 )
322322 # We only adjust for Index, because Series does not yet apply
323323 # the adjustment correctly.
324324 expected2 = adjust_negative_zero (zero , expected )
@@ -331,7 +331,7 @@ def test_div_zero(self, zero, numeric_idx):
331331 def test_floordiv_zero (self , zero , numeric_idx ):
332332 idx = numeric_idx
333333
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 )
335335 # We only adjust for Index, because Series does not yet apply
336336 # the adjustment correctly.
337337 expected2 = adjust_negative_zero (zero , expected )
@@ -344,7 +344,7 @@ def test_floordiv_zero(self, zero, numeric_idx):
344344 def test_mod_zero (self , zero , numeric_idx ):
345345 idx = numeric_idx
346346
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 )
348348 result = idx % zero
349349 tm .assert_index_equal (result , expected )
350350 ser_compat = Series (idx ).astype ("i8" ) % np .array (zero ).astype ("i8" )
@@ -353,8 +353,8 @@ def test_mod_zero(self, zero, numeric_idx):
353353 def test_divmod_zero (self , zero , numeric_idx ):
354354 idx = numeric_idx
355355
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 )
358358 exleft = adjust_negative_zero (zero , exleft )
359359
360360 result = divmod (idx , zero )
@@ -368,9 +368,7 @@ def test_div_negative_zero(self, zero, numeric_idx, op):
368368 return
369369 idx = numeric_idx - 3
370370
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 )
374372 expected = adjust_negative_zero (zero , expected )
375373
376374 result = op (idx , zero )
@@ -1045,7 +1043,7 @@ class TestUFuncCompat:
10451043 [pd .Int64Index , pd .UInt64Index , pd .Float64Index , pd .RangeIndex , Series ],
10461044 )
10471045 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
10491047
10501048 if holder is pd .RangeIndex :
10511049 idx = pd .RangeIndex (0 , 5 )
@@ -1060,7 +1058,7 @@ def test_ufunc_compat(self, holder):
10601058 )
10611059 def test_ufunc_coercions (self , holder ):
10621060 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
10641062
10651063 result = np .sqrt (idx )
10661064 assert result .dtype == "f8" and isinstance (result , box )
@@ -1104,7 +1102,7 @@ def test_ufunc_coercions(self, holder):
11041102 )
11051103 def test_ufunc_multiple_return_values (self , holder ):
11061104 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
11081106
11091107 result = np .modf (obj )
11101108 assert isinstance (result , tuple )
@@ -1299,14 +1297,14 @@ def test_numeric_compat2(self):
12991297 def test_addsub_arithmetic (self , dtype , delta ):
13001298 # GH#8142
13011299 delta = dtype (delta )
1302- index = pd . Index ([10 , 11 , 12 ], dtype = dtype )
1300+ index = Index ([10 , 11 , 12 ], dtype = dtype )
13031301 result = index + delta
1304- expected = pd . Index (index .values + delta , dtype = dtype )
1302+ expected = Index (index .values + delta , dtype = dtype )
13051303 tm .assert_index_equal (result , expected )
13061304
13071305 # this subtraction used to fail
13081306 result = index - delta
1309- expected = pd . Index (index .values - delta , dtype = dtype )
1307+ expected = Index (index .values - delta , dtype = dtype )
13101308 tm .assert_index_equal (result , expected )
13111309
13121310 tm .assert_index_equal (index + index , 2 * index )
0 commit comments