Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the MultiIndex of the df even if empty #188

Merged

Conversation

michael-hoss
Copy link
Contributor

I just faced this:

  • 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 am using pandas==2.1.2 and Python 3.10

@cheind
Copy link
Owner

cheind commented Jan 30, 2024

Hey thanks for the PR. I'm running CI pipeline to ensure tests pass.

@cheind cheind merged commit 7210fcc into cheind:develop Jan 30, 2024
3 checks passed
@cheind
Copy link
Owner

cheind commented Jan 30, 2024

thanks, merged

@michael-hoss
Copy link
Contributor Author

Awesome, thanks for the quick reaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants