Pandas Series: aggregate() function
Aggregation with pandas series
The aggregate() function uses to one or more operations over the specified axis.
Syntax:
Series.aggregate(self, func, axis=0, *args, **kwargs)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
func | Function to use for aggregating the data. If a function, must either work when passed a Series or when passed to Series.apply. Accepted combinations are:
|
unction, str, list or dict | Required |
axis | Parameter needed for compatibility with DataFrame. | {0 or ‘index’} | Required |
args | Positional arguments to pass to func. | Required | |
**kwds | Keyword arguments to pass to func. | Required |
Returns: scalar, Series or DataFrame
The return can be:
- scalar : when Series.agg is called with single function
- Series : when DataFrame.agg is called with a single function
- DataFrame : when DataFrame.agg is called with several functions
Notes:agg is an alias for aggregate. Use the alias.
A passed user-defined-function will be passed a Series for evaluation.
Example:
Download the above Notebook from here.
Inviting useful, relevant, well-written and unique guest posts
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework