Select rows by label (.loc)

You can select the rows of a DataFrame one of two ways. One way is with df.loc[...]. df.loc[...] selects rows based on their index value. To select a single row, you can do df.loc[index_value], for example, df.loc[156]. To select multiple rows, you can do df.loc[[index_value1, index_value2]], for example, df.loc[[132, 156]].

Suppose you constructed a DataFrame by

import pandas as pd

df = pd.DataFrame({'name': ['Jeff', 'Esha', 'Jia'], 
                   'age': [30, 56, 8]},
                   index=[132, 156, 27])

Where the index value is the person id in a database.

Giving you the DataFrame

name age
132 Jeff 30
156 Esha 56
27 Jia 8

Complete the function, select_Jia_row(df), by having it return the row with Jia in it. This should involve hard-coding the index value associated with Jia.

Example Input

Code to generate input

df = pd.DataFrame({'name': ['Jeff', 'Esha', 'Jia'], 
                   'age': [30, 56, 8]},
                  index=[132, 156, 27])


Table generated

name age
132 Jeff 30
156 Esha 56
27 Jia 8

Example Output

27
name Jia
age 8