【问题标题】:How to set number format in Table with pandastable如何使用 pandastable 在表格中设置数字格式
【发布时间】:2019-12-12 20:32:06
【问题描述】:

我正在用 tkinter 编写一个 GUI,它使用 pandastable 模块来显示数据框。我正在尝试在 pandastable 的Table 中获取这种数字格式:

pd.options.display.float_format = '{:,.4f}'.format 

我查看了 pandastable 的文档,但找不到可以设置它的位置。有字体、对齐方式和颜色格式,但没有数字格式。非常感谢!

【问题讨论】:

    标签: python dataframe user-interface tkinter number-formatting


    【解决方案1】:

    不确定是要编辑进入数据框的数据还是编辑已经在 pandastable 中的数据框?

    我所做的只是格式化进入数据框的数据,然后更新表格。

    vals[i] = ("%.3f" % 值)

    df = df.append({'Time(mS)' : time_diff, 'X1' : vals[0],..., 'X7' : vals[7]} , ignore_index = True)

    pt.updateModel(TableModel(df))

    pt.redraw()

    【讨论】:

    • 嗨,我想在 Pandatable 中显示数字格式。 pd.options.display.float_format = '{:,.4f}'.format 已经处理了 DataFrame 中显示的内容
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多