首页 > 解决方案 > 在openpyxl中更改图表的轴格式?

问题描述

我正在使用库 openpyxl 处理 Excel 折线图。我想知道如何格式化轴,所以我可以将它从文本格式修改为日期格式。

提前致谢!

标签: pythonexcelopenpyxl

解决方案


datetime.strptime()在这种情况下,将字符串解析为日期格式可能很有价值。openpyxl.number_format也可能是基于它正在读取的工作表单元格的解决方案。


参考:

strptime()https ://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

number_format()https ://openpyxl.readthedocs.io/en/stable/usage.html#using-number-formats


推荐阅读