'Remove rows from X_train and y_train at once
I'm absolutely new in python, so there is a question.
I've splitted my original df to X_train, y_train, X_test, y_test. Now i want to drop from y_train (pd.series) outliers therefore i need to remove object with same index from X_train(pd.df). What is the easiest and cleanest way to do it?
Solution 1:[1]
try using y_train = y_train[X_train_new.index] where X_train_new is your new X_train after dropping some columns/row/outliers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | N A Adam |
