def nankurt(values, axis=None, skipna=True, mask=None):
    """
    Compute the sample excess kurtosis

    The statistic computed here is the adjusted Fisher-Pearson standardized
    moment coefficient G2, computed directly from the second and fourth
    central moment.

    Parameters
    ----------
    values : ndarray
    axis: int, optional
    skipna : bool, default True
    mask : ndarray[bool], optional
        nan-mask if known

    Returns
    -------
    result : float64
        Unless input is a float array, in which case use the same
        precision as the input array.

    Examples
    --------
    >>> import pandas.core.nanops as nanops
    >>> s = pd.Series([1,np.nan, 1, 3, 2])
    >>> nanops.nankurt(s)
    -1.2892561983471076
    """
    values = com.values_from_object(values)
    if mask is None:
        mask = isna(values)
    if not is_float_dtype(values.dtype):
        values = values.astype('f8')
        count = _get_counts(mask, axis)
    else:
        count = _get_counts(mask, axis, dtype=values.dtype)

    if skipna:
        values = values.copy()
        np.putmask(values, mask, 0)

    mean = values.sum(axis, dtype=np.float64) / count
    if axis is not None:
        mean = np.expand_dims(mean, axis)

    adjusted = values - mean
    if skipna:
        np.putmask(adjusted, mask, 0)
    adjusted2 = adjusted ** 2
    adjusted4 = adjusted2 ** 2
    m2 = adjusted2.sum(axis, dtype=np.float64)
    m4 = adjusted4.sum(axis, dtype=np.float64)

    with np.errstate(invalid='ignore', divide='ignore'):
        adj = 3 * (count - 1) ** 2 / ((count - 2) * (count - 3))
        numer = count * (count + 1) * (count - 1) * m4
        denom = (count - 2) * (count - 3) * m2 ** 2

    # floating point error
    #
    # #18044 in _libs/windows.pyx calc_kurt follow this behavior
    # to fix the fperr to treat denom <1e-14 as zero
    numer = _zero_out_fperr(numer)
    denom = _zero_out_fperr(denom)

    if not isinstance(denom, np.ndarray):
        # if ``denom`` is a scalar, check these corner cases first before
        # doing division
        if count < 4:
            return np.nan
        if denom == 0:
            return 0

    with np.errstate(invalid='ignore', divide='ignore'):
        result = numer / denom - adj

    dtype = values.dtype
    if is_float_dtype(dtype):
        result = result.astype(dtype)

    if isinstance(result, np.ndarray):
        result = np.where(denom == 0, 0, result)
        result[count < 4] = np.nan

    return result
def nankurt ( values , axis = None , skipna = True , mask = None ) : values = com . values_from_object ( values ) if mask is None : mask = isna ( values ) if not is_float_dtype ( values . dtype ) : values = values . astype ( 'f8' ) count = _get_counts ( mask , axis ) else : count = _get_counts ( mask , axis , dtype = values . dtype ) if skipna : values = values . copy ( ) np . putmask ( values , mask , 0 ) mean = values . sum ( axis , dtype = np . float64 ) / count if axis is not None : mean = np . expand_dims ( mean , axis ) adjusted = values - mean if skipna : np . putmask ( adjusted , mask , 0 ) adjusted2 = adjusted ** 2 adjusted4 = adjusted2 ** 2 m2 = adjusted2 . sum ( axis , dtype = np . float64 ) m4 = adjusted4 . sum ( axis , dtype = np . float64 ) with np . errstate ( invalid = 'ignore' , divide = 'ignore' ) : adj = 3 * ( count - 1 ) ** 2 / ( ( count - 2 ) * ( count - 3 ) ) numer = count * ( count + 1 ) * ( count - 1 ) * m4 denom = ( count - 2 ) * ( count - 3 ) * m2 ** 2 numer = _zero_out_fperr ( numer ) denom = _zero_out_fperr ( denom ) if not isinstance ( denom , np . ndarray ) : if count < 4 : return np . nan if denom == 0 : return 0 with np . errstate ( invalid = 'ignore' , divide = 'ignore' ) : result = numer / denom - adj dtype = values . dtype if is_float_dtype ( dtype ) : result = result . astype ( dtype ) if isinstance ( result , np . ndarray ) : result = np . where ( denom == 0 , 0 , result ) result [ count < 4 ] = np . nan return result
Compute the sample excess kurtosis

    The statistic computed here is the adjusted Fisher-Pearson standardized
    moment coefficient G2, computed directly from the second and fourth
    central moment.

    Parameters
    ----------
    values : ndarray
    axis: int, optional
    skipna : bool, default True
    mask : ndarray[bool], optional
        nan-mask if known

    Returns
    -------
    result : float64
        Unless input is a float array, in which case use the same
        precision as the input array.

    Examples
    --------
    >>> import pandas.core.nanops as nanops
    >>> s = pd.Series([1,np.nan, 1, 3, 2])
    >>> nanops.nankurt(s)
    -1.2892561983471076