IndexError: tuple index out of range(XGBoost)

I am new to programming and data analysis. I am struggling with this issue. I am trying to predict weekly sales of a bunch of stores. I want to use XGBoost but I keep running into this error:

IndexError: tuple index out of range

My code:

    from sklearn.model_selection import train_test_split

features = ["Store",'Dept','Temperature','Fuel_Price','CPI','Unemployment']

y = allmergecopy.Weekly_Sales
X = allmergecopy[features]
X_train, y_train, X_valid, y_valid = train_test_split(y,X,test_size=.2, train_size=.8)

from xgboost import XGBRegressor

my_model = XGBRegressor(n_estimators=100)
my_model.fit(X_train, y_train)

For reference:

y_train.shape = (84314,), X_train.shape = (337256,). I am fumbling around in the dark, I have no idea what to do. As I said, I am VERY new to data analysis. This is my first project.



Read more here: https://stackoverflow.com/questions/65724331/indexerror-tuple-index-out-of-rangexgboost

Content Attribution

This content was originally published by Malcom Lewis at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: