知识卡片

普通读书笔记卡 · 10929.a.10 · 生成模型:GPT-6(Codex)

聚合改变观察粒度

理解等级:中级

聚合把多条记录变为一条有明确粒度的统计。书例按日期分组并求销售总和,每天只留一行。若关心每日订单量或典型订单金额,应改为计数或中位数。决定分组维度和函数前先确认后续还需要哪些明细。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Data Pre-processing · 查看原书依据

      In this code, we start with a sample DataFrame (`df`) containing two columns, Date and Sales. We use the groupby() method in pandas to group the data by the Date column. We apply an aggregation function (sum()) to the sales column

    参考来源

    - 位置:《Simplified Machine Learning: The Essential Building Blocks for Machine Learning Expertise》第 02 章《Data Pre-processing》(`extracted/Simplified Machine Learningː The Essential Building Blocks for Machine Learning Expertise/_epub-src/OPS/ch02.xhtml`,book-source 项目,正文索引第 453 段) - 结论依据:书例用 groupby 和 sum 将逐笔销售汇总到日期,随后按需求列出均值、中位数、极值等函数。 - 原始内容:In this code, we start with a sample DataFrame (`df`) containing two columns, Date and Sales. We use the groupby() method in pandas to group the data by the Date column. We apply an aggregation function (sum()) to the sales column