You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Python Great Tables包时遭遇KeyError: 'font_color_row_striping_background_color'的排查求助

使用Python Great Tables包时遭遇KeyError: 'font_color_row_striping_background_color'的排查求助

各位好,我在使用Python的Great Tables包生成表格时碰到了一个棘手的问题——每次调用.show()展示表格,或者尝试将表格导出为PNG时,都会触发KeyError: 'font_color_row_striping_background_color'这个错误,完全摸不着头绪。

先给大家看看我生成表格的完整代码:

Top25_gt = (
    GT(VoATable_Top25df)
    .tab_header(
        title = "MCBB D1 Vortex of Accuracy Ratings",
    )
    .fmt_number(
        columns = ["OvrlVoA_MeanRating", "OffVoA_MeanRating", "DefVoA_MeanRating"],
        decimals = 3
    )
    .fmt_number(
        columns=["OvrlVoARanking"],
        decimals=0
    )
    .data_color(
        columns = ["OvrlVoA_MeanRating", "OffVoA_MeanRating"],
        palette = "RdYlGn",
        na_color = "white"
    )
    .data_color(
        columns = ["DefVoA_MeanRating"],
        palette = "RdYlGn",
        reverse = True,
        na_color = "white"
    )
    # 列名重命名
    .cols_label(
        OvrlVoA_MeanRating = "Overall VoA Rating",
        OvrlVoARanking = "VoA Ranking",
        OffVoA_MeanRating = "Off VoA Rating",
        OffVoARanking = "Off Ranking",
        DefVoA_MeanRating = "Def VoA Rating",
        DefVoARanking = "Def Ranking"
    )
    # 添加来源说明
    .tab_source_note(
        source_note = "Table by @gshelor, Data from CBBD API"
    )
)

Top25_gt.show()

我反复核对了代码里的列名,确认和DataFrame里的列完全匹配,格式设置和样式配置看起来也没什么问题。有没有朋友遇到过类似的情况?或者能帮我排查下是不是哪里的配置细节没做好?

备注:内容来源于stack exchange,提问作者gshelor

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 18:24:37