Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left

04 D 14 H : 53 M : 24 S   Apply Now

End-to-End ML Project- Beginner friendly

51 / 94

Generating test set- Locating data

Finally, we use the loc() attribute of the DataFrame object to access the DataFrame by training and testing index. Its syntax is-

df_name.loc[indices]

where df_name is the name of our DataFrame object and indices can be a single index or an array-like. In our case it is array-like.

INSTRUCTIONS

Call the loc() attribute on our DataFrame housing providing train_ind and test_ind as indices for generating the training and testing dataset. Store the training data in a variable strat_train_set and testing data in a variable strat_test_set.



Note - Having trouble with the assessment engine? Follow the steps listed here

Please login to comment

0 Comments

There are 11 new comments.