0
我想将值绘制到X和Y轴上。我不想把图中的任何数据,只是标注轴心国与时间和DID(如下图所示)将字符串转换为浮点数
这里是我的代码:
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]
print(Time)
DID = df.ix[1, 6:13]
print(DID)
ax1 = plt.subplot2grid((6,6), (0,0), rowspan=6, colspan=6)
ax1.plot(Time)
plt.show()
,我收到此错误:
could not convert string to float
我想要放在x和y轴上的是字母,而不是数字,所以这个错误是有效的。我该如何解决这个问题?有没有简单的方法来绘制这些DID和时间从图中没有得到这个错误?
此外,我是python新手,一般编码,所以如果我的问题不清楚,请让我知道,我会尽我所能来解决它。
错误来自哪里? – rassar
我感谢你没有得到一个答案,上次你问这个问题,但你仍然不应该重复你的问题http://stackoverflow.com/questions/43806027/could-not-convert-string-to-float-error –