简体   繁体   中英

Python pandas how to write data from an array in excel

I can not write data from an array in excel.

What parameters you need to specify functions in DataFrame() ?

import pandas as pd

table = pd.read_excel("file1.xlsx", sheetname="file1")
lastval = table['lastval'].values.tolist()
newval = table['newval'].values.tolist()
rm = table['rm'].values.tolist()
itog = [0, 0, 0]

for i in range(3):
    itog[i] = (newval[i]-lastval[i]) * rm[i]
    pd.DataFrame(?????)

The function you are looking for is to_excel . Take a look at the docs here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM