# split variables by predictors and target X = df_train.iloc[:,:-1] y = df_train.iloc[:,-1] # train rf model clf = RandomForestClassifier(max_depth=2, random_state=0).fit(X, y)