“Got 1 columns instead of …” error in numpy

后端 未结 8 794
傲寒
傲寒 2021-01-17 13:00

I\'m working on the following code for performing Random Forest Classification on train and test sets;

from sklearn.ensemble import RandomForestClassifier
fr         


        
8条回答
  •  深忆病人
    2021-01-17 13:19

    It seems like the header that includes the column names have 1 more column than the data itself (1435 columns on header vs. 1434 on data).

    You could either:

    1) Eliminate 1 column from the header that doesn't make sense with data

    OR

    2) Use the skip header from genfromtxt() for example, np.genfromtxt('myfile', skip_header=*how many lines to skip*, delimiter=' ') more information found in the documentation.

提交回复
热议问题