I am solving a machine learning problem using python's sklearn library
I am using pandas dataframe and i wanted to train a linear regression model using my local data and predict new values. here are my code samples.
customers= pd.read_csv('Ecommerce Customers')
X= customers[['Avg. Session Length', 'Time on App','Time on Website', 'Length of Membership']]
y=['Yearly Amount Spent']
when i try to run this below code
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=101)
it gives me an error
Found input variables with inconsistent numbers of samples: [500, 1]
in my dataset it has 500 rows and 8 columns sklearn verion is
import sklearn
format(sklearn.__version__)
'0.20.1'
pls help me . Thanks In advance