def ccovf(x, y, unbiased=True, demean=True):
    ' crosscovariance for 1D\n\n    Parameters\n    ----------\n    x, y : arrays\n       time series data\n    unbiased : boolean\n       if True, then denominators is n-k, otherwise n\n\n    Returns\n    -------\n    ccovf : array\n        autocovariance function\n\n    Notes\n    -----\n    This uses np.correlate which does full convolution. For very long time\n    series it is recommended to use fft convolution instead.\n    '
    n = len(x)
    if demean:
        xo = (x - x.mean())
        yo = (y - y.mean())
    else:
        xo = x
        yo = y
    if unbiased:
        xi = np.ones(n)
        d = np.correlate(xi, xi, 'full')
    else:
        d = n
    return (np.correlate(xo, yo, 'full') / d)[(n - 1):]
crosscovariance for 1D

Parameters
----------
x, y : arrays
   time series data
unbiased : boolean
   if True, then denominators is n-k, otherwise n

Returns
-------
ccovf : array
    autocovariance function

Notes
-----
This uses np.correlate which does full convolution. For very long time
series it is recommended to use fft convolution instead.
def ccovf(x, y, unbiased=True, demean=True):
    ' crosscovariance for 1D\n\n    Parameters\n    ----------\n    x, y : arrays\n       time series data\n    unbiased : boolean\n       if True, then denominators is n-k, otherwise n\n\n    Returns\n    -------\n    ccovf : array\n        autocovariance function\n\n    Notes\n    -----\n    This uses np.correlate which does full convolution. For very long time\n    series it is recommended to use fft convolution instead.\n    '
    n = len(x)
    if demean:
        xo = (x - x.mean())
        yo = (y - y.mean())
    else:
        xo = x
        yo = y
    if unbiased:
        xi = np.ones(n)
        d = np.correlate(xi, xi, 'full')
    else:
        d = n
    return (np.correlate(xo, yo, 'full') / d)[(n - 1):]