You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
s=pd.Series([0], index=pd.MultiIndex.from_tuples([('a', 1)]))
# This works:s.rename(lambdax: x)
# This fails:s.iloc[0:0].rename(lambdax: x)
Renaming an empty index should not throw an error. It should just return the original empty index. It appears to be failing because _transform_index calls MultiIndex.from_tuples, which doesn't accept an empty list of tuples.
I would imagine that this could instead call from_arrays, which from_tuples calls anyway, or it could check for the special case of an empty index.
The text was updated successfully, but these errors were encountered:
this is a special case duplicate of #4160; renaming of a MI is not tested much at all and the implementation needs fixing. PR's are welcome (#13766 is a start of one).
Renaming an empty index should not throw an error. It should just return the original empty index. It appears to be failing because
_transform_index
callsMultiIndex.from_tuples
, which doesn't accept an empty list of tuples.I would imagine that this could instead call
from_arrays
, whichfrom_tuples
calls anyway, or it could check for the special case of an empty index.The text was updated successfully, but these errors were encountered: