【发布时间】:2019-11-25 16:05:02
【问题描述】:
我了解带有 sum 作为 agg 函数的 groupby 类型执行以下操作:
之前:
type stale price
orange yes 1
apple yes 2
orange no 3
之后:
type stale price
orange yes 1
no 3
apple no 2
groupby 中是否有允许我显示所有单元格值的参数?因此在上面写着苹果的地方放置一个“橙色”的值,而不是强迫读者理解第二行仍然属于橙色?对于这个例子,它可能看起来没什么用,但在更大的数据集中,能够看到所有单元格的值会很有帮助。
【问题讨论】:
-
as_index = False? -
是的!那行得通。谢谢