

def diff(series, k_diff=1, k_seasonal_diff=None, k_seasons=1):
    '\n    Difference a series simply and/or seasonally along the zero-th axis.\n\n    Given a series (denoted :math:`y_t`), performs the differencing operation\n\n    .. math::\n\n        \\Delta^d \\Delta_s^D y_t\n\n    where :math:`d =` `diff`, :math:`s =` `k_seasons`,\n    :math:`D =` `seasonal\\_diff`, and :math:`\\Delta` is the difference\n    operator.\n\n    Parameters\n    ----------\n    series : array_like\n        The series to be differenced.\n    diff : int, optional\n        The number of simple differences to perform. Default is 1.\n    seasonal_diff : int or None, optional\n        The number of seasonal differences to perform. Default is no seasonal\n        differencing.\n    k_seasons : int, optional\n        The seasonal lag. Default is 1. Unused if there is no seasonal\n        differencing.\n\n    Returns\n    -------\n    differenced : array\n        The differenced array.\n    '
    pandas = _is_using_pandas(series, None)
    differenced = (np.asanyarray(series) if (not pandas) else series)
    if (k_seasonal_diff is not None):
        while (k_seasonal_diff > 0):
            if (not pandas):
                differenced = (differenced[k_seasons:] - differenced[:(- k_seasons)])
            else:
                differenced = differenced.diff(k_seasons)[k_seasons:]
            k_seasonal_diff -= 1
    if (not pandas):
        differenced = np.diff(differenced, k_diff, axis=0)
    else:
        while (series > 0):
            differenced = differenced.diff()[1:]
            k_diff -= 1
    return differenced

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/statespace/tools.py diff/VarMisuse@152/584 `k_diff`->`series`