pandas和openpyxl格式不工作

2024-03-29 11:51:57 发布

您现在位置:Python中文网/ 问答频道 /正文

只是试着格式化一个数据帧,并用python3.7将其保存到excel文件中。我很肯定我犯了些小错误,但我想不出来

styled_df = df.style.bar(['Null_Percentage'], color="#bbddbb")
styled_df.to_excel(path, engine='openpyxl', encoding='utf-8', index=False)

这是输出的Excel图像。理想情况下,空百分比列中应该有条: enter image description here

我使用的是pandas version=0.25.0和openpyxl=2.6.3


Tags: 文件to数据pathdfstyle错误bar