Compute summary statistics of a variable (a Series).

    The description is different according to the type of the variable.
    However a set of common stats is also computed.

    Parameters
    ----------
    series : Series
        The variable to describe.

    Returns
    -------
    Series
        The description of the variable as a Series with index being stats keys.

def describe_1d(data, **kwargs):
    """Compute summary statistics of a variable (a Series).

    The description is different according to the type of the variable.
    However a set of common stats is also computed.

    Parameters
    ----------
    series : Series
        The variable to describe.

    Returns
    -------
    Series
        The description of the variable as a Series with index being stats keys.
    """

    # Replace infinite values with NaNs to avoid issues with
    # histograms later.
    data.replace(to_replace=[np.inf, np.NINF, np.PINF], value=np.nan, inplace=True)

    result = pd.Series({}, name=data.name)

    vartype = base.get_vartype(data)

    if vartype == base.S_TYPE_UNSUPPORTED:
        result = result.append(describe_unsupported(data))
    else:
        result = result.append(describe_supported(data))

        if vartype == base.S_TYPE_CONST:
            result = result.append(describe_constant_1d(data))
        elif vartype == base.TYPE_BOOL:
            result = result.append(describe_boolean_1d(data))
        elif vartype == base.TYPE_NUM:
            result = result.append(describe_numeric_1d(data, **kwargs))
        elif vartype == base.TYPE_DATE:
            result = result.append(describe_date_1d(data))
        elif vartype == base.S_TYPE_UNIQUE:
            result = result.append(describe_unique_1d(data))
        else:
            # TYPE_CAT
            result = result.append(describe_categorical_1d(data))

    return result