Skip to content

Instantly share code, notes, and snippets.

@godber
Created June 26, 2013 02:07
Show Gist options
  • Select an option

  • Save godber/5864201 to your computer and use it in GitHub Desktop.

Select an option

Save godber/5864201 to your computer and use it in GitHub Desktop.
Assignment via the pandas attribute accessor does not appear to work in Pandas 0.11. Should it?
phxtemps2
# <class 'pandas.core.frame.DataFrame'>
# DatetimeIndex: 14596 entries, 1973-01-01 00:00:00 to 2012-12-31 00:00:00
# Data columns (total 2 columns):
# highs 14596 non-null values
# lows 14596 non-null values
# dtypes: float64(2)
# happy
phxtemps2['diff'] = phxtemps2.highs - phxtemps2.lows
# sad
phxtemps2.diff = phxtemps2.highs - phxtemps2.lows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment