pydata/pandas — pull request #5679 by jreback (2013-12-11 14:01:37+00:00)
Title: API/ENH: Detect trying to set inplace on copies in a nicer way, related (GH5597)

related #5597
pretty common error that I have seen, originally from:

http://stackoverflow.com/questions/20508968/series-fillna-in-a-multiindex-dataframe-does-not-fill-is-this-a-bug

```
In [1]: a = [12, 23]

In [2]: b = [123, None]

In [3]: c = [1234, 2345]

In [4]: d = [12345, 23456]

In [5]: tuples = [('eyes', 'left'), ('eyes', 'right'), ('ears', 'left'), ('ears', 'right')]

In [6]: events = {('eyes', 'left'): a, ('eyes', 'right'): b, ('ears', 'left'): c, ('ears', 'right'): d}

In [7]: multiind = pandas.MultiIndex.from_tuples(tuples, names=['part', 'side'])

In [8]: zed = pandas.DataFrame(events, index=['a', 'b'], columns=multiind)
```

Shows a warning (the message is comewhat generic)
```
In [9]: zed['eyes']['right'].fillna(value=555, inplace=True)
/usr/local/bin/ipython:1: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
#!/usr/local/bin/python

In [10]: zed
Out[10]:
part eyes ears
side left right left right
a 12 123 1234 12345
b 23 NaN 2345 23456

[2 rows x 4 columns]
```
Correct method
```
In [11]: zed.loc[:,('eyes','right')].fillna(value=555, inplace=True)

In [12]: zed
Out[12]:
part eyes ears
side left right left right
a 12 123 1234 12345
b 23 555 2345 23456

[2 rows x 4 columns]
```