0

So I have created a graph where my x-axis is in dates. My struggle is that I've used the code

np.arange(0,160,30)

and then

plt.xticks(np.arange(0,160,30),labels=x[np.arange(0,160,30)])

to separate the axis into months. But as we know, the months dosen't have the same amount of days. So now my axis is divided in 01-NOV, 01-DEC, 31-DEC, 30-JAN, 29-FEB, 30-MAR. I want to find a way to arrange the axis so instead of this, I have 01-NOV, 01-DEC, 01-JAN, 01-FEB, 01-MAR, 01-APR. I'm quite new to python, and I've been trying to convert my column within the dataframe to datetime, but can't seem to get it right.

  • Does [this](https://stackoverflow.com/questions/60901743/numpy-arange-with-spesific-datetime-given-by-month-interval) answer your question? – bottledmind Jan 11 '22 at 10:06
  • You should use something like this: pd.date_range('2019-01-01','2019-12-31',freq='MS') – David Jan 11 '22 at 10:08
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – itprorh66 Jan 19 '22 at 18:43

0 Answers0