IceRoss
IceRoss

Reputation: 1

How to plot date data from my pandas dataframe

Hey im a beginner struggling to plot a date (x-axis) vs a float (y-axis). Im struggling to understand the matplotlib documentation around dates or find an answer on SO.

I have a pandas dataframe with a date column, dates are of format 01/02/2003 and are in order but not equally spaced.

When i plot this column against the column of values im interested in, the date and value columns are being plotted as the image shows (https://i.sstatic.net/BHkQARDz.png)

The dates are not plotting with proper spacing either.

my goal is to plot the numerical values against the dates with the dates properly spaced on the x axis

my (noob) code so far:

dates=df['Date'] values=df['Values']

plt.plot(dates,values)

Upvotes: 0

Views: 20

Answers (0)

Related Questions