I don't know python at all but the project I'm currently working on must be done using it, I have this r code
y_train <- subset(train_df_cleaned_2, Id==IdExec)$Y
and I need to do the exact same thing in python. How do I do it? Thank you
I don't know python at all but the project I'm currently working on must be done using it, I have this r code
y_train <- subset(train_df_cleaned_2, Id==IdExec)$Y
and I need to do the exact same thing in python. How do I do it? Thank you
The standard way of doing this in Python is comprehension, e.g.:
y_train = [x for x in train_df_cleaned_2 if x.Id == IdExec]