环顾四周,没有发现任何具体情况。我有一个Pandas dataframe,我正在使用一个Styler对象和render()方法将其转换为html。我正在寻找一种方法来合并具有相同日期的单元格组,以更可读的格式将数据呈现给彼此不同的周
Input:
+-------------------+-----------------+
| Date Weekending | Action |
+-------------------+-----------------+
| 27/08/2021 | Increase Output |
+-------------------+-----------------+
| 27/08/2021 | Decrease Output |
+-------------------+-----------------+
| 3/09/2021 | Make change |
+-------------------+-----------------+
| 3/09/2021 | Go for a hike |
+-------------------+-----------------+
| 3/09/2021 | Bake a cake |
+-------------------+-----------------+
Desired Output:
+-------------------+-----------------+
| Date Weekending | Action |
+-------------------+-----------------+
| 27/08/2021 | Increase Output |
| +-----------------+
| | Decrease Output |
+-------------------+-----------------+
| 3/09/2021 | Make change |
| +-----------------+
| | Go for a hike |
| +-----------------+
| | Bake a cake |
+-------------------+-----------------+
我的理论是创建一个函数来获取列并应用格式,使第一行跨越匹配行的长度,然后将后续行的显示值设置为false,但我不太明白如何实现这一点
理想情况下,我认为这应该通过Styler.apply()完成,但数据存在于临时数据帧中,因此可以选择以这种方式处理数据
目前没有回答
相关问题 更多 >
编程相关推荐