Read lists into columns of pandas DataFrame

后端 未结 2 1462
囚心锁ツ
囚心锁ツ 2020-12-30 06:54

I want to load lists into columns of a pandas DataFrame but cannot seem to do this simply. This is an example of what I want using transpose() but I would thin

2条回答
  •  长发绾君心
    2020-12-30 07:45

    Here's another 1-line solution preserving the specified order, without typing x and sin(x) twice:

    data = pd.concat([pd.Series(x,name='x'),pd.Series(y,name='sin(x)')], axis=1)
    

提交回复
热议问题