@@ -16,32 +16,27 @@ class TestLoc(Base):
16
16
def test_loc_getitem_int (self ):
17
17
18
18
# int label
19
- self .check_result ("loc" , 2 , "loc" , 2 , typs = ["label " ], fails = KeyError )
19
+ self .check_result ("loc" , 2 , typs = ["labels " ], fails = TypeError )
20
20
21
21
def test_loc_getitem_label (self ):
22
22
23
23
# label
24
- self .check_result ("loc" , "c" , "loc" , "c" , typs = ["empty" ], fails = KeyError )
24
+ self .check_result ("loc" , "c" , typs = ["empty" ], fails = KeyError )
25
25
26
26
def test_loc_getitem_label_out_of_range (self ):
27
27
28
28
# out of range label
29
29
self .check_result (
30
- "loc" ,
31
- "f" ,
32
- "loc" ,
33
- "f" ,
34
- typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ],
35
- fails = KeyError ,
30
+ "loc" , "f" , typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ], fails = KeyError ,
36
31
)
37
- self .check_result ("loc" , "f" , "ix" , "f" , typs = ["floats" ], fails = KeyError )
38
- self .check_result ("loc" , "f" , "loc" , "f" , typs = ["floats" ], fails = KeyError )
32
+ self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
33
+ self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
39
34
self .check_result (
40
- "loc" , 20 , "loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError ,
35
+ "loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError ,
41
36
)
42
- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["labels" ], fails = TypeError )
43
- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["ts" ], axes = 0 , fails = TypeError )
44
- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["floats" ], axes = 0 , fails = KeyError )
37
+ self .check_result ("loc" , 20 , typs = ["labels" ], fails = TypeError )
38
+ self .check_result ("loc" , 20 , typs = ["ts" ], axes = 0 , fails = TypeError )
39
+ self .check_result ("loc" , 20 , typs = ["floats" ], axes = 0 , fails = KeyError )
45
40
46
41
def test_loc_getitem_label_list (self ):
47
42
# TODO: test something here?
@@ -50,49 +45,25 @@ def test_loc_getitem_label_list(self):
50
45
51
46
def test_loc_getitem_label_list_with_missing (self ):
52
47
self .check_result (
53
- "loc" , [0 , 1 , 2 ], "loc" , [ 0 , 1 , 2 ], typs = ["empty" ], fails = KeyError ,
48
+ "loc" , [0 , 1 , 2 ], typs = ["empty" ], fails = KeyError ,
54
49
)
55
50
self .check_result (
56
- "loc" ,
57
- [0 , 2 , 10 ],
58
- "ix" ,
59
- [0 , 2 , 10 ],
60
- typs = ["ints" , "uints" , "floats" ],
61
- axes = 0 ,
62
- fails = KeyError ,
51
+ "loc" , [0 , 2 , 10 ], typs = ["ints" , "uints" , "floats" ], axes = 0 , fails = KeyError ,
63
52
)
64
53
65
54
self .check_result (
66
- "loc" ,
67
- [3 , 6 , 7 ],
68
- "ix" ,
69
- [3 , 6 , 7 ],
70
- typs = ["ints" , "uints" , "floats" ],
71
- axes = 1 ,
72
- fails = KeyError ,
55
+ "loc" , [3 , 6 , 7 ], typs = ["ints" , "uints" , "floats" ], axes = 1 , fails = KeyError ,
73
56
)
74
57
75
58
# GH 17758 - MultiIndex and missing keys
76
59
self .check_result (
77
- "loc" ,
78
- [(1 , 3 ), (1 , 4 ), (2 , 5 )],
79
- "ix" ,
80
- [(1 , 3 ), (1 , 4 ), (2 , 5 )],
81
- typs = ["multi" ],
82
- axes = 0 ,
83
- fails = KeyError ,
60
+ "loc" , [(1 , 3 ), (1 , 4 ), (2 , 5 )], typs = ["multi" ], axes = 0 , fails = KeyError ,
84
61
)
85
62
86
63
def test_loc_getitem_label_list_fails (self ):
87
64
# fails
88
65
self .check_result (
89
- "loc" ,
90
- [20 , 30 , 40 ],
91
- "loc" ,
92
- [20 , 30 , 40 ],
93
- typs = ["ints" , "uints" ],
94
- axes = 1 ,
95
- fails = KeyError ,
66
+ "loc" , [20 , 30 , 40 ], typs = ["ints" , "uints" ], axes = 1 , fails = KeyError ,
96
67
)
97
68
98
69
def test_loc_getitem_label_array_like (self ):
@@ -104,7 +75,7 @@ def test_loc_getitem_bool(self):
104
75
# boolean indexers
105
76
b = [True , False , True , False ]
106
77
107
- self .check_result ("loc" , b , "loc" , b , typs = ["empty" ], fails = IndexError )
78
+ self .check_result ("loc" , b , typs = ["empty" ], fails = IndexError )
108
79
109
80
def test_loc_getitem_label_slice (self ):
110
81
@@ -115,51 +86,25 @@ def test_loc_getitem_label_slice(self):
115
86
# GH 14316
116
87
117
88
self .check_result (
118
- "loc" ,
119
- slice (1 , 3 ),
120
89
"loc" ,
121
90
slice (1 , 3 ),
122
91
typs = ["labels" , "mixed" , "empty" , "ts" , "floats" ],
123
92
fails = TypeError ,
124
93
)
125
94
126
95
self .check_result (
127
- "loc" ,
128
- slice ("20130102" , "20130104" ),
129
- "loc" ,
130
- slice ("20130102" , "20130104" ),
131
- typs = ["ts" ],
132
- axes = 1 ,
133
- fails = TypeError ,
96
+ "loc" , slice ("20130102" , "20130104" ), typs = ["ts" ], axes = 1 , fails = TypeError ,
134
97
)
135
98
136
99
self .check_result (
137
- "loc" ,
138
- slice (2 , 8 ),
139
- "loc" ,
140
- slice (2 , 8 ),
141
- typs = ["mixed" ],
142
- axes = 0 ,
143
- fails = TypeError ,
100
+ "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
144
101
)
145
102
self .check_result (
146
- "loc" ,
147
- slice (2 , 8 ),
148
- "loc" ,
149
- slice (2 , 8 ),
150
- typs = ["mixed" ],
151
- axes = 1 ,
152
- fails = KeyError ,
103
+ "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 1 , fails = KeyError ,
153
104
)
154
105
155
106
self .check_result (
156
- "loc" ,
157
- slice (2 , 4 , 2 ),
158
- "loc" ,
159
- slice (2 , 4 , 2 ),
160
- typs = ["mixed" ],
161
- axes = 0 ,
162
- fails = TypeError ,
107
+ "loc" , slice (2 , 4 , 2 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
163
108
)
164
109
165
110
0 commit comments