File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 2828
2929from pandas .core .dtypes .cast import (
3030 can_hold_element ,
31+ find_common_type ,
3132 maybe_promote ,
3233)
3334from pandas .core .dtypes .common import (
@@ -1095,14 +1096,12 @@ def _getitem_lowerdim(self, tup: tuple):
10951096 return section
10961097 # This is an elided recursive call to iloc/loc
10971098 out = getattr (section , self .name )[new_key ]
1098- # Re-interpret dtype of out.values for loc/iloc[int, list/slice ].
1099+ # Re-interpret dtype of out.values for loc/iloc[int, list-like ].
10991100 # GH60600
1100- if (
1101- i == 0
1102- and isinstance (key , int )
1103- and isinstance (new_key , (list , slice ))
1104- ):
1105- out = out .infer_objects ()
1101+ if i == 0 and isinstance (key , int ) and is_list_like (tup [1 ]):
1102+ dt = self .obj .dtypes .__getitem__ (tup [1 ])
1103+ if len (dt ) > 0 :
1104+ out = out .astype (find_common_type (dt .tolist ()))
11061105 return out
11071106
11081107 raise IndexingError ("not applicable" )
You can’t perform that action at this time.
0 commit comments