We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
df = pd.DataFrame({"a": [1], "b": [2]}) df2 = df.copy() cols = pd.MultiIndex.from_arrays([df.columns]) df2.columns = cols >>> df a b 0 1 2 >>> df2 a b 0 1 2 >>> df["a"] 0 1 Name: a, dtype: int64 >>> df2["a"] a 0 1
These should behave the same.