Closed
Description
s = pd.Series([0], index=pd.MultiIndex.from_tuples([('a', 1)]))
# This works:
s.rename(lambda x: x)
# This fails:
s.iloc[0:0].rename(lambda x: 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.