Which of the following expression returns the second row of df, defined below? import pandas df = pd.DataFrame({'A':[34, 78, 54], 'B':[12, 67, 43]}, index=['r1', 'r2', 'r3'])

Questions & AnswersCategory: Programming LanguageWhich of the following expression returns the second row of df, defined below? import pandas df = pd.DataFrame({'A':[34, 78, 54], 'B':[12, 67, 43]}, index=['r1', 'r2', 'r3'])
Adam asked 2 years ago

Which of the following expression returns the second row of df, defined below?

import pandas

df = pd.DataFrame({'A':[34, 78, 54], 'B':[12, 67, 43]}, index=['r1', 'r2', 'r3'])

a. df.loc[1]
b. df[1]
c. df.iloc[‘r2’]
d. df.iloc[1]