Problem:
I made a Pandas DataFramedfwith a float index. Everything worked fine, including
df.plot()But when I tried to do
pylab.exp(df.index.values)I got the mysterious error
AttributeError: exp
Explanation:
It turns out that Pandas' index is restricted to int64 and 'object' and sodf.index.valuesreturns an
'object'type array with exp can't interpret. We need to explicitly cast it as
'float'to get things to work :
pylab.exp(df.index.values.astype('float'))
Comments
Post a Comment