Im totally new in this field and almost everything is still a mistery to me.
I have the following data frame:
usersPerWeek date
date
2018-03-07 127 2018-03-07
2018-03-14 3177 2018-03-14
2018-03-21 8758 2018-03-21
2018-03-28 16770 2018-03-28
2018-04-04 17964 2018-04-04
And I am trying to plot this on as a simple bar chart:
import pandas as pd
import matplotlib.pyplot as plt
figPerWeek = plt.figure(dpi=80, figsize=(8,1))
axis = figPerWeek.add_subplot(1,1,1)
axis.bar(x=data.index, height=data.usersPerWeek)
This results in the error message Axis must have
freqset to convert to Periods
When I add (just before calling axis.bar
)
axis.xaxis_date()
I then get the error message 'Period' object has no attribute 'toordinal'
.
Im hoping that I am missing something really simple, but so far Google has been less than helpful.
Cheers