我正在尝试读取如下所示的简单 CSV 文件,并将其内容放入 2D 数组中:
"","x","y","sim1","sim2","sim3","sim4","sim5","sim6","sim7","sim8","sim9","sim10","sim11","sim12"
"1",181180,333740,5.56588745117188,6.29487752914429,7.4835410118103,5.75873327255249,6.62183284759521,5.81478500366211,4.85671949386597,5.90418815612793,6.32611751556396,6.99649047851562,6.52076387405396,5.68944215774536
"2",181140,333700,6.36264753341675,6.5217604637146,6.16843748092651,5.55328798294067,7.00429201126099,6.43625402450562,6.17744159698486,6.72836923599243,6.38574266433716,6.81451606750488,6.68060827255249,6.14339065551758
"3",181180,333700,6.16541910171509,6.44704437255859,7.51744651794434,5.46270132064819,6.8890323638916,6.46842670440674,6.07698059082031,6.2140531539917,6.43774271011353,6.21923875808716,6.43355655670166,5.90692138671875
为此,我使用这个:
data = np.loadtxt("Data/sim.csv", delimiter=',', skiprows=1)
但我总是收到这样的信息:
"ValueError: could not convert string to float: "1"
我认为问题出在每一行的第一列。因此,我尝试在没有第一列的情况下阅读它,但我不知道如何阅读。
那么,我怎么能忽略第一列呢?有没有办法用第一列读取这个文件?