ether.

    The function passed to ``apply`` must take a {input} as its first
    argument and return a dataframe, a series or a scalar. ``apply`` will
    then take care of combining the results back together into a single
    dataframe or series. ``apply`` is therefore a highly flexible
    grouping method.

    While ``apply`` is a very flexible method, its downside is that
    using it can be quite a bit slower than using more specific methods.
    Pandas offers a wide range of method that will be much faster
    than using ``apply`` for their specific purposes, so try to use them
    before reaching for ``apply``.

    Parameters
    ----------
    func : function
        A callable that takes a {input} as its first argument, and
        returns a dataframe, a series or a scalar. In addition the
        callable may take positional and keyword arguments
    args, kwargs : tuple and dict
        Optional positional and keyword arguments to pass to ``func``

    Returns
    -------
    applied : Series or DataFrame

    Notes
    -----
    In the current implementation ``apply`` calls func twice on the
    first group to decide whether it can take a fast or slow code
    path. This can lead to unexpected behavior if func has
    side-effects, as they will take effect twice for the first
    group.

    Examples
    --------
    {examples}

    See also
    --------
    pipe : Apply function to the full GroupBy object instead of to each
        group.
    aggregate, transform
    a