Consider the following data frame:
>>> df = pd.DataFrame(1.0, index=pd.MultiIndex.from_product([[0, 1], [0, 1]]), columns=['a'])
>>> df
a
0 0 1.0
1 1.0
1 0 1.0
1 1.0
Taking a slice of this and assigning it to itself should leave the data unchanged, but look what happens:
>>> df.loc[(0,), :] = df.loc[(0,), :]
>>> df
a
0 0 NaN
1 NaN
1 0 1.0
1 1.0
I'm on pandas version 0.20.1
Comment From: jreback
a duplicate of https://github.com/pandas-dev/pandas/issues/10440
see the examples there on how to do this. pandas doesn't know how to align your slice. it seems obvious, but is actually non-trivial.