Reputation: 51
I would like to plot values onto the X and Y axis'. I do not want to put any data in the graph, just label the Axis' with Time and DID(As seen below)
Here is my code:
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
df = pd.read_csv('Test_Sheet_1.csv')
Time = df.ix[8:, 1]
DID = df.ix[1, 6:13]
ax1 = plt.subplot2grid((6,6), (0,0), rowspan=1, colspan=6)
ax1.plot(Time)
plt.show()
and i receive this error:
Could not convert string to float.
yes what i am trying to put on the x, and y axis are letters, not numbers, so this error is valid. how do i fix this problem? Is there any easy way to plot these DID's and Times from the graph without getting this error?
Also, i am new to python, and coding in general, so if my question isnt clear please let me know, and i will try my best to fix it.
Thank you very much!
Upvotes: 1
Views: 1251
Reputation: 19957
The Time column may not be of type DateTime.
Will this work with an explicit conversion?
ax1.plot(pd.to_datetime(Time))
Upvotes: 1