当前位置: 首页 > 图灵资讯 > 行业资讯> Python的excel处理操作

Python的excel处理操作

发布时间:2024-10-08 19:10:34

本文教程操作环境:windows7系统Python 3.9.1,DELL G3电脑。

在桌面上创建excel

importpandasaspd

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)

画图

importmatplotlib.pyplotasplt

board.plot.line(x='省份',y='死亡')
plt.show()

花式绘图

board.plot.bar(x='省份',y=['死亡','现有确诊'],color=['orange','red'])
plt.show()

以上就是Pythonexcel几种常规处理操作,快速尝试~

相关文章

如何让vim支持python3

如何让vim支持python3

2025-09-12
python2.7和3.6区别有哪些

python2.7和3.6区别有哪些

2025-09-12
python3有serial库吗

python3有serial库吗

2025-09-12
python中w、r表示什么意思

python中w、r表示什么意思

2025-09-12
python中如何把list变成字符串

python中如何把list变成字符串

2025-09-12
python命名空间是什么

python命名空间是什么

2025-09-12