“Got 1 columns instead of …” error in numpy

后端 未结 8 705
傲寒
傲寒 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:29

    In my case, the error aroused due to having a special symbol in the row.

    Error cause: having special characters like

    • '#' hash
    • ',' given the fact that your ( delimiter = ',' )

    Example csv file

    • 1,hello,#this,fails
    • 1,hello,',this',fails

      -----CODE-----

      import numpy as numpy data = numpy.genfromtxt(file, delimiter=delimeter) #Error

    Environment Note:

    OS: Ubuntu

    csv editor: LibreOffice

    IDE: Pycharm

提交回复
热议问题