Matplotlib: Scatterplot with dates and numeric values

Viewed 7169

I want to produce a simple scatter plot with dates in the X axis and numeric values in the Y axis and I'm getting a type promotion error. the data comes from a pandas dataframe.

Here's a small dump of the values I have in

X (a Pandas Series):

....
179   2016-11-08 18:03:00
180   2016-11-08 18:16:00
181   2016-11-08 18:18:00
182   2016-11-08 18:19:00
183   2016-11-08 18:20:00
184   2016-11-08 18:21:00

Name: date, Length: 185, dtype: datetime64[ns]

The Y axis is not a problem:

....
180    18.266667
181    18.300000
182    18.316667
183    18.333333
184    18.350000

Length: 185, dtype: float64

If I do:

plt.scatter(X,Y)
plt.show()

I get a type promotion error. Thanks for the help!

1 Answers
Related