1.利用savetxt函数将数据存储到文件
import numpy as np
# #读取文件
ar1=np.loadtxt('data.csv',delimiter=',',usecols=(6),unpack=True)
print(ar1)
import numpy as np
# #读取文件
ar1=np.loadtxt('data.csv',delimiter=',',usecols=(6),unpack=True)
print(ar1)
ar1,ar2=np.loadtxt('data.csv',delimiter=',',usecols=(6,7),unpack=True)
print(ar1,ar2)
读取结果:
结果1 [336.1 339.32 345.03 344.32 343.44 346.5 351.88 355.2 358.16 354.54
356.85 359.18 359.9 363.13 358.3 350.56 338.61 342.62 342.88 348.16
353.21 349.31 352.12 359.56 360. 355.36 355.76 352.47 346.67 351.99]
结果2 [336.1 339.32 345.03 344.32 343.44 346.5 351.88 355.2 358.16 354.54
356.85 359.18 359.9 363.13 358.3 350.56 338.61 342.62 342.88 348.16
353.21 349.31 352.12 359.56 360. 355.36 355.76 352.47 346.67 351.99] [21144800. 13473000. 15236800. 9242600. 14064100. 11494200.