這是我在編輯代碼:我的代碼顯示無效的文字浮法()
import matplotlib.pyplot as plt
import numpy as np
x,y = np.loadtxt('D:\Tanjil\Python\directory\Matplot_trial1.csv',
unpack=True , delimiter='\s')
plt.plot(x,y,'r',label='angle=30 Degree'),
plt.ylabel('Power Input (kW)'),
plt.xlabel('Speed(rpm)'),
plt.axis([750.0, 1400.0, 3.3,3.8])
plt.title('Power Input vs. Speed curve')
plt.legend()
plt.show()
話,就說明這一點:
File "<ipython-input-19-abec5f4efd27>", line 6, in <module>
unpack=True , delimiter='\s')
File "C:\Users\bad_tanjil\Anaconda\lib\site-packages\numpy\lib\npyio.py", line 860, in loadtxt
items = [conv(val) for (conv, val) in zip(converters, vals)]
ValueError: invalid literal for float(): 1350,3.64
您可以給出一個示例文件,其結構與「D:\ Tanjil \ Python \ directory \ Matplot_trial1.csv」相同,以獲得更詳細的幫助。 –