@@ -59,10 +59,6 @@ def test_loc_scalar(self):
59
59
with pytest .raises (TypeError , match = msg ):
60
60
df .loc ["d" ] = 10
61
61
62
- msg = (
63
- "cannot insert an item into a CategoricalIndex that is not "
64
- "already an existing category"
65
- )
66
62
msg = "'fill_value=d' is not present in this Categorical's categories"
67
63
with pytest .raises (ValueError , match = msg ):
68
64
df .loc ["d" , "A" ] = 10
@@ -74,9 +70,9 @@ def test_loc_scalar(self):
74
70
75
71
def test_slicing (self ):
76
72
cat = Series (Categorical ([1 , 2 , 3 , 4 ]))
77
- reversed = cat [::- 1 ]
73
+ reverse = cat [::- 1 ]
78
74
exp = np .array ([4 , 3 , 2 , 1 ], dtype = np .int64 )
79
- tm .assert_numpy_array_equal (reversed .__array__ (), exp )
75
+ tm .assert_numpy_array_equal (reverse .__array__ (), exp )
80
76
81
77
df = DataFrame ({"value" : (np .arange (100 ) + 1 ).astype ("int64" )})
82
78
df ["D" ] = pd .cut (df .value , bins = [0 , 25 , 50 , 75 , 100 ])
@@ -170,23 +166,6 @@ def test_slicing_and_getting_ops(self):
170
166
res_val = df .loc ["j" , "cats" ]
171
167
assert res_val == exp_val
172
168
173
- # ix
174
- # frame
175
- # res_df = df.loc["j":"k",[0,1]] # doesn't work?
176
- res_df = df .loc ["j" :"k" , :]
177
- tm .assert_frame_equal (res_df , exp_df )
178
- assert is_categorical_dtype (res_df ["cats" ].dtype )
179
-
180
- # row
181
- res_row = df .loc ["j" , :]
182
- tm .assert_series_equal (res_row , exp_row )
183
- assert isinstance (res_row ["cats" ], str )
184
-
185
- # col
186
- res_col = df .loc [:, "cats" ]
187
- tm .assert_series_equal (res_col , exp_col )
188
- assert is_categorical_dtype (res_col .dtype )
189
-
190
169
# single value
191
170
res_val = df .loc ["j" , df .columns [0 ]]
192
171
assert res_val == exp_val
0 commit comments