Assume we’re starting with a singular dataframe that includes the dependent and independent variables.
# split into dependent (y) and independent (X) variables
target_field = '<field name of dependent variable>'
X = dat_sub.drop(labels = target_field, axis = 1)
y = dat_sub.loc[:, target_field]