The simple way is to use pandas的to_excel方法转化成.xlsx文件,因为.xlsxThe default encoding supports Excel by default. The difference is of course that it cannot be opened with Notepad.
import pandas as pd
a = pd.read_csv('./test.csv')
a.to_excel('./test_output.xlsx', index=False)
a.to_excel('./test_output.csv', index=False)
I don’t have windows here to test, you can try to write the encoding as gb2312或者gbk.
For table file I/O, pandas is actually more convenient.
The simple way is to use
pandas
的to_excel
方法转化成.xlsx
文件,因为.xlsx
The default encoding supports Excel by default. The difference is of course that it cannot be opened with Notepad.I don’t have windows here to test, you can try to write the encoding as
gb2312
或者gbk
.For table file I/O, pandas is actually more convenient.
abs1=abs1.decode().encode('gbk')
Excel uses GBK encoding by default.
Create a new excel file, then click Data from text to import the csv file