File tree 1 file changed +13
-3
lines changed 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1292,12 +1292,22 @@ def __array__(self, dtype=None):
1292
1292
def _translate_axis_key (self , axis , key ):
1293
1293
# we do not use axis.translate because we have to let Pandas do the
1294
1294
# label -> position conversion
1295
- if key in axis :
1296
- return key
1297
-
1298
1295
if isinstance (key , ValueGroup ):
1296
+ # this case is tricky because axis.__contains__(VG) use VG.key
1297
+ # (because of the way VG.__hash__ is implemented), which means
1298
+ # VG.key in axis => VG in axis even though only VG.key is really
1299
+ # in the actual Axis ticks (and Pandas Index) and NOT the VG itself
1300
+ if key in axis :
1301
+ # we check if the VG itself is *really* in the axis
1302
+ idx = axis .translate (key )
1303
+ if isinstance (axis .labels [idx ], ValueGroup ):
1304
+ return key
1305
+
1299
1306
key = key .key
1300
1307
1308
+ if key in axis :
1309
+ return key
1310
+
1301
1311
return to_key (key )
1302
1312
1303
1313
#XXX: we only need axes length, so we might want to move this out of the
You can’t perform that action at this time.
0 commit comments