Python——DataFrame转list(包含两种)

import pandas as pd
df = pd.DataFrame({'a':[1,3,5,7,4,5,6,4,7,8,9],
                   'b':[3,5,6,2,4,6,7,8,7,8,9]})
df

df1 = df.values.tolist()
df1

df2 = [tuple(x) for x in df.values]
df2

posted @ 2019-11-28 23:51  v林三岁  阅读(12558)  评论(0编辑  收藏