本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。
创建excel在桌面
import pandas as pd df =pd.DataFrame() df.to_excel('C:/Users/Administrator/Desktop/output.xlsx') print("done!")
注意要建立pip install openpyxl 包
读取excel
board=pd.read_excel('C:/Users/Administrator/Desktop/data.xlsx', engine='openpyxl') print(board.shape) print(board)
画图
import matplotlib.pyplot as plt board.plot.line(x='省份',y='死亡') plt.show()
花式绘图
board.plot.bar(x='省份',y=['死亡','现有确诊'],color=['orange','red']) plt.show()
以上就是Python的excel几种常规处理操作,快点尝试看看吧~
Copyright © 2019- hids.cn 版权所有 赣ICP备2024042780号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务