Skip to content

Commit 5003eaa

Browse files
Fix loc dtype
Co-authored-by: Parthi <[email protected]>
1 parent 4f27380 commit 5003eaa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pandas/core/indexing.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,16 @@ def _getitem_lowerdim(self, tup: tuple):
10941094
if com.is_null_slice(new_key):
10951095
return section
10961096
# This is an elided recursive call to iloc/loc
1097-
return getattr(section, self.name)[new_key]
1097+
out = getattr(section, self.name)[new_key]
1098+
# Re-interpret dtype of out.values for loc/iloc[int, list/slice].
1099+
# GH60600
1100+
if (
1101+
i == 0
1102+
and isinstance(key, int)
1103+
and isinstance(new_key, (list, slice))
1104+
):
1105+
out = out.infer_objects()
1106+
return out
10981107

10991108
raise IndexingError("not applicable")
11001109

0 commit comments

Comments
 (0)