简体   繁体   中英

Error when transferring dataframe to excel in python

when I want to save in xls format, the error is:

ModuleNotFoundError: No module named 'xlwt'

when I want to save in xlsx format, the error is:

ModuleNotFoundError: No module named 'openpyxl'

So how to install both of the module?

Make sure your venv is activated and type pip install xlwt openpyxl and then this should work.

If it doesn't Excel can import CSVs, as created by data_frame.to_csv; so you can try that.

If neither works, put up a sample of your dataframe and leave a comment.

pip install xlwt
pip install openpyxl 

note: you can add data to xlsx file using openpyxl and append data to already existing xlsx file using openpyxl

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