pandas: index out of bounds using ix, but I can see the column

Viewed 9871

I have no idea why pandas is throwing an index out of bounds on this dataframe:

SC7a        2009    2010    2011    2012    2013    2014
Region 10   10.1    10.6    11.1    11.6    9.7     10.8
Georgia     7.5     7.4     7.8     7.6     7.2     7.1

All I am doing is calling:

df.ix[:, 2014]

And I get this error:

IndexError: index 2014 is out of bounds for axis 0 with size 6 

Note that calling loc works just fine:

df.loc[:, 2014]
SC7a
Region 10    10.8
Georgia       7.1
Name: 2014, dtype: float64

Is this a bug? Shouldn't df.loc and df.ix be interchangeable with this data?

2 Answers
Related