import pandas as pd
df = pd.DataFrame(data=[[1,2,3],[2,3,4]],columns=list('abc'))
for i in range(len(df)):
row = df.iloc[i].values.tolist()
print(row)
或者
for i in range(len(df)):
index_val = df.index[i]
row = df.loc[index_val].values.tolist()
print(row)
打印结果是:
[1 2 3]
[2 3 4]