In the given line, copy.index was an empty pd.MultiIndex with specified columns ['FrameId', 'Event'], as it was supposed to be.
Then, however, the line turned it into an empty Index (not MultiIndex) without any specified columns.
This messed up r further on: its index also became just Index, though, with a tuple in each entry. This screwed up r.index.get_level_values(0).max() + 1 because you cannot add 1 to a tuple.
The proposed change should prevent this from happening while maintaining the intended behavior.
I just faced this:
copy.index
was an emptypd.MultiIndex
with specified columns['FrameId', 'Event']
, as it was supposed to be.Index
(notMultiIndex
) without any specified columns.r
further on: its index also became justIndex
, though, with a tuple in each entry. This screwed upr.index.get_level_values(0).max() + 1
because you cannot add1
to a tuple.The proposed change should prevent this from happening while maintaining the intended behavior.
I am using pandas==2.1.2 and Python 3.10