apologies if this is a manifest of another issue, though I couldn't find one after some searching.

the following behavior can be seen in 0.14.1 and 0.15.2:

pt = pd.Panel({'a': {'b': {'c': 1, 'd': 1}, 'e': {'c': 2, 'd': 2}}})
pt2 = pd.Panel({'a': {'b': {'c': 3, 'd': 5}, 'e': {'c': 4, 'd': 6}}})
pt.a, pt2.a
mask = (pt.a > 1) & (pt2.a > 4)
pt.a[mask] = pt2.a[mask]
pt.loc[['a'],:,'e']
pt.loc['a',:,'e']

the pt.loc[['a'],:,'e'] shows the original 2 while pt.loc['a',:,'e'] shows the updated 6 from pt2.a

is there a better way to do this, basically i'd like to set the values of pt.a to that of pt2.a based on some mask. any direction would be much appreciated, thanks!

Comment From: jreback

Doing an assignment like pt.a[mask] = value is chained assignment

In [92]: pt.loc['a',:,:] = pt2.a[mask].fillna(pt.a)

In [94]: pt['a',:,'e']
Out[94]: 
c    2
d    6
Name: e, dtype: float64

In [95]: pt[['a'],:,'e']
Out[95]: 
   a
c  2
d  6

So a couple of issues here: - the chained assignment should warn - there are some things that would make this easier

If the mask were constructed to be a Panel itself (this doesn't work ATM, but is easy to fix) mask = (pt[['a']] > 1) & (pt2.loc[['a']] > 4)

Then pt[mask] = pt2[mask] also could work

Comment From: ndaniyar

If pt.a[mask] = pt2.a[mask] assignment operates on a copy of pt.a, then how come pt['a',:,'e'] contains the updated values?

Comment From: thinkingatoms

thanks a lot @jreback!

Comment From: jreback

closing as Panels are deprecated