I'm trying to create an area chart with a pandas DataFrame.
Here's what I get when I plotted the data as it was imported.
debt[['Record_Date', 'Debt_Held_by_the_Public']].plot(kind='area')
I converted the "Record_Date" field to a datetime field, and I get nothing when trying to plot it.
debt['Record_Date'] = pd.to_datetime(debt['Record_Date'])
debt[['Record_Date', 'Debt_Held_by_the_Public']].plot(kind='area')
What am I doing wrong? The Record_Date was listed as an object originally. Once I converted that field, it shows up as datetime64.
This message appears when trying to make the second plot.
TypeError: The DTypes <class 'numpy.dtype[uint8]'> and <class 'numpy.dtype[datetime64]'> do not have a common DType. For example they cannot be stored in a single array unless the dtype is
object
.