how to prepare independent and dependent variables from dataframe

Solutions on MaxInterview for how to prepare independent and dependent variables from dataframe by the best coders in the world

showing results for - "how to prepare independent and dependent variables from dataframe"
Yanis
21 Jun 2020
1# Independent variables
2X = df.iloc[:, :-1].values
3print(X)
4
5# dependent variable y
6y = df.iloc[:,-1].values
7y