python 实现查询 Excel 报表,一键解决,小白都能学会

都说python简单,不用不知道,今天我用pyhton 查询 Excel 报表,简单的让人有点相见恨晚的感觉。

先看效果:



菜单选项对应各模块代码

一、软件准备

1、安装python编程软件

从官网直接下载即可,这个很简单不用多说。

2、安装工具软件

这里推荐使用jupyter notebook、visual code、和pycharm,三个软件任选其一,我选择使用第一个,调试非常方便、简单。

二、文件准备

文件存放路径:

F:/product_demo.xls

Excel 待查询的文件

文件内容:


各项信息


成品入库信息


成品出库信息


主代码文件和功能模块文件

三、代码

1、主代码

主代码


接上图主代码

2、功能模块代码








3、代码思路

先编写主代码结构,再调用功能模块代码。

import pandas as pd

import myfunction_demo as fu # 导入自己编写的功能模块函数

设置输出方式

pd.set_option('display.unicode.ambiguous_as_wide', True)

pd.set_option('display.unicode.east_asian_width', True)

pd.set_option('expand_frame_repr', False)

pd.set_option('display.max_columns', None, 'display.max_rows', None)

pd.set_option('display.max_rows', 5000)

msg = (' '

' 产品查询菜单 '

' ************************ '

' 0.exit '

' 1.成品入库查询 '

' 2.成品出库查询 '

' 3.成品库存查询 '

' 4.客户销售查询 '

' 5.客户汇总查询 '

' 6.品种销量查询 '

' 7.区域销量查询 '

' ************************* '

' ')

while True:

print(msg)

inp = input("请选择要查询的项目编号:")

print(f"您选择的是 NO.{inp}")

if inp == '1':

print('-' * 15, end="")

print("成品入库查询结果", end='')

print('-' * 15)

fu.stock_in()

print(" ---------------------END----------------------")

print(f"您选择的是 NO.{inp} ",end=""),print("成品入库查询结果", end='')

elif inp == '2':

print('-' * 60)

print(" " * 25, end="")

print("成品出库查询结果")

print('-' * 60)

fu.stock_out()

print("-------------------------------END------------------------------")

elif inp == '3':

print('-' * 52)

print(" " * 15, end="")

print("成品库存查询结果")

print('-' * 52)

fu.stock_in_out()

print(" -----------------------END--------------------------")

elif inp == '4':

print('--------------------单个客户销售查询--------------------')

name = input("请输入客户名称:")

print('---------------------客户销售查询结果--------------------')

fu.customer_query(name)

print(" ------------------------END----------------------------")

elif inp == '5':

print('---------------所有客户汇总查询------------')

fu.customer_group()

print(" -----------------END--------------------")

elif inp == '6':

print('------------各品种销量查询-----------------')

fu.sales_volume()

print(" -----------------END--------------------")

elif inp == '7':

print('---------------各区域销量查询--------------')

fu.summary_by_region()

print(" -----------------END--------------------")

elif inp == '0' or inp == 'q' or inp == 'Q':

print('See you next time ! bye !')

break

else:

print("输入错误,请重新输入!")

展开阅读全文

页面更新:2024-03-21

标签:销量   报表   成品   功能模块   库存   客户   代码   简单   文件   信息   软件

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top