pydata/pandas — pull request #9004 by jakevdp (2014-12-04 22:29:27+00:00)
Title: update NDFrame __setattr__ to match behavior of __getattr__ (Addresses #8994)

This addresses the issue raised in #8994.
Here is the behavior before this PR:
``` python
data = pd.DataFrame({'x':[1, 2, 3]})

data.y = 2
data['y'] = [2, 4, 6]
data.y = 5

print(data.y)
# 2
print(data['y'])
# [5, 5, 5]
```

Here is the behavior after this PR:
``` python
data = pd.DataFrame({'x':[1, 2, 3]})

data.y = 2
data['y'] = [2, 4, 6]
data.y = 5

print(data.y)
# 5
print(data['y'])
# [2, 4, 6]
```

The fix boils down to the fact that when ``data.y`` is called, Python first calls ``data.__getattribute__('y')`` before calling ``data.__getattr__('y')``, but when ``data.y = 5`` is called, Python goes directly to ``data.__setattr__('y', 5)`` without any prior search for defined attributes.

I don't think there are any unintended side-effects to this change, but I'd appreciate some other folks thinking through whether this is the right solution. Thanks!