Skip to content

Commit 5ab511d

Browse files
timsaucerclaude
andcommitted
Use distinct group sums in aggregate docstring example
Change the score data from [1, 2, 3] to [1, 2, 5] so the grouped result produces [3, 5] instead of [3, 3], removing ambiguity about which total belongs to which team. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 029d01f commit 5ab511d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

python/datafusion/dataframe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,17 +804,17 @@ def aggregate(
804804
805805
>>> ctx = dfn.SessionContext()
806806
>>> df = ctx.from_pydict(
807-
... {"team": ["x", "x", "y"], "score": [1, 2, 3]}
807+
... {"team": ["x", "x", "y"], "score": [1, 2, 5]}
808808
... )
809809
>>> df.aggregate([], [F.sum(col("score")).alias("total")]).to_pydict()
810-
{'total': [6]}
810+
{'total': [8]}
811811
812812
Group by a column and produce one row per group:
813813
814814
>>> df.aggregate(
815815
... [col("team")], [F.sum(col("score")).alias("total")]
816816
... ).sort("team").to_pydict()
817-
{'team': ['x', 'y'], 'total': [3, 3]}
817+
{'team': ['x', 'y'], 'total': [3, 5]}
818818
"""
819819
group_by_list = (
820820
list(group_by)

0 commit comments

Comments
 (0)