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

Questions & AnswersCategory: Programming LanguageWhich of the following expression returns last two rows of df, defined below? import pandas as pd 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 last two rows of df, defined below?

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

a. df.iloc[:’r3′]
b. df.loc[‘r2′:’r3’]
c. df.iloc[‘r2′:’r3′]
d. df.loc[:’r3’]