av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

教你使用Pandas直接核算Excel中的快遞費(fèi)用

瀏覽:135日期:2022-05-07 09:21:37
目錄一、確定核算規(guī)則二、根據(jù)核算規(guī)則編寫代碼,生成核算列三、輸入賬單,進(jìn)行核算。一、確定核算規(guī)則

教你使用Pandas直接核算Excel中的快遞費(fèi)用

二、根據(jù)核算規(guī)則編寫代碼,生成核算列

# -*- coding:utf-8 -*- import pandas as pd from math import ceilimport osdef account(adress,weight):if adress == '湖南':if weight <= 3: totel = 2.5elif (weight >= 3) and (weight<=5): totel = 3.5 + ceil((weight-3))*1else: totel = ceil(weight)*1return totelelif adress in ['河北','天津','山西','浙江','江蘇','安徽','福建','山東','江西','廣東','廣西','河南','湖北','陜西','四川','重慶','云南','貴州']:if weight <= 3: totel = 2.5elif (weight >= 3) and (weight<=5): totel = 3.5 + ceil((weight-3))*1else: totel = ceil(weight)*2 return totelelif adress in ['深圳','北京','上海']:if weight <= 3: totel = 3.3elif (weight >= 3) and (weight<=5): totel = 3.5 + ceil((weight-3))*1.5else: totel = ceil(weight)*2return totelelif adress in ['海南','遼寧','黑龍江','吉林']:if weight <= 3: totel = 2.5elif (weight >= 3) and (weight<=5): totel = 3.5 + ceil((weight-3))*2.5else: totel = ceil(weight)*3return totel elif adress in ['內(nèi)蒙古','甘肅','寧夏','青海']:if weight <= 1: totel = 9else: totel = 9 + ceil(weight-1)*6 return totel elif adress == '新疆':if weight <= 1: totel = 15else: totel = 15 + ceil(weight-1)*12 return totel elif adress == '西藏':if weight <= 1: totel = 16else: totel = 15 + ceil(weight-1)*18 return totelelse:print('你輸入的省份不合法!!!') file_path = input('請(qǐng)輸入文件路徑:') sheet_name = input('請(qǐng)輸入工作簿名稱:')pf = pd.read_excel(file_path,sheet_name=sheet_name)#獲取省份一列pro = pf['省份'].values.tolist()#獲取重量一列wt = pf['重量'].values.tolist()#核算列totel = []for p,w in zip(pro,wt): print(p,w) totel.append(account(p,w))pf['最新核算結(jié)果'] = totelfile_name = os.path.basename(file_path)pf.to_excel(os.path.join(os.path.dirname(file_path),os.path.basename(file_path).split('.')[0]+sheet_name+'最新核算結(jié)果'+'.xlsx'))三、輸入賬單,進(jìn)行核算。

教你使用Pandas直接核算Excel中的快遞費(fèi)用

在腳本文件目錄中執(zhí)行pyinstaller -F hesuan.py 進(jìn)行打包exe文件,如果為安裝pyinstaller,使用pip install pyinstaller 安裝。點(diǎn)擊運(yùn)行打包后的exe文件,輸入文件的路徑名和sheet名,就可以進(jìn)行自動(dòng)核算,腳本運(yùn)行完成后會(huì)自動(dòng)保存一個(gè)新的Excel文件。

教你使用Pandas直接核算Excel中的快遞費(fèi)用教你使用Pandas直接核算Excel中的快遞費(fèi)用

教你使用Pandas直接核算Excel中的快遞費(fèi)用

到此這篇關(guān)于教你使用Pandas直接核算Excel中快遞費(fèi)用的文章就介紹到這了,更多相關(guān)Pandas核算Excel中快遞費(fèi)用內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: excel
相關(guān)文章:
主站蜘蛛池模板: 亚洲成人免费电影 | 欧美精品三区 | 三级av在线 | 国产丝袜一区二区三区免费视频 | 天天射网站 | 国产精品一区二区三区久久 | 国产日韩av一区二区 | 在线国产一区二区 | 成年免费大片黄在线观看岛国 | 久草视频观看 | 欧美日韩国产三级 | 欧美精品久久 | 国产精品一区久久久 | av电影一区| 欧美日本一区 | 在线观看av不卡 | 久久亚洲一区二区三区四区 | 国产乱一区二区三区视频 | 99re热精品视频 | 婷婷激情综合 | 爱爱免费视频 | 国产无套一区二区三区久久 | 色偷偷噜噜噜亚洲男人 | 毛片在线免费播放 | 欧美中文字幕一区二区三区亚洲 | 久久成人精品一区二区三区 | 日日干夜夜干 | 欧美在线不卡 | 久久一级免费视频 | 国产免费自拍 | 欧美日韩一卡二卡 | 日韩中字幕 | 精品国产视频 | 久久久精品久 | 亚洲精品视频一区二区三区 | 亚洲欧美日韩电影 | 亚洲国产情侣自拍 | 人人鲁人人莫人人爱精品 | 日韩国产在线观看 | 韩日在线视频 | 亚洲精品久久久久久一区二区 |