pandas.Grouper
- 
class pandas.Grouper(key=None, level=None, freq=None, axis=0, sort=False)[source]
- 
A Grouper allows the user to specify a groupby instruction for a target object This specification will select a column via the key parameter, or if the level and/or axis parameters are given, a level of the index of the target object. If axisand/orlevelare passed as keywords to bothGrouperandgroupby, the values passed toGroupertake precedence.Parameters: - 
key : string, defaults to None
- 
groupby key, which selects the grouping column of the target 
- 
level : name/number, defaults to None
- 
the level for the target index 
- 
freq : string / frequency object, defaults to None
- 
This will groupby the specified frequency if the target selection (via key or level) is a datetime-like object. For full specification of available frequencies, please see here. 
- 
axis : number/name of the axis, defaults to 0
- 
sort : boolean, default to False
- 
whether to sort the resulting labels 
- 
closed : {‘left’ or ‘right’}
- 
Closed end of interval. Only when freqparameter is passed.
- 
label : {‘left’ or ‘right’}
- 
Interval boundary to use for labeling. Only when freqparameter is passed.
- 
convention : {‘start’, ‘end’, ‘e’, ‘s’}
- 
If grouper is PeriodIndex and freqparameter is passed.
- 
base : int, default 0
- 
Only when freqparameter is passed.
- 
loffset : string, DateOffset, timedelta object
- 
Only when freqparameter is passed.
 Returns: - A specification for a groupby instruction
 ExamplesSyntactic sugar for df.groupby('A')>>> df.groupby(Grouper(key='A')) Specify a resample operation on the column ‘date’ >>> df.groupby(Grouper(key='date', freq='60s')) Specify a resample operation on the level ‘date’ on the columns axis with a frequency of 60s >>> df.groupby(Grouper(level='date', freq='60s', axis=1)) Attributesax groups 
- 
    © 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
    https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Grouper.html