小编y4n*_*ick的帖子

以 pandas 风格渲染格式化日期

我有一个包含三列的 pandas 数据框,其中第一列是日期。为了生成 html 输出,我使用以下命令:

html_string = df.style.format({'second': "{:0,.0f}",third: "{:0,.0f}"}).set_table_styles(styles).render()
Run Code Online (Sandbox Code Playgroud)

如何也可以指定日期的格式...类似:

html_string = df.style.format({'Date': "%Y.%m",'second': "{:0,.0f}",third: "{:0,.0f}"}).set_table_styles(styles).render()
Run Code Online (Sandbox Code Playgroud)

python pandas pandas-styles

6
推荐指数
1
解决办法
6672
查看次数

标签 统计

pandas ×1

pandas-styles ×1

python ×1