How to fix “ValueError: Expected 2D array, got 1D array instead” in sklearn/python?

后端 未结 3 839
鱼传尺愫
鱼传尺愫 2021-01-13 21:51

I there. I just started with the machine learning with a simple example to try and learn. So, I want to classify the files in my disk based on the file type by making use of

3条回答
  •  甜味超标
    2021-01-13 22:32

    A Simple solution that reshapes it automatically is instead of using:

    X=dataset.iloc[:, 0].values
    

    You can use:

    X=dataset.iloc[:, :-1].values
    

    that is if you only have two column and you are trying to get the first one the code gets all the column except the last one

提交回复
热议问题