Pandas Series to Excel

后端 未结 2 1869
暖寄归人
暖寄归人 2021-01-02 14:13

The pandas.Series object does have many to_* functions, yet it lacks a to_excel function. Is there an easier/better way to accomplish the export in line 3 of th

2条回答
  •  难免孤独
    2021-01-02 14:24

    You can either:

    1. construct a DataFrame from the start,

    in which case you've already answered your own question.

    2. Use Series.to_frame()

    s.to_frame(name='column_name').to_excel('xlfile.xlsx', sheet_name='s')
    

提交回复
热议问题