import pandas as pd import numpy as np df = pd.DataFrame(np.arange(10).reshape(5,2),index=list("cvbnm"),columns=list('AB')) print(df) print("-----------------------------------------") print(df.iloc[[2]])#iloc根据下标找元素 print("-----------------------------------------") print(df.loc[["c"]])#loc根据行名找元素