Error in Python script “Expected 2D array, got 1D array instead:”?

后端 未结 9 737
执念已碎
执念已碎 2020-11-30 01:29

I\'m following this tutorial to make this ML prediction:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style

style.use(\"ggplot\         


        
9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 01:57

    The X and Y matrix of Independent Variable and Dependent Variable respectively to DataFrame from int64 Type so that it gets converted from 1D array to 2D array.. i.e X=pd.DataFrame(X) and Y=pd.dataFrame(Y) where pd is of pandas class in python. and thus feature scaling in-turn doesn't lead to any error!

提交回复
热议问题