I have a column that has time like 9:3:15 (no leading 0s) (3 mins and 15 sec past 9). I would like to plot this (no date, just time) on the x axis. so i tried the following code:
def data_vis(dayN):
plt.subplots_adjust(bottom=0.2)
plt.xticks( rotation=25 )
ax=plt.gca()
#ax.xaxis_date()
xfmt = md.DateFormatter('%H:%MM:%S')
ax.xaxis.set_major_formatter(xfmt)
plt.plot_date(md.date2num(dayN["Time Stamp"]),dayN["Temperature(deg C)"])
plt.show()
I got the following error:
DateFormatter found a value of x=0, which is an illegal date; this usually occurs because you have not informed the axis that it is plotting dates, e.g., with ax.xaxis_date()
with ax.xaxis_date()
enabled, I got the below error.
'str' object has no attribute 'toordinal'
Since that columns was "str", I thought of using
pd.to_datetime(day2["Time Stamp"], format = '%H:%M:%S)
but it results in the below output:
1900-01-01 09:51:33
Now I would like to try datetime.datetime.strptime
using map and/or lambda function for the above said column..
Any help regarding implementation of map function and plotting the data would be really helpful.Also wil the datetime.strptime
help in resolving the problem?
thanks,