I have floating point data in a Pandas dataframe. Each column represents a variable (they have string names) and each row a set of values (the rows have integer names which are not important).
>>> print data
0 kppawr23 kppaspyd
1 3.312387 13.266040
2 2.775202 0.100000
3 100.000000 100.000000
4 100.000000 39.437420
5 17.017150 33.019040
...
I want to plot a histogram for each column. The best result I have achieved is with the hist method of dataframe:
data.hist(bins=20)
but I want the x-axis of each histogram to be on a log10 scale. And the bins to be on log10 scale too, but that is easy enough with bins=np.logspace(-2,2,20).
A workaround might be to log10 transform the data before plotting, but the approaches I have tried,
data.apply(math.log10)
and
data.apply(lambda x: math.log10(x))
give me a floating point error.
"cannot convert the series to {0}".format(str(converter)))
TypeError: ("cannot convert the series to <type 'float'>", u'occurred at index kppawr23')