我正在尝试读取一个简单的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"
我以为这个问题是每行的第一列.所以,我试着看没有第一列,但我不知道如何.
那么,怎么忽略第一列?有没有办法用第一列读取这个文件?