Introduction
Series
What DataFrames are
DataFrame columns
DataFrame rows
19. Selecting rows with loc
Filtering rows and columns
Filtering data frames
Sorting rows
Summary

Instruction

Bravo! Now that we have our custom index in place, we can select rows with loc instead of iloc. Take a look:

hospitals.loc[639204484]

Or, if you need a DataFrame:

hospitals.loc[[639204484]]

Since we set Phone Number as the new index, the code above allows us to find and return the hospital whose number is 639204484. This can be more convenient than using an integer location.

Exercise

Modify the code from the previous exercise. Select the row with index Poland and return it as a new DataFrame.

Stuck? Here's a hint!

Use double square brackets.