Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink DataFrame
    • DataFrame
    • DataFrame Creation
    • Input / Output
    • SQL
    • Data Types
    • User Defined Functions
    • Configuration
    • Catalog
    • GPU Support
    • AI / LLM
    • Multimodal Expressions
  • PyFlink Multimodal
  • PyFlink Table
  • PyFlink DataStream
  • PyFlink Common

pyflink.dataframe.GroupedDataFrame.agg#

GroupedDataFrame.agg(*aggs: pyflink.table.expression.Expression, **named_aggs: pyflink.table.expression.Expression) → pyflink.dataframe.dataframe.DataFrame[source]#

Apply aggregation expressions.

Parameters
  • *aggs – Aggregation expressions.

  • **named_aggs – Named aggregation expressions. Each expression is aliased to the corresponding keyword.

Returns

A new DataFrame with aggregation results.

Example::
>>> import pyflink.dataframe as pf
>>> df = pf.from_records(
...     [("A", 1), ("A", 2), ("B", 3)],
...     schema=["category", "value"],
... )
>>> # Group by and aggregate
>>> result = df.group_by("category").agg(
...     pf.col("value").sum.alias("total")
... )
>>> result = df.group_by("category").agg(
...     total=pf.col("value").sum
... )
>>> # result columns: ["category", "total"]

previous

pyflink.dataframe.GroupedDataFrame

next

pyflink.dataframe.col

Show Source

Created using Sphinx 4.5.0.