很多时候审计师在发函过程中使用顺丰。
但是要求填写省、市、区信息。
如何快速、批量拆分出省、市、区信息就是我们的需求。当然还要面对本身就缺失这些信息的情况。
在github上,已经有人造出了轮子,我们直接用起来。
这里我们需要用到cpca及pandas。
在本机已经安装好python3的情况下,用ctrl+r调用cmd命令行。
pip install cpca
pip install pandas
打开input.xlsx文件,填写需要拆分的地址后关闭。
在命令行中position.py文件路径下运行代码。或者用vscode等IDE中运行。
import cpca
import pandas as pd
df=pd.read_excel('input.xlsx','Sheet1',index_col=None,na_values=['NA'])
location_str=list(df['地址'])
if location_str:
df = cpca.transform(location_str)
df.to_excel('out_put.xlsx',sheet_name='Sheet1')
print(df.head())
else:
print('请正确填写地址')
output.xlsx文件中存储着拆分结果。
由于用pyinstaller打包成exe后,不能成功运行。所以就只有这个python文件。
如果需要使用需要安装python3环境。