Instruction
Alright, it's time for DataFrame rows now. If you want to select a specific row based on its position, you can use iloc[...]. This is similar to selecting an element from a Python list. iloc stands for integer location. Take a look:
hospitals.iloc[0]
| 0 | |
|---|---|
| Hospital Name | Abbeville Area Medical Center |
| City | Abbeville |
| State | SC |
| Phone Number | 8643665011 |
| Hospital overall rating | 4 |
The expression above will select the first row from the hospitals DataFrame. Again, the result will be a Series, so if you need a DataFrame, provide a list of indexes:
hospitals.iloc[[0]]
| Hospital Name | City | State | Phone Number | Hospital overall rating | |
|---|---|---|---|---|---|
| 0 | Abbeville Area Medical Center | Abbeville | SC | 8643665011 | 4 |
Exercise
Select the third row of eu_states as a new DataFrame.
Stuck? Here's a hint!
Remember that the third row has an index value of 2.



