COLLAPSE ALL
  • Home
  • About Pixie
    • Pixie Overview
    • Data Sources
    • How Pixie uses eBPF
    • Roadmap
    • FAQ
    • Troubleshooting
  • Installing Pixie
    • Requirements
  • Using Pixie
    • Using the Live UI
    • Using the CLI
    • Using the API
  • Tutorials
  • Reference
    • Architecture
    • PxL
      • DataFrame
        • DataFrame.__getitem__
        • DataFrame.agg
        • DataFrame.append
        • DataFrame.ctx.__getitem__
        • DataFrame.DataFrame
        • DataFrame.drop
        • DataFrame.filter
        • DataFrame.groupby
        • DataFrame.head
        • DataFrame.map
        • DataFrame.merge
        • DataFrame.rolling
        • DataFrame.stream
        • px.debug
        • px.display
        • px.export

DataFrame.agg

Aggregates the data based on the expressions.

Computes the aggregate expressions on the data. If the preceding operator is a groupby, then we evaluate the aggregate expression in each group. If not, we calculate the aggregate expression using all of the preceding data. If no arguments specified and the call follows a grouped DataFrame, then agg() returns the unique groups. If following a non-grouped DataFrame agg() with no args will yield a compilation error. Each aggregate expression is simply the aggregate function applied to a column, formatted as <out_col_name>=("<column_name>", <function>). A list of functions are available in the UDA docs

Arguments

NameTypeDescription
**kwargsTuple[string, AggFn]The column, aggregate function pair that make up the expression to apply, assigned to the output column name. `<out_col_name>=("<column_name>", <function>)`. If this value is empty, it will return the unique groups in the previous DataFrame.

Returns

px.DataFrame: DataFrame with aggregated expressions evaluated containing the groups (if any) followed by the output column aggregate expression names.

Examples

# Group by UPID and calculate maximum user time for the each
# UPID group.
df = px.DataFrame('process_stats')
df = df.groupby('upid').agg(cpu_utime=('cpu_utime_ns', px.max))

This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.