How to generate a list from a pandas DataFrame with the column name and column values?

前端 未结 5 1231
旧时难觅i
旧时难觅i 2021-02-02 14:00

I have a pandas dataframe object that looks like this:

   one  two  three  four  five
0    1    2      3     4     5
1    1    1      1     1     1
5条回答
  •  臣服心动
    2021-02-02 14:46

    Simplest way is probably list(dt.T.itertuples()) (where dt is your dataframe). This generates a list of tuples.

提交回复
热议问题