I am having trouble making this very simple example work:
from numpy import datetime64
from pandas import Series
import matplotlib.pyplot as plt
import datetime
x = Series ([datetime64("2016-01-01"),datetime64("2016-02-01")]).astype(datetime)
y = Series ([0.1 , 0.2])
ax = plt.subplot(111)
ax.bar(x, y, width=10)
ax.xaxis_date()
plt.show()
TypeError: float() argument must be a string or a number, not 'Timestamp'
astype(datetime)
datetime64
x = [datetime64("2016-01-01"),datetime64("2016-02-01")]
y = [0.1 , 0.2]
Timestamp
datetime64
Timestamp
datetime64
Series
Timestamp
DataFrame
DataFrame
FacetGrid
Use:
ax.bar(x.values, y, width=10)
when using the Series objects. The issue is that you are not sending an object that is similar to an array, it is an indexed array that matplotlib does not know how to handle. values
returns only the array