變更

跳到: 導覽搜尋

使用Pandas添加List

已移除 4 位元組, 2023年2月19日 (日) 08:42
撤销51.142.191.92讨论)的版本8745
在Python中使用以下代码将循环生成的列表依次添加为DataFrame的一行,并导出到Excel表格里面。
<syntaxhighlight lang="python" line>
import pandas as pd
df = pd.DataFrame()
df.to_excel(r'C:\GITPythonLesson\num.xlsx',sheet_name='Sheet1',engine='openpyxl')
</syntaxhighlight>
 
输出结果为下图:
[[File:PandasAppendList1.png]]
1,138
次編輯

導覽選單