We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
# Your code here mi = pd.MultiIndex.from_product([['A','B'], [0, 1]]) df1 = pd.DataFrame(np.ones((1,4)), columns=mi) df2 = df1.rename(columns={df1.columns[1]: ('C', 3)}) print(df1) print(df2)
Currently both df1 and df2 are:
A B 0 1 0 1 0 1.0 1.0 1.0 1.0
I was expecting df.columns[1] to change to ('C', 3) but it remains ('A', 1)
A C B 0 3 0 1 0 1.0 1.0 1.0 1.0
The text was updated successfully, but these errors were encountered:
Can you post the expected output?
Sorry, something went wrong.
Closing as a duplicate of #4160
No branches or pull requests
Code Sample, a copy-pastable example if possible
Currently both df1 and df2 are:
Problem description
I was expecting df.columns[1] to change to ('C', 3) but it remains ('A', 1)
Expected Output
The text was updated successfully, but these errors were encountered: