pypsa.statistics.grouping.Groupers.add_grouper#
- Groupers.add_grouper(name: str, func: Callable) None #
Add a custom grouper to groupers on module level.
After registering a custom grouper, it can be accessed via the groupers module level object and used in the statistics methods or as a groupers method.
- Parameters:
name (str) – Name of the custom grouper. This will be used as the key in the groupby argument.
func (Callable) – Custom grouper function, which must return a pandas Series with the same length as the component index and accept as arguments: * n (Network): The PyPSA network instance * c (str): Component name * port (str): Component port as integer string * nice_names (bool, optional): Whether to use nice carrier names
- Return type:
None