import pandas as pd

pd.set_option('display.max_columns', None)
idx = pd.IndexSlice

df = pd.DataFrame(index=pd.Index([pd.Timestamp('20080101 23:00'),
    pd.Timestamp('20080101 23:01')]), columns = pd.MultiIndex.from_product([[1,2],['A','B']]))
print(df)
df.loc[:,idx[:,'A']]=0
print(df)
df.loc[:,idx[:,'B']] = df.loc[:,idx[:,'A']]
print(df)
                       1         2     
                       A    B    A    B
2008-01-01 23:00:00  NaN  NaN  NaN  NaN
2008-01-01 23:01:00  NaN  NaN  NaN  NaN
                     1       2     
                     A    B  A    B
2008-01-01 23:00:00  0  NaN  0  NaN
2008-01-01 23:01:00  0  NaN  0  NaN
                     1       2     
                     A    B  A    B
2008-01-01 23:00:00  0  NaN  0  NaN
2008-01-01 23:01:00  0  NaN  0  NaN

I believe I use the correct Pandas idioms. But Column B is still NaN after assignment. If you initialize column B first, it also destroys the values with NaNs afterwards.

Sorry for the formatting, for some reason forum will not do what it is supposed to do for code blocks.

It may be related to but not the same:

10440

Comment From: otro-mas1

Only need add .values like in #10440

df.loc[:,idx[:,'B']] = df.loc[:,idx[:,'A']].values `

Comment From: phofl

This works as expected, closing for now since we have a bunch of open issues about this