我导入了一个 csv 文件,该文件都包含带指数的小数,例如 (5.5006250364943992**02)。我不断得到ValueError: could not convert string to float
。这就是我所做的:
import matplotlib.pyplot as plt
import csv
x = []
y = []
with open('DNSdata.csv', 'r') as csvfile:
plots = csv.reader(csvfile, delimiter=',')
for row in plots:
x.append(float(row[0]))
y.append(float(row[1]))
plt.plot(x, y, label='DNSdata')
plt.xlabel('x')
plt.ylabel('y')
plt.title('DNSdata')
plt.show()