I have a time series data set and I need to plot different kinds of graph from it. With the following command I am extracting the day of the year from my data set:
train[âDayOfYearâ] = train[âDatesâ].map(lambda x: x.strftime("%m-%d")),
And when I plotted it with iplot:
âiplot(daysofayear.iplot(asFigure=True,
kind=âscatterâ,
xTitle=âDays of a yearâ,
yTitle=âTotal crime countâ,
title=âSan Francisco crime countâ))â
I get:
As you can see the X axis is showing the days of year starting from 2001, but my data is starting from 2003. At the same time the X axis should show days of the year (i.e., 01-01âŚ). I have tired to remove the index and make a new df with out index and plot it with:
iplot({âdataâ: [ Scatter(x=days[âindexâ], y=days[âTotalCountâ] )]})
But this also give me the same wrong plot. On the other hand, When I plot the same dataset with subplots() I get the correct X axis
I should point out that when I use âdt.yearâ to get for instance the counts for year the x axis comes our correctly.
Please let me know if you have any idea how to fix this issue.