Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
AggregateRows
  • See Also
    • ToTabular
    • FromTabular
    • ConstructColumns
    • TransformColumns
    • PivotFromColumns
    • PivotToColumns
    • PivotTable
  • Related Guides
    • Tabular Transformation
    • Tabular Processing Overview
    • Tabular Communication
    • Tabular Objects
    • See Also
      • ToTabular
      • FromTabular
      • ConstructColumns
      • TransformColumns
      • PivotFromColumns
      • PivotToColumns
      • PivotTable
    • Related Guides
      • Tabular Transformation
      • Tabular Processing Overview
      • Tabular Communication
      • Tabular Objects

AggregateRows[tab,{key1f1,…}]

computes different aggregation functions fi[tab] and assigns them to different keys keyi.

AggregateRows[tab,fspec,gspec]

forms groups by the distinct values given by gspec and then aggregates them using fspec.

AggregateRows[fspec]

represents an operator form for the two-argument version of AggregateRows.

AggregateRows[fspec,gspec]

represents an operator form for the three-argument version of AggregateRows.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Input Data  
Aggregation Functions  
Grouping Specifications  
Applications  
Possible Issues  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ToTabular
    • FromTabular
    • ConstructColumns
    • TransformColumns
    • PivotFromColumns
    • PivotToColumns
    • PivotTable
  • Related Guides
    • Tabular Transformation
    • Tabular Processing Overview
    • Tabular Communication
    • Tabular Objects
    • See Also
      • ToTabular
      • FromTabular
      • ConstructColumns
      • TransformColumns
      • PivotFromColumns
      • PivotToColumns
      • PivotTable
    • Related Guides
      • Tabular Transformation
      • Tabular Processing Overview
      • Tabular Communication
      • Tabular Objects

AggregateRows

AggregateRows[tab,{key1f1,…}]

computes different aggregation functions fi[tab] and assigns them to different keys keyi.

AggregateRows[tab,fspec,gspec]

forms groups by the distinct values given by gspec and then aggregates them using fspec.

AggregateRows[fspec]

represents an operator form for the two-argument version of AggregateRows.

AggregateRows[fspec,gspec]

represents an operator form for the three-argument version of AggregateRows.

Details

  • AggregateRows is also known as tabular reduce.
  • AggregateRows is typically used to summarize the data in groups of rows.
  • Possible forms of tab include:
  • Tabular[…]type-consistent tabular data
    Dataset[…]general hierarchical data
    {assoc1,assoc2,…}list of associations with common keys
  • The application of AggregateRows does not change the form of tab.
  • For each group, there is a subtabular stab corresponding to a subset of rows of tab. The aggregation functions fi are applied to the association of columns given by FromTabular[stab,"Columns"].
  • Possible forms of grouping specification gspec include:
  • keygroups by distinct values associated with key
    newkeyggroups by distinct values of g[rowi], adding them as newkey
    {spec1,…}groups by distinct values of all the speci together

Examples

open all close all

Basic Examples  (2)

Take a Tabular object:

Aggregate all rows by computing the joined string of "col1" and the total of the values of column "col2":

Aggregate rows by first grouping those with common value of column "col1" and then totaling:

Use operator form to aggregate a list of associations by computing a function of the values of key "a":

Aggregate associations by first grouping those with common value of key "b":

Scope  (8)

Input Data  (3)

Aggregate all rows of a Tabular object:

Aggregate all rows of a Dataset object:

Aggregate a list of associations:

Aggregation Functions  (2)

Take a Tabular object:

The aggregation function f receives an association with all columns, each one a list of values:

Use a pure function with named Slot notation to extract individual columns in the aggregation:

Alternatively, use Part notation:

Aggregate a Tabular object with a list of aggregation functions:

Mix the original columns in the computation:

Grouping Specifications  (3)

Aggregate rows by first grouping those with common value of column "col1" and then averaging:

Aggregate rows by grouping those with common value determined by the function g and then averaging:

Use a specific grouping function:

Take a Tabular object:

Aggregate rows by first grouping those with common values of pairs of columns "b" and "c":

Group by common values of pairs {"b"+"c","c"}:

Applications  (6)

Take a Tabular object with measurements of soil pH at three depth levels of 0, 30 and 80 meters:

Find mean pH for each depth:

Take measurements of various species of iris flower:

Compute the mean of the second column:

Compute the median of the "PetalLength" column:

Compute number of observations for each species:

Compute the mean of "SepalLength" for each species variety:

Old Faithful geyser data containing eruption times and next eruption waiting times in minutes:

Compute correlation between the columns:

Visualize the waiting time vs. duration:

Compute mean of the durations depending on the waiting time:

Convert into the normal form of the Tabular object:

Take a table of data about penguins in the Palmer Archipelago:

Extract column names:

Find the mean body weight for each sex:

Find the median body weight for each island location:

Find the body mass distribution for each species:

Plot the PDF for each estimated distribution:

Take a Tabular object with data of monthly ozone readings for Los Angeles:

Compute the mean for each column, each month:

Visualize the mean seasonality:

Take a Tabular object with data for a selection of car models:

Find the mean city and highway milage per each drive type and year:

Find the mean city and highway milage per each manufacturer for year 2008:

Possible Issues  (1)

Using AggregateRows without grouping input may reduce a Tabular object too much:

Tally species varieties:

Use grouping:

See Also

ToTabular  FromTabular  ConstructColumns  TransformColumns  PivotFromColumns  PivotToColumns  PivotTable

Related Guides

    ▪
  • Tabular Transformation
  • ▪
  • Tabular Processing Overview
  • ▪
  • Tabular Communication
  • ▪
  • Tabular Objects

History

Introduced in 2025 (14.2)

Wolfram Research (2025), AggregateRows, Wolfram Language function, https://reference.wolfram.com/language/ref/AggregateRows.html.

Text

Wolfram Research (2025), AggregateRows, Wolfram Language function, https://reference.wolfram.com/language/ref/AggregateRows.html.

CMS

Wolfram Language. 2025. "AggregateRows." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AggregateRows.html.

APA

Wolfram Language. (2025). AggregateRows. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AggregateRows.html

BibTeX

@misc{reference.wolfram_2025_aggregaterows, author="Wolfram Research", title="{AggregateRows}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/AggregateRows.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_aggregaterows, organization={Wolfram Research}, title={AggregateRows}, year={2025}, url={https://reference.wolfram.com/language/ref/AggregateRows.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English