Reputation: 13
I have a DataFrame with an Index (Time) and one column (Rate). I'd just like to use the Time as the x-ticks in a histogram plot and Rate as the y axis.
Here is what I've got so far:
data = pd.DataFrame.from_dict(rates,orient='index')
data.index.name = 'Time'
data.columns = ['Rate']
data.plot(kind='hist', x = data.index.values)
print(data)
produces:
Rate
Time
0 1.191309
1 1.208280
2 1.244835
3 1.279342
4 1.307912
5 1.532720
Upvotes: 1
Views: 1495
Reputation: 210842
Demo:
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
Source DF:
In [122]: data
Out[122]:
Rate
Time
0 1.191309
1 1.208280
2 1.244835
3 1.279342
4 1.307912
5 1.532720
In [126]: data.plot.bar(rot=0)
Out[126]: <matplotlib.axes._subplots.AxesSubplot at 0xe1fe048>
In [131]: data.plot.hist(rot=0)
Out[131]: <matplotlib.axes._subplots.AxesSubplot at 0xe7611d0>
Upvotes: 1