更改openpyxl中图表的轴格式?

时间:2019-12-24 17:10:30

标签: python excel openpyxl

我正在使用库openpyxl处理Excel折线图。我想知道如何设置轴的格式,因此可以将其从文本格式修改为日期格式。

谢谢!

1 个答案:

答案 0 :(得分:0)

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