pydata/pandas — pull request #5581 by jtratner (2013-11-24 21:22:48+00:00)
Title: CLN/BUG: Fix stacklevel on setting with copy warning.

May not be perfect, but gets us most of the way there. Resolves
@TomAugspurger's comment -
https://github.com/pydata/pandas/pull/5390#issuecomment-29166038

Related to #5390.

Put the following in a file called `test.py`.

```python
from pandas import DataFrame
def myfunction():
df = DataFrame({"A": [1, 2, 3, 4, 5], "B": [3.125, 4.12, 3.1, 6.2, 7.]})
row = df.loc[0]
row["A"] = 0

def anotherfunction():
myfunction()

def third_function():
anotherfunction()

third_function()
```

Running it will generate this warning:

```
test.py:5: SettingWithCopyWarning: A value is trying to be set on a copy
of a slice from a DataFrame.
Try using .loc[row_index,col_indexer] = value instead
row["A"] = 0
```

I don't think it's worth testing (especially because there's not
necessarily a simple way to do it).