Skip to content

How to replace coordinate levels in a MultiIndex #6936

Answered by benbovy
aspitarl asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @aspitarl

is there some other operation I should do to accomplish this coordinate reassignment?
I have been able to make this work by dropping and re-adding the index, which gives the expected result, but this doesn't seem like it should be necessary

Reassigning a coordinate that takes part in a multi-coordinate index indeed requires to drop and rebuild the index since the latter is immutable. It would certainly be possible to do this automatically, but IMHO it is probably better if it is done explicitly. Indexes vs. coordinates are often a source of confusion and handling them separately (as much as possible) in the API would make things clearer. Another reason is that building an i…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by aspitarl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants