From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Array aggregation

Array aggregation

- [Instructor] All right, so let's take a look at array aggregation methods. So array aggregation methods allow us to calculate things like sum, mean, min and max. Later on, we'll be able to group by and aggregate by categories in our data when we start working with multiple columns of data. But when we're talking about a single piece of information or a single array, we're going to be grouping by all the values in our array and just return a single value. So if I wanted to calculate the sum of all the values in our array, we could use the sum method. So array.sum will return the sum of all values in an array. So the sum of all the values in this array is 3,763. There are 10 elements in this array. So if I wanted to calculate the mean, we could divide that sum by 10, or we could use the mean method. So sales_array.mean will return the average of the values in our array. The max method will return the largest value in an array. In this case, it's 1,827. And the min, not surprisingly…

Contents