0

I want to plot date and time on x and y-axis using matplotlib. I made two columns using pd.to_datetime() on a dataframe column but I've been getting this error again and again. TypeError: float() argument must be a string or a number, not 'datetime.time' . Here is the code:

#Date and time wrangling/munging
df["Order Date & Time"] = pd.to_datetime(df["Order Date & Time"])
df["Date"] = df["Order Date & Time"].dt.date
df["New_Time"] = df["Order Date & Time"].dt.time

#display
correlation = df[["Order Status","Date","New_Time"]]
correlation.head()

​
plt.figure(figsize= (14,6))
​
correlation.plot.scatter(x="Date",
                         y="New_Time"
                         )
plt.colorbar()
​
plt.show()

I've seen the question asked by @blokeley but that solution is not working for me. I am stuck on this problem for days. Kindly help.

R. pro
  • 3
  • 3

0 Answers0