-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: MultiIndex.append
now drops names if not the same
#54303
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
Comments
I think this was introduced in #53697. This wasn't intentional, but it is now consistent with a regular index:
I'd be in favor of keeping |
Agree with @lukemanley |
I agree both Index types should be consistent. Is it the right behaviour that when an index which has no meta data is appended to an index with some meta data that that meta data gets destroyed? In general, I consider an append as an operation which usually adds a smaller, possibly singular item, to a larger, more significant object in memory. Im typing on a phone now and cant see what happens if we append an index with meta data to one without, or the outcome when both have meta data that conflict with other. Personally I would prefer that meta data is preserved where possible and would raise on conflict. |
Names are generally only propagated if they match. Having |
Fair enough, I can see this as being a bit of nuisance to implement and maintain. Prefer to leave this issue open if anyone else likes to add user perspectives. |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
On previous pandas versions the
names
arg fromm1
was maintained whenm2
was appended that had no names.On 2.0.3 the
names
are dropped from the return. Caught this in tests of a package upgrade.Is this a bug or was this intentional - I can see arguments for both cases?
Expected Behavior
?
Installed Versions
Replace this line with the output of pd.show_versions()
The text was updated successfully, but these errors were encountered: