1 change_set.csv
utf-8格式
no,file_from,format_from,file_to,format_to,,ANSI = mbcs,UTF-8 = utf-8,UTF-8 with BOM = utf-8-sig
1,1.csv,ANSI,1_.csv,utf-8,,,,
2,1.csv,ANSI,1_1.csv,utf-8-sig,,,,
2 python
import pandas as pd
fileName = 'change_set.csv' # class id cid and data file name in set.csv
mset = pd.read_csv(fileName,header=0) # get set info
for k in mset['no']:
print(k)
file_from = mset['file_from'][k-1]
file_to = mset['file_to'][k-1]
format_from = mset['format_from'][k-1]
format_to = mset['format_to'][k-1]
d = pd.read_csv(file_from,sep=',',encoding=format_from,header=None)
print(d)
d.to_csv(file_to,
header = None, index=False,
encoding=format_to,errors='ignore')
pyinstaller --onefile -i "logo.ico" .\format_batch_change.py
version
python -V
Python 3.9.12
pd.show_versions()
------------------
commit : 4bfe3d07b4858144c219b9346329027024102ab6
python : 3.9.12.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22000
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : Chinese (Simplified)_China.936
pandas : 1.4.2
numpy : 1.21.5
pytz : 2021.3
dateutil : 2.8.2
pip : 21.2.4
setuptools : 61.2.0
Cython : 0.29.28
pytest : 7.1.1
hypothesis : None
sphinx : 4.4.0
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.8.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 8.2.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.4
brotli :
fastparquet : None
fsspec : 2022.02.0
gcsfs : None
markupsafe : 2.0.1
matplotlib : 3.5.1
numba : 0.55.1
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
snappy :
sqlalchemy : 1.4.32
tables : 3.6.1
tabulate : 0.8.9
xarray : 0.20.1
xlrd : 2.0.1
xlwt : None
zstandard : None