Selecting a single row and multiple columns

In this section, we will view records for a single row and multiple columns where we pass multiple columns as a list:

zillow.loc[7, ['Metro', 'County']] 

We have our values from the row with index 7 and the Metro and County columns. If we select a single row, the values will be displayed vertically, rather than horizontally. We can convert this call to use the column index rather than the column name by using the iloc method instead of loc, as follows:

zillow.iloc[7, [4,5]]

The following is the output:

Now, we will learn how to select a single row, but with values from all columns. For the columns ...

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.