pandaboy玩pandas
基于python的三方库pandas的excel表二次开发
import numpy as np
import pandas as pd
import time
from pandas import merge
import openpyxl
import datetime
Date = input('请输入日期:')
def html_to_excel():
with open(r'C:\Users\g\Desktop\CUX:缺件统计表_160618.xls','rb') as f:
df_o = pd.read_html(f.read())
print('数据表正在合并!')
bb = pd.ExcelWriter('F:\缺件表.xlsx')
df_o[0].to_excel(bb)
bb.close()
'''
1.删除掉订单类型是SO的产线且是13开头的数据,再定义SO为紧急要料
2.按物料、产线对实际缺件数求和,并输出所有行>>>df_inner1
'''
# df=pd.DataFrame(pd.read_excel('YC_扬柴主机缺.xlsx'))
# print(df)
# Url = 'C:\Users\g\Desktop\CUX:缺件统计表_140618.xlsx'
# Url = input('请输入文件名:')
def change_excel():
# df = pd.read_excel(r'C:\Users\g\Desktop\CUX:缺件统计表_150618.xlsx',sheet_name=0,header=7)
df = pd.read_excel('F:\缺件表.xlsx', sheet_name=0, header=8)
# df['需求日期'] = df['需求日期'].astype(str)
df['需求日期'] = pd.to_datetime(df['需求日期'], format='%Y-%m-%d %H:%M:%S',errors='coerce')
# print(df.head())
# print(df.info())
# df['产线'] = df['产线'].astype('object')
df1 = df[(~df['产线'].isin([130000007.0,130000001.0,130000002.0,130000003.0,130000005.0,130000021.0,130000022.0,130000023.0,130000024.0]))&(df['订单类型']=='SO')]
df2 = df[df['订单类型']!='SO']
df = df1.append(df2)
print('数据表合并已完成!')
#######################逻辑处理有问题,excel导出有问题########################
#######################以上BUG已经修复#########################################
df['产线'] = df['产线'].replace(130000001.0, '485装配线')
df['产线'] = df['产线'].replace(130000007.0, '随机附件')
df['产线'] = df['产线'].replace(130000002.0, '4102装配线')
df['产线'] = df['产线'].replace(130000003.0, 'VM装配线')
df['产线'] = df['产线'].replace(130000005.0, '整理线')
df['产线'] = df['产线'].replace(130000021.0, '二号厂装配线')
df['产线'] = df['产线'].replace(130000022.0, '二号厂试车线')
df['产线'] = df['产线'].replace(130000023.0, '二号厂成套线')
df['产线'] = df['产线'].replace(130000024.0, '二号厂随机附件')
df['产线'] = df['产线'].replace(130000600.0, '外协件销售出库')
df['产线'] = df['产线'].replace(930000001.0, '制造工程部')
df['产线'] = df['产线'].replace(930000002.0, '铸造厂')
df['产线'] = df['产线'].replace(930000003.0, '金加工厂')
df['产线'] = df['产线'].replace(930000004.0, '金加工厂机体线')
df['产线'] = df['产线'].replace(930000005.0, '装配厂')
df['产线'] = df['产线'].replace(930000006.0, '装配厂102线')
df['产线'] = df['产线'].replace(930000007.0, '装配厂85线')
df['产线'] = df['产线'].replace(930000008.0, '装配厂VM线')
df['产线'] = df['产线'].replace(930000009.0, '调试厂产线')
df['产线'] = df['产线'].replace(930000010.0, '调试厂生产')
df['产线'] = df['产线'].replace(930000011.0, '调试厂设修')
df['产线'] = df['产线'].replace(930000012.0, '质量部设修')
df['产线'] = df['产线'].replace(930000013.0, '质量部市场')
df['产线'] = df['产线'].replace(930000014.0, '质量部检验')
df['产线'] = df['产线'].replace(930000015.0, '技术中心')
df['产线'] = df['产线'].replace(930000016.0, '应用工程部')
df['产线'] = df['产线'].replace(930000017.0, '产品试验中心')
df['产线'] = df['产线'].replace(930000018.0, '平台开发')
df['产线'] = df['产线'].replace(930000019.0, '物流部')
df['产线'] = df['产线'].replace(930000020.0, '二号工厂机体加工线')
df['产线'] = df['产线'].replace(930000021.0, '二号工厂缸盖加工线')
df['产线'] = df['产线'].replace(930000022.0, '二号工厂装配线')
df['产线'] = df['产线'].replace(930000023.0, '二号工厂试车线')
df['产线'] = df['产线'].replace(930000024.0, '二号工厂成套线')
df['产线'] = df['产线'].replace(930000025.0, '二号工厂机体加工线设修')
df['产线'] = df['产线'].replace(930000026.0, '二号工厂缸盖加工线设修')
df['产线'] = df['产线'].replace(930000027.0, '二号工厂装配线设修')
df['产线'] = df['产线'].replace(930000028.0, '二号工厂试车线设修')
df['产线'] = df['产线'].replace(930000029.0, '二号工厂试车线生产工具')
df['产线'] = df['产线'].replace(930000030.0, '二号工厂成套线设修')
df['产线'] = df['产线'].replace(930000031.0, '调试厂校机维修')
df['产线'] = df['产线'].replace(930000032.0, '配件加工生产')
df['产线'] = df['产线'].replace(930000033.0, '材料、零部件让售')
df['产线'] = df['产线'].replace(930000034.0, '装配厂102线改型')
df['产线'] = df['产线'].replace(930000035.0, '装配厂85线改型')
df['产线'] = df['产线'].replace(930000036.0, '装配厂VM线改型')
df['产线'] = df['产线'].replace(930000037.0, '调试厂产线改型')
df['产线'] = df['产线'].replace(930000038.0, '二号工厂装配线改型')
df['产线'] = df['产线'].replace(930000039.0, '二号工厂试车线改型')
df['产线'] = df['产线'].replace(930000040.0, '二号工厂成套线改型')
df['产线'] = df['产线'].replace(930000041.0, '装配厂102线补废')
df['产线'] = df['产线'].replace(930000042.0, '装配厂85线补废')
df['产线'] = df['产线'].replace(930000043.0, '装配厂VM线补废')
df['产线'] = df['产线'].replace(930000044.0, '调试厂产线补废')
df['产线'] = df['产线'].replace(930000045.0, '二号工厂装配线补废')
df['产线'] = df['产线'].replace(930000046.0, '二号工厂试车线补废')
df['产线'] = df['产线'].replace(930000047.0, '二号工厂成套线补废')
df['产线'] = df['产线'].replace(930000048.0, '随机附件补充领用')
df['产线'] = df['产线'].replace(np.nan, '未定义')
df['保管员'] = df['保管员'].replace(np.nan,'未定义')
df['订单类型'] = df['订单类型'].replace('MO','一次下架')
########################################################
df['订单类型'] = df['订单类型'].replace('SO','紧急要料')
########################################################
# df_inner = df.groupby('实际缺件数')['物料'].count()
# 对city字段进行汇总,并分别计算prince的合计和均值
# df_inner.groupby('city')['price'].agg([len,np.sum, np.mean])
# df[df['creativeID']<=10000]
###########################################################
# print(df.head())
# df.to_excel('F:\excel_to_python.xlsx', sheet_name='gg')
##############导出操作###################################
'''
以上已经完成保管员的数据表
下一步需要处理
1.获取物料、产线、订单类型维护汇总的缺件总数(完成)
2.合并表的内容(完成)
3.获取指定日期的缺件数()
'''
# df_inner1.to_excel('F:\kk.xlsx', sheet_name='gg')
# df['产线'] = df['产线'].replace('485装配线','485装配线')
# df['产线'] = df['产线'].replace('随机附件','随机附件')
# df['产线'] = df['产线'].replace('4102装配线','4102装配线')
# df['产线'] = df['产线'].replace('VM装配线','VM装配线')
# df['产线'] = df['产线'].replace('整理线','整理线')
# df['产线'] = df['产线'].replace('二号厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号厂成套线','二号厂成套线')
# df['产线'] = df['产线'].replace('二号厂随机附件','二号厂随机附件')
# df['产线'] = df['产线'].replace('外协件销售出库','外协件销售出库')
# df['产线'] = df['产线'].replace('制造工程部','制造工程部')
# df['产线'] = df['产线'].replace('铸造厂','铸造厂')
# df['产线'] = df['产线'].replace('金加工厂','金加工厂')
# df['产线'] = df['产线'].replace('金加工厂机体线','金加工厂')
# df['产线'] = df['产线'].replace('装配厂','4102装配线')
# df['产线'] = df['产线'].replace('装配厂102线','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线','整理线')
# df['产线'] = df['产线'].replace('调试厂生产','整理线')
# df['产线'] = df['产线'].replace('调试厂设修','整理线')
# df['产线'] = df['产线'].replace('质量部设修','质量部')
# df['产线'] = df['产线'].replace('质量部市场','质量部')
# df['产线'] = df['产线'].replace('质量部检验','质量部')
# df['产线'] = df['产线'].replace('技术中心','技术中心')
# df['产线'] = df['产线'].replace('应用工程部','技术中心')
# df['产线'] = df['产线'].replace('产品试验中心','技术中心')
# df['产线'] = df['产线'].replace('平台开发','技术中心')
# df['产线'] = df['产线'].replace('物流部','物流部')
# df['产线'] = df['产线'].replace('二号工厂机体加工线','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线','二号工厂成套线')
# df['产线'] = df['产线'].replace('二号工厂机体加工线设修','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线设修','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线设修','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线设修','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂试车线生产工具','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线设修','二号工厂成套线')
# df['产线'] = df['产线'].replace('调试厂校机维修','校机维修')
# df['产线'] = df['产线'].replace('配件加工生产','配件加工')
# df['产线'] = df['产线'].replace('材料、零部件让售','材料、零部件让售')
# df['产线'] = df['产线'].replace('装配厂102线改型','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线改型','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线改型','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线改型','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线改型','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线改型','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线改型','二号工厂成套线')
# df['产线'] = df['产线'].replace('装配厂102线补废','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线补废','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线补废','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线补废','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线补废','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线补废','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线补废','二号工厂成套线')
# df['产线'] = df['产线'].replace('随机附件补充领用','随机附件')
df_inner1 = df.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner1.rename(columns={'sum':'缺件总数','订单类型':'业务类型'}, inplace=True)
# 物料 产线 订单类型 缺件总数 ----物料说明 ----保管员
# 01119248 随机附件 一次下架 190
# 1000045386 二号厂装配线 一次下架 1
# 1000047928 485装配线 一次下架 8
# 1000050574 调试厂产线改型 紧急要料 6
# 1000069366 485装配线 一次下架 68
# 1.获取物料、产线、订单类型维护汇总的缺件总数完成
# df_inner1.to_excel('F:\k1k.xlsx', sheet_name='gg',index=False)
#############################################################################
print('数据表逻辑处理已完成!')
Date_1 = datetime.datetime.strptime(Date, '%Y-%m-%d')
df4 = df[df['需求日期']==Date_1]
df_inner2 = df4.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner2.rename(columns={'sum':'当日缺件数','订单类型':'业务类型'}, inplace=True)
# print(df_inner2.head())
result = pd.merge(df_inner1, df_inner2, how='left', on=['物料'])
result = result.drop(columns = ['产线_y','业务类型_y','物料说明_y','保管员_y'])
result.rename(columns={'产线_x':'产线','业务类型_x':'业务类型','物料说明_x':'物料说明','保管员_x':'保管员'}, inplace=True)
result = result.groupby(['物料','物料说明','保管员','当日缺件数'])['缺件总数'].agg([np.sum]).reset_index()
result.rename(columns={'sum':'缺件总数'}, inplace=True)
# result = result.sort(columns='保管员', ascending=False)
print(result.head())
print('所有任务均已完成!')
'''
1.增加导出表的日期功能(完成)
2.在缺件表上显示日期
3.按保管员自动打印
[加分项]:按产线维度汇总
[超级加分项]:检测存在缺件时才汇总(涉及到递归算法,难度大,要重写算法)
'''
result.to_excel('F:\缺件统计表{!s}.xlsx'.format(Date), sheet_name='缺件总表',index=False)
return 'The Job is Finished'
if __name__ == '__main__':
html_to_excel()
time.sleep(5)
change_excel()
emmm
import numpy as np
import pandas as pd
import time
from pandas import merge
import datetime
import tkinter as tk
from tkinter import filedialog
Date = input('请输入日期:')
def html_to_excel():
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
print('已经选择的文件路径是:'+file_path)
with open(file_path,'rb') as f:
df_o = pd.read_html(f.read())
# print(df_o)
print('数据表正在合并!')
bb = pd.ExcelWriter('F:\缺件表.xlsx')
df_o[1].to_excel(bb) #一个超级大坑,随缘排错法,之前是df_o[0]>>>df_o[1]
bb.close()
'''
1.删除掉订单类型是SO的产线且是13开头的数据,再定义SO为紧急要料
2.按物料、产线对实际缺件数求和,并输出所有行>>>df_inner1
'''
# df=pd.DataFrame(pd.read_excel('YC_扬柴主机缺.xlsx'))
# print(df)
# Url = 'C:\Users\g\Desktop\CUX:缺件统计表_140618.xlsx'
# Url = input('请输入文件名:')
def change_excel():
# df = pd.read_excel(r'C:\Users\g\Desktop\CUX:缺件统计表_150618.xlsx',sheet_name=0,header=7)
df = pd.read_excel('F:\缺件表.xlsx', sheet_name=0, header=1)
# df['需求日期'] = df['需求日期'].astype(str)
df['需求日期'] = pd.to_datetime(df['需求日期'], format='%Y-%m-%d %H:%M:%S',errors='coerce')
# print(df.head())
# print(df.info())
# df['产线'] = df['产线'].astype('object')
df1 = df[(~df['产线'].isin([130000007.0,130000001.0,130000002.0,130000003.0,130000005.0,130000021.0,130000022.0,130000023.0,130000024.0]))&(df['订单类型']=='SO')]
df2 = df[df['订单类型']!='SO']
df = df1.append(df2)
print('数据表合并已完成!')
#######################逻辑处理有问题,excel导出有问题########################
#######################以上BUG已经修复#########################################
df['产线'] = df['产线'].replace(130000001.0, '485装配线')
df['产线'] = df['产线'].replace(130000007.0, '随机附件')
df['产线'] = df['产线'].replace(130000002.0, '4102装配线')
df['产线'] = df['产线'].replace(130000003.0, 'VM装配线')
df['产线'] = df['产线'].replace(130000005.0, '整理线')
df['产线'] = df['产线'].replace(130000021.0, '二号厂装配线')
df['产线'] = df['产线'].replace(130000022.0, '二号厂试车线')
df['产线'] = df['产线'].replace(130000023.0, '二号厂成套线')
df['产线'] = df['产线'].replace(130000024.0, '二号厂随机附件')
df['产线'] = df['产线'].replace(130000600.0, '外协件销售出库')
df['产线'] = df['产线'].replace(930000001.0, '制造工程部')
df['产线'] = df['产线'].replace(930000002.0, '铸造厂')
df['产线'] = df['产线'].replace(930000003.0, '金加工厂')
df['产线'] = df['产线'].replace(930000004.0, '金加工厂机体线')
df['产线'] = df['产线'].replace(930000005.0, '装配厂')
df['产线'] = df['产线'].replace(930000006.0, '装配厂102线')
df['产线'] = df['产线'].replace(930000007.0, '装配厂85线')
df['产线'] = df['产线'].replace(930000008.0, '装配厂VM线')
df['产线'] = df['产线'].replace(930000009.0, '调试厂产线')
df['产线'] = df['产线'].replace(930000010.0, '调试厂生产')
df['产线'] = df['产线'].replace(930000011.0, '调试厂设修')
df['产线'] = df['产线'].replace(930000012.0, '质量部设修')
df['产线'] = df['产线'].replace(930000013.0, '质量部市场')
df['产线'] = df['产线'].replace(930000014.0, '质量部检验')
df['产线'] = df['产线'].replace(930000015.0, '技术中心')
df['产线'] = df['产线'].replace(930000016.0, '应用工程部')
df['产线'] = df['产线'].replace(930000017.0, '产品试验中心')
df['产线'] = df['产线'].replace(930000018.0, '平台开发')
df['产线'] = df['产线'].replace(930000019.0, '物流部')
df['产线'] = df['产线'].replace(930000020.0, '二号工厂机体加工线')
df['产线'] = df['产线'].replace(930000021.0, '二号工厂缸盖加工线')
df['产线'] = df['产线'].replace(930000022.0, '二号工厂装配线')
df['产线'] = df['产线'].replace(930000023.0, '二号工厂试车线')
df['产线'] = df['产线'].replace(930000024.0, '二号工厂成套线')
df['产线'] = df['产线'].replace(930000025.0, '二号工厂机体加工线设修')
df['产线'] = df['产线'].replace(930000026.0, '二号工厂缸盖加工线设修')
df['产线'] = df['产线'].replace(930000027.0, '二号工厂装配线设修')
df['产线'] = df['产线'].replace(930000028.0, '二号工厂试车线设修')
df['产线'] = df['产线'].replace(930000029.0, '二号工厂试车线生产工具')
df['产线'] = df['产线'].replace(930000030.0, '二号工厂成套线设修')
df['产线'] = df['产线'].replace(930000031.0, '调试厂校机维修')
df['产线'] = df['产线'].replace(930000032.0, '配件加工生产')
df['产线'] = df['产线'].replace(930000033.0, '材料、零部件让售')
df['产线'] = df['产线'].replace(930000034.0, '装配厂102线改型')
df['产线'] = df['产线'].replace(930000035.0, '装配厂85线改型')
df['产线'] = df['产线'].replace(930000036.0, '装配厂VM线改型')
df['产线'] = df['产线'].replace(930000037.0, '调试厂产线改型')
df['产线'] = df['产线'].replace(930000038.0, '二号工厂装配线改型')
df['产线'] = df['产线'].replace(930000039.0, '二号工厂试车线改型')
df['产线'] = df['产线'].replace(930000040.0, '二号工厂成套线改型')
df['产线'] = df['产线'].replace(930000041.0, '装配厂102线补废')
df['产线'] = df['产线'].replace(930000042.0, '装配厂85线补废')
df['产线'] = df['产线'].replace(930000043.0, '装配厂VM线补废')
df['产线'] = df['产线'].replace(930000044.0, '调试厂产线补废')
df['产线'] = df['产线'].replace(930000045.0, '二号工厂装配线补废')
df['产线'] = df['产线'].replace(930000046.0, '二号工厂试车线补废')
df['产线'] = df['产线'].replace(930000047.0, '二号工厂成套线补废')
df['产线'] = df['产线'].replace(930000048.0, '随机附件补充领用')
# df = df.sort_values(["保管员"], ascending=True)
df['产线'] = df['产线'].replace(np.nan, '未定义')
df['保管员'] = df['保管员'].replace(np.nan,'未定义')
df['订单类型'] = df['订单类型'].replace('MO','一次下架')
########################################################
df['订单类型'] = df['订单类型'].replace('SO','紧急要料')
########################################################
# df_inner = df.groupby('实际缺件数')['物料'].count()
# 对city字段进行汇总,并分别计算prince的合计和均值
# df_inner.groupby('city')['price'].agg([len,np.sum, np.mean])
# df[df['creativeID']<=10000]
###########################################################
# print(df.head())
# df.to_excel('F:\excel_to_python.xlsx', sheet_name='gg')
##############导出操作###################################
'''
以上已经完成保管员的数据表
下一步需要处理
1.获取物料、产线、订单类型维护汇总的缺件总数(完成)
2.合并表的内容(完成)
3.获取指定日期的缺件数()
'''
# df_inner1.to_excel('F:\kk.xlsx', sheet_name='gg')
# df['产线'] = df['产线'].replace('485装配线','485装配线')
# df['产线'] = df['产线'].replace('随机附件','随机附件')
# df['产线'] = df['产线'].replace('4102装配线','4102装配线')
# df['产线'] = df['产线'].replace('VM装配线','VM装配线')
# df['产线'] = df['产线'].replace('整理线','整理线')
# df['产线'] = df['产线'].replace('二号厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号厂成套线','二号厂成套线')
# df['产线'] = df['产线'].replace('二号厂随机附件','二号厂随机附件')
# df['产线'] = df['产线'].replace('外协件销售出库','外协件销售出库')
# df['产线'] = df['产线'].replace('制造工程部','制造工程部')
# df['产线'] = df['产线'].replace('铸造厂','铸造厂')
# df['产线'] = df['产线'].replace('金加工厂','金加工厂')
# df['产线'] = df['产线'].replace('金加工厂机体线','金加工厂')
# df['产线'] = df['产线'].replace('装配厂','4102装配线')
# df['产线'] = df['产线'].replace('装配厂102线','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线','整理线')
# df['产线'] = df['产线'].replace('调试厂生产','整理线')
# df['产线'] = df['产线'].replace('调试厂设修','整理线')
# df['产线'] = df['产线'].replace('质量部设修','质量部')
# df['产线'] = df['产线'].replace('质量部市场','质量部')
# df['产线'] = df['产线'].replace('质量部检验','质量部')
# df['产线'] = df['产线'].replace('技术中心','技术中心')
# df['产线'] = df['产线'].replace('应用工程部','技术中心')
# df['产线'] = df['产线'].replace('产品试验中心','技术中心')
# df['产线'] = df['产线'].replace('平台开发','技术中心')
# df['产线'] = df['产线'].replace('物流部','物流部')
# df['产线'] = df['产线'].replace('二号工厂机体加工线','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线','二号工厂成套线')
# df['产线'] = df['产线'].replace('二号工厂机体加工线设修','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线设修','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线设修','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线设修','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂试车线生产工具','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线设修','二号工厂成套线')
# df['产线'] = df['产线'].replace('调试厂校机维修','校机维修')
# df['产线'] = df['产线'].replace('配件加工生产','配件加工')
# df['产线'] = df['产线'].replace('材料、零部件让售','材料、零部件让售')
# df['产线'] = df['产线'].replace('装配厂102线改型','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线改型','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线改型','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线改型','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线改型','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线改型','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线改型','二号工厂成套线')
# df['产线'] = df['产线'].replace('装配厂102线补废','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线补废','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线补废','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线补废','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线补废','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线补废','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线补废','二号工厂成套线')
# df['产线'] = df['产线'].replace('随机附件补充领用','随机附件')
df_inner1 = df.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner1.rename(columns={'sum':'缺件总数','订单类型':'业务类型'}, inplace=True)
# 物料 产线 订单类型 缺件总数 ----物料说明 ----保管员
# 01119248 随机附件 一次下架 190
# 1000045386 二号厂装配线 一次下架 1
# 1000047928 485装配线 一次下架 8
# 1000050574 调试厂产线改型 紧急要料 6
# 1000069366 485装配线 一次下架 68
# 1.获取物料、产线、订单类型维护汇总的缺件总数完成
# df_inner1.to_excel('F:\k1k.xlsx', sheet_name='gg',index=False)
#############################################################################
print('数据表逻辑处理已完成!')
Date_1 = datetime.datetime.strptime(Date, '%Y-%m-%d')
df4 = df[df['需求日期']==Date_1]
# df4.sort_values(['保管员'],ascending=True)
df_inner2 = df4.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner2.rename(columns={'sum':'当日缺件数','订单类型':'业务类型'}, inplace=True)
# print(df_inner2.head())
result = pd.merge(df_inner1, df_inner2, how='left', on=['物料'])
result = result.drop(columns = ['产线_y','业务类型_y','物料说明_y','保管员_y'])
result.rename(columns={'产线_x':'产线','业务类型_x':'业务类型','物料说明_x':'物料说明','保管员_x':'保管员'}, inplace=True)
result = result.groupby(['物料','物料说明','保管员','当日缺件数'])['缺件总数'].agg([np.sum]).reset_index()
result.rename(columns={'sum':'缺件总数'}, inplace=True)
# result.sort_values(result['保管员'].astype(str), ascending=False)
# result.sort_values(['保管员'],ascending=True)
# result.sort_values(["保管员"], ascending=True)
result['保管员'] = result['保管员'].replace('未定义', 99.0)
result = result.sort_values(["保管员"], ascending=True)
result['保管员'] = result['保管员'].replace(99.0,'未定义')
print(result.head())
print('所有任务均已完成!')
'''
1.增加导出表的日期功能(完成)
2.在缺件表上显示日期
3.按保管员自动打印
[加分项]:按产线维度汇总
[超级加分项]:检测存在缺件时才汇总(涉及到递归算法,难度大,要重写算法)
''' result.to_excel('F:\缺件统计表{!s}.xlsx'.format(Date), sheet_name='缺件总表',index=False)
return 'The Job is Finished' def del_file(file_path):
import os
filename = file_path
if os.path.exists(filename):
os.remove(filename)
print(filename+'已经成功删除')
else:
print(filename+'文件不存在')
'''
对excel表的具体操作
0.在表头加日期
1.所有单元格居中
2.所有单元格加框线
3.设置打印格式
######################################################
对用户界面的具体操作
0.制作应用界面窗口
1.设置其他报错信息
2.完成封装exe格式
''' if __name__ == '__main__':
html_to_excel()
time.sleep(5)
change_excel()
del_file('F:\缺件表.xlsx')
emmm更新
关于pands库不能直接封装成exe的原因:https://stackoverflow.com/questions/33001327/importerror-with-pyinstaller-and-pandas
The reason this is necessary is PyInstaller is grabbing pandas python code, but not grabbing the lib. This means that when the pandas code runs (from 'inside' the executable) it can't find the lib – so it tries to be helpful and suggest you need to build it.
总的来说就是你要指引PyInstaller去抓取lib下的第三方库pandas
import numpy as np
import pandas as pd
import time
import datetime
import tkinter as tk
from tkinter import filedialog
window = tk.Tk()
window.title("缺件分析自动处理")
window.geometry('400x200')
Label1 = tk.Label(window, text='需求日期:').grid(row=0, column=0)
Label2 = tk.Label(window, text='选择文件:').grid(row=2, column=0)
v1 = tk.StringVar()
file_path = ''
Date = tk.Entry(window, textvariable=v1) # Entry 是 Tkinter 用来接收字符串等输入的控件.
Date.grid(row=0, column=1, padx=10, pady=5) # 设置输入框显示的位置,以及长和宽属性
def showdate():
print("需求日期:%s" % Date.get()) # 获取用户输入的信息
def showprofile():
global file_path
file_path = filedialog.askopenfilename()
tk.Button(window, text='浏览', width=10, command=showprofile) \
.grid(row=2, column=1, padx=10, pady=5)
tk.Button(window, text='确定', width=10, command=window.quit)\
.grid(row=4, column=0, padx=10, pady=5)
tk.Button(window, text='退出', width=10, command=window.quit) \
.grid(row=4, column=1,padx=10, pady=5)
tk.mainloop()
def html_to_excel():
print('已经选择的文件路径是:'+file_path)
with open(file_path,'rb') as f:
df_o = pd.read_html(f.read())
# print(df_o)
print('数据表正在合并!')
bb = pd.ExcelWriter('F:\缺件表.xlsx')
df_o[1].to_excel(bb) #一个超级大坑,随缘排错法,之前是df_o[0]>>>df_o[1]
bb.close()
'''
1.删除掉订单类型是SO的产线且是13开头的数据,再定义SO为紧急要料
2.按物料、产线对实际缺件数求和,并输出所有行>>>df_inner1
'''
# df=pd.DataFrame(pd.read_excel('YC_扬柴主机缺.xlsx'))
# print(df)
# Url = 'C:\Users\g\Desktop\CUX:缺件统计表_140618.xlsx'
# Url = input('请输入文件名:')
def change_excel():
# df = pd.read_excel(r'C:\Users\g\Desktop\CUX:缺件统计表_150618.xlsx',sheet_name=0,header=7)
df = pd.read_excel('F:\缺件表.xlsx', sheet_name=0, header=1)
# df['需求日期'] = df['需求日期'].astype(str)
df['需求日期'] = pd.to_datetime(df['需求日期'], format='%Y-%m-%d %H:%M:%S',errors='coerce')
# print(df.head())
# print(df.info())
# df['产线'] = df['产线'].astype('object')
df1 = df[(~df['产线'].isin([130000007.0,130000001.0,130000002.0,130000003.0,130000005.0,130000021.0,130000022.0,130000023.0,130000024.0]))&(df['订单类型']=='SO')]
df2 = df[df['订单类型']!='SO']
df = df1.append(df2)
print('数据表合并已完成!')
#######################逻辑处理有问题,excel导出有问题########################
#######################以上BUG已经修复#########################################
df['产线'] = df['产线'].replace(130000001.0, '485装配线')
df['产线'] = df['产线'].replace(130000007.0, '随机附件')
df['产线'] = df['产线'].replace(130000002.0, '4102装配线')
df['产线'] = df['产线'].replace(130000003.0, 'VM装配线')
df['产线'] = df['产线'].replace(130000005.0, '整理线')
df['产线'] = df['产线'].replace(130000021.0, '二号厂装配线')
df['产线'] = df['产线'].replace(130000022.0, '二号厂试车线')
df['产线'] = df['产线'].replace(130000023.0, '二号厂成套线')
df['产线'] = df['产线'].replace(130000024.0, '二号厂随机附件')
df['产线'] = df['产线'].replace(130000600.0, '外协件销售出库')
df['产线'] = df['产线'].replace(930000001.0, '制造工程部')
df['产线'] = df['产线'].replace(930000002.0, '铸造厂')
df['产线'] = df['产线'].replace(930000003.0, '金加工厂')
df['产线'] = df['产线'].replace(930000004.0, '金加工厂机体线')
df['产线'] = df['产线'].replace(930000005.0, '装配厂')
df['产线'] = df['产线'].replace(930000006.0, '装配厂102线')
df['产线'] = df['产线'].replace(930000007.0, '装配厂85线')
df['产线'] = df['产线'].replace(930000008.0, '装配厂VM线')
df['产线'] = df['产线'].replace(930000009.0, '调试厂产线')
df['产线'] = df['产线'].replace(930000010.0, '调试厂生产')
df['产线'] = df['产线'].replace(930000011.0, '调试厂设修')
df['产线'] = df['产线'].replace(930000012.0, '质量部设修')
df['产线'] = df['产线'].replace(930000013.0, '质量部市场')
df['产线'] = df['产线'].replace(930000014.0, '质量部检验')
df['产线'] = df['产线'].replace(930000015.0, '技术中心')
df['产线'] = df['产线'].replace(930000016.0, '应用工程部')
df['产线'] = df['产线'].replace(930000017.0, '产品试验中心')
df['产线'] = df['产线'].replace(930000018.0, '平台开发')
df['产线'] = df['产线'].replace(930000019.0, '物流部')
df['产线'] = df['产线'].replace(930000020.0, '二号工厂机体加工线')
df['产线'] = df['产线'].replace(930000021.0, '二号工厂缸盖加工线')
df['产线'] = df['产线'].replace(930000022.0, '二号工厂装配线')
df['产线'] = df['产线'].replace(930000023.0, '二号工厂试车线')
df['产线'] = df['产线'].replace(930000024.0, '二号工厂成套线')
df['产线'] = df['产线'].replace(930000025.0, '二号工厂机体加工线设修')
df['产线'] = df['产线'].replace(930000026.0, '二号工厂缸盖加工线设修')
df['产线'] = df['产线'].replace(930000027.0, '二号工厂装配线设修')
df['产线'] = df['产线'].replace(930000028.0, '二号工厂试车线设修')
df['产线'] = df['产线'].replace(930000029.0, '二号工厂试车线生产工具')
df['产线'] = df['产线'].replace(930000030.0, '二号工厂成套线设修')
df['产线'] = df['产线'].replace(930000031.0, '调试厂校机维修')
df['产线'] = df['产线'].replace(930000032.0, '配件加工生产')
df['产线'] = df['产线'].replace(930000033.0, '材料、零部件让售')
df['产线'] = df['产线'].replace(930000034.0, '装配厂102线改型')
df['产线'] = df['产线'].replace(930000035.0, '装配厂85线改型')
df['产线'] = df['产线'].replace(930000036.0, '装配厂VM线改型')
df['产线'] = df['产线'].replace(930000037.0, '调试厂产线改型')
df['产线'] = df['产线'].replace(930000038.0, '二号工厂装配线改型')
df['产线'] = df['产线'].replace(930000039.0, '二号工厂试车线改型')
df['产线'] = df['产线'].replace(930000040.0, '二号工厂成套线改型')
df['产线'] = df['产线'].replace(930000041.0, '装配厂102线补废')
df['产线'] = df['产线'].replace(930000042.0, '装配厂85线补废')
df['产线'] = df['产线'].replace(930000043.0, '装配厂VM线补废')
df['产线'] = df['产线'].replace(930000044.0, '调试厂产线补废')
df['产线'] = df['产线'].replace(930000045.0, '二号工厂装配线补废')
df['产线'] = df['产线'].replace(930000046.0, '二号工厂试车线补废')
df['产线'] = df['产线'].replace(930000047.0, '二号工厂成套线补废')
df['产线'] = df['产线'].replace(930000048.0, '随机附件补充领用')
# df = df.sort_values(["保管员"], ascending=True)
df['产线'] = df['产线'].replace(np.nan, '未定义')
df['保管员'] = df['保管员'].replace(np.nan,'未定义')
df['订单类型'] = df['订单类型'].replace('MO','一次下架')
########################################################
df['订单类型'] = df['订单类型'].replace('SO','紧急要料')
########################################################
# df_inner = df.groupby('实际缺件数')['物料'].count()
# 对city字段进行汇总,并分别计算prince的合计和均值
# df_inner.groupby('city')['price'].agg([len,np.sum, np.mean])
# df[df['creativeID']<=10000]
###########################################################
# print(df.head())
# df.to_excel('F:\excel_to_python.xlsx', sheet_name='gg')
##############导出操作###################################
'''
以上已经完成保管员的数据表
下一步需要处理
1.获取物料、产线、订单类型维护汇总的缺件总数(完成)
2.合并表的内容(完成)
3.获取指定日期的缺件数()
'''
# df_inner1.to_excel('F:\kk.xlsx', sheet_name='gg')
# df['产线'] = df['产线'].replace('485装配线','485装配线')
# df['产线'] = df['产线'].replace('随机附件','随机附件')
# df['产线'] = df['产线'].replace('4102装配线','4102装配线')
# df['产线'] = df['产线'].replace('VM装配线','VM装配线')
# df['产线'] = df['产线'].replace('整理线','整理线')
# df['产线'] = df['产线'].replace('二号厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号厂成套线','二号厂成套线')
# df['产线'] = df['产线'].replace('二号厂随机附件','二号厂随机附件')
# df['产线'] = df['产线'].replace('外协件销售出库','外协件销售出库')
# df['产线'] = df['产线'].replace('制造工程部','制造工程部')
# df['产线'] = df['产线'].replace('铸造厂','铸造厂')
# df['产线'] = df['产线'].replace('金加工厂','金加工厂')
# df['产线'] = df['产线'].replace('金加工厂机体线','金加工厂')
# df['产线'] = df['产线'].replace('装配厂','4102装配线')
# df['产线'] = df['产线'].replace('装配厂102线','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线','整理线')
# df['产线'] = df['产线'].replace('调试厂生产','整理线')
# df['产线'] = df['产线'].replace('调试厂设修','整理线')
# df['产线'] = df['产线'].replace('质量部设修','质量部')
# df['产线'] = df['产线'].replace('质量部市场','质量部')
# df['产线'] = df['产线'].replace('质量部检验','质量部')
# df['产线'] = df['产线'].replace('技术中心','技术中心')
# df['产线'] = df['产线'].replace('应用工程部','技术中心')
# df['产线'] = df['产线'].replace('产品试验中心','技术中心')
# df['产线'] = df['产线'].replace('平台开发','技术中心')
# df['产线'] = df['产线'].replace('物流部','物流部')
# df['产线'] = df['产线'].replace('二号工厂机体加工线','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线','二号工厂成套线')
# df['产线'] = df['产线'].replace('二号工厂机体加工线设修','二号工厂机体')
# df['产线'] = df['产线'].replace('二号工厂缸盖加工线设修','二号工厂缸盖')
# df['产线'] = df['产线'].replace('二号工厂装配线设修','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线设修','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂试车线生产工具','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线设修','二号工厂成套线')
# df['产线'] = df['产线'].replace('调试厂校机维修','校机维修')
# df['产线'] = df['产线'].replace('配件加工生产','配件加工')
# df['产线'] = df['产线'].replace('材料、零部件让售','材料、零部件让售')
# df['产线'] = df['产线'].replace('装配厂102线改型','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线改型','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线改型','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线改型','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线改型','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线改型','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线改型','二号工厂成套线')
# df['产线'] = df['产线'].replace('装配厂102线补废','4102装配线')
# df['产线'] = df['产线'].replace('装配厂85线补废','485装配线')
# df['产线'] = df['产线'].replace('装配厂VM线补废','VM装配线')
# df['产线'] = df['产线'].replace('调试厂产线补废','整理线')
# df['产线'] = df['产线'].replace('二号工厂装配线补废','二号厂装配线')
# df['产线'] = df['产线'].replace('二号工厂试车线补废','二号厂试车线')
# df['产线'] = df['产线'].replace('二号工厂成套线补废','二号工厂成套线')
# df['产线'] = df['产线'].replace('随机附件补充领用','随机附件')
df_inner1 = df.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner1.rename(columns={'sum':'缺件总数','订单类型':'业务类型'}, inplace=True)
# 物料 产线 订单类型 缺件总数 ----物料说明 ----保管员
# 01119248 随机附件 一次下架 190
# 1000045386 二号厂装配线 一次下架 1
# 1000047928 485装配线 一次下架 8
# 1000050574 调试厂产线改型 紧急要料 6
# 1000069366 485装配线 一次下架 68
# 1.获取物料、产线、订单类型维护汇总的缺件总数完成
# df_inner1.to_excel('F:\k1k.xlsx', sheet_name='gg',index=False)
#############################################################################
print('数据表逻辑处理已完成!')
Date_1 = datetime.datetime.strptime(str(Date.get()), '%Y-%m-%d')
df4 = df[df['需求日期']==Date_1]
# df4.sort_values(['保管员'],ascending=True)
df_inner2 = df4.groupby(['产线','订单类型','物料','物料说明','保管员'])['实际缺件数'].agg([np.sum]).reset_index()
df_inner2.rename(columns={'sum':'当日缺件数','订单类型':'业务类型'}, inplace=True)
# print(df_inner2.head())
result = pd.merge(df_inner1, df_inner2, how='left', on=['物料'])
result = result.drop(columns = ['产线_y','业务类型_y','物料说明_y','保管员_y'])
result.rename(columns={'产线_x':'产线','业务类型_x':'业务类型','物料说明_x':'物料说明','保管员_x':'保管员'}, inplace=True)
result = result.groupby(['物料','物料说明','保管员','当日缺件数'])['缺件总数'].agg([np.sum]).reset_index()
result.rename(columns={'sum':'缺件总数'}, inplace=True)
# result.sort_values(result['保管员'].astype(str), ascending=False)
# result.sort_values(['保管员'],ascending=True)
# result.sort_values(["保管员"], ascending=True)
result['保管员'] = result['保管员'].replace('未定义', 99.0)
result = result.sort_values(["保管员"], ascending=True)
result['保管员'] = result['保管员'].replace(99.0,'未定义')
print(result.head())
print('所有任务均已完成!')
'''
1.增加导出表的日期功能(完成)
2.在缺件表上显示日期
3.按保管员自动打印
[加分项]:按产线维度汇总
[超级加分项]:检测存在缺件时才汇总(涉及到递归算法,难度大,要重写算法)
''' result.to_excel('F:\缺件统计表{!s}.xlsx'.format(str(Date.get())), sheet_name='缺件总表',index=False)
return 'The Job is Finished' def del_file(file_path):
import os
filename = file_path
if os.path.exists(filename):
os.remove(filename)
print(filename+'已经成功删除')
else:
print(filename+'文件不存在')
'''
对excel表的具体操作
0.在表头加日期
1.所有单元格居中
2.所有单元格加框线
3.设置打印格式
######################################################
对用户界面的具体操作
0.制作应用界面窗口
1.设置其他报错信息
2.完成封装exe格式
''' if __name__ == '__main__':
html_to_excel()
time.sleep(5)
change_excel()
del_file('F:\缺件表.xlsx')
小bug(不影响使用)
pandaboy玩pandas的更多相关文章
- Pandas进阶之提升运行效率
前言 如果你现在正在学习数据分析,或者正在从事数据分析行业,肯定会处理一些大数据集.pandas就是这些大数据集的一个很好的处理工具.那么pandas到底是什么呢?官方文档上说: " 快速, ...
- 玩转pandas
一.pandas概述 pandas :pannel data analysis(面板数据分析).pandas是基于numpy构建的,为时间序列分析提供了很好的支持.pandas中有两个主要的数据结构, ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- pandas玩转excel-> (1)如何利用pandas创建【行,列,单元格】
import pandas as pd #------新建单元格的方法一:通过先创建字典的形式 #可以先新建一个字典d={'x':100,'y':200,'z':300} #打印字典的索引print( ...
- pandas玩转excel-> (2)如何利用pandas读取excel数据文件
import pandas as pd #将excel文件读到内存中,形成dataframe,并命名为peoplepeople=pd.read_excel('D:/python结果/task2/Peo ...
- pandas玩转excel-> (1)如何利用pandas创建excel数据文件
#在Anaconda3 的Spyder中 #定义pandas模块为pd import pandas as pd #创建一个新的DataFrame对象,定义这个对象中有两个字段:ID和Name, ...
- Python数据分析:pandas玩转Excel (二)
1 对Excel文件的操作 方法一: 使用xlrd库或者xlwt库进行对excel表格的操作读与写: 方法二: pandas库同样支持excel的读写操作:且更加简便. 2 pd.read_excel ...
- Python数据分析:pandas玩转Excel (一)
目录 1 pandas简介 2 导入 3 使用 4 读取.写入 1 pandas简介 1.Pandas是什么? Pandas是一个强大的分析结构化数据的工具集: 它的使用基础是Numpy(提供高性能的 ...
- 用实战玩转pandas数据分析(一)——用户消费行为分析(python)
CD商品订单数据的分析总结.根据订单数据(用户的消费记录),从时间维度和用户维度,分析该网站用户的消费行为.通过此案例,总结订单数据的一些共性,能通过用户的消费记录挖掘出对业务有用的信息.对其他产 ...
随机推荐
- idea的项目中output框出现乱码
找到tomcat的安装目录中的logging.properties 我的在这里:E:\tools\tomcat\apache-tomcat-8.5.38\conf 改其中的参数 修改前 java.u ...
- spring使用注解开发
1.准备工作(1)导入common-annotations.jar(2)导入schema文件 文件名为spring-context-2.5.xsd(3)在xml的beans节点中配置 service层 ...
- [转] hadoop MapReduce实例解析-非常不错,讲解清晰
来源:http://blog.csdn.net/liuxiaochen123/article/details/8786715?utm_source=tuicool 2013-04-11 10:15 4 ...
- CF1027F Session in BSU (并查集+树上构造)
题目大意:你可以在第$ai$天或者第$bi$天进行第$i$场考试,每天最多进行一场考试,求把所有考试都考完的最早结束时间 由于天数可能很大,需要离散 把问题抽象成一棵树,每个点最多被"分配& ...
- python--(常用模块-2序列化)
python--(常用模块-2序列化) 一.序列化: 把对象打散成bytes或者字符串. 方便存储和传输 序列化 把bytes或者字符串转换回对象. 反序列化 # dumps 序列化. 把对象转化成b ...
- 【转】python 关键字
转自:http://www.cnblogs.com/hongten/p/hongten_python_keywords.html python3.3.2中的关键字如下: The following i ...
- WPF利用radiobutton制作菜单按钮
原文:WPF利用radiobutton制作菜单按钮 版权声明:欢迎转载.转载请注明出处,谢谢 https://blog.csdn.net/wzcool273509239/article/details ...
- 前端和后台对接时对sign加密方法
前端和后台对接时对sign加密方法 /*后台php对接进行sign标签加密 1 获取向后台请求的数据data(key/value方式),可以是个对象(obj),也可以是数组(arr); 2 将数据的k ...
- tp框架引入第三方sdk的经验总结
tp框架开发常用到第三方的接口,这时候需要引入第三方的sdk.例如:微信扫码支付sdk,阿里大于的淘宝sdk等等 首先到官网上下载对应php的sdk文件,通常会有至少一个实例代码. 1 新建一个控制器 ...
- MyBatis学习总结(5)——实现关联表查询
一.一对一关联 1.1.提出需求 根据班级id查询班级信息(带老师的信息) 1.2.创建表和数据 创建一张教师表和班级表,这里我们假设一个老师只负责教一个班,那么老师和班级之间的关系就是一种一对一的关 ...