MCPcopy Create free account
hub / github.com/dask/dask / kurtosis

Method kurtosis

dask/dataframe/dask_expr/_collection.py:1702–1763  ·  view source on GitHub ↗

.. note:: This implementation follows the dask.array.stats implementation of kurtosis and calculates kurtosis without taking into account a bias term for finite sample size, which corresponds to the default settings of the scipy.stats kurtosis ca

(
        self,
        axis=0,
        fisher=True,
        bias=True,
        nan_policy="propagate",
        numeric_only=False,
    )

Source from the content-addressed store, hash-verified

1700
1701 @derived_from(pd.DataFrame)
1702 def kurtosis(
1703 self,
1704 axis=0,
1705 fisher=True,
1706 bias=True,
1707 nan_policy="propagate",
1708 numeric_only=False,
1709 ):
1710 """
1711 .. note::
1712
1713 This implementation follows the dask.array.stats implementation
1714 of kurtosis and calculates kurtosis without taking into account
1715 a bias term for finite sample size, which corresponds to the
1716 default settings of the scipy.stats kurtosis calculation. This differs
1717 from pandas.
1718
1719 Further, this method currently does not support filtering out NaN
1720 values, which is again a difference to Pandas.
1721 """
1722 _raise_if_object_series(self, "kurtosis")
1723 if axis is None:
1724 raise ValueError("`axis=None` isn't currently supported for `skew`")
1725 axis = self._validate_axis(axis)
1726
1727 if is_dataframe_like(self):
1728 # Let pandas raise errors if necessary
1729 meta = self._meta_nonempty.kurtosis(axis=axis, numeric_only=numeric_only)
1730 else:
1731 meta = self._meta_nonempty.kurtosis()
1732
1733 if axis == 1:
1734 return map_partitions(
1735 M.kurtosis,
1736 self,
1737 meta=meta,
1738 token=self._token_prefix + "kurtosis",
1739 axis=axis,
1740 enforce_metadata=False,
1741 )
1742
1743 if not bias:
1744 raise NotImplementedError("bias=False is not implemented.")
1745 if nan_policy != "propagate":
1746 raise NotImplementedError(
1747 "`nan_policy` other than 'propagate' have not been implemented."
1748 )
1749
1750 frame = self
1751 if frame.ndim > 1:
1752 frame = frame.select_dtypes(
1753 include=["number", "bool"], exclude=[np.timedelta64]
1754 )
1755 m2 = new_collection(Moment(frame, order=2))
1756 m4 = new_collection(Moment(frame, order=4))
1757 result = m4 / m2**2.0
1758 if result.ndim == 1:
1759 result = result.fillna(0.0)

Callers 4

test_skew_kurtFunction · 0.80
test_reductionsFunction · 0.80
test_bias_raisesFunction · 0.80

Calls 8

_raise_if_object_seriesFunction · 0.90
new_collectionFunction · 0.90
MomentClass · 0.90
is_dataframe_likeFunction · 0.85
select_dtypesMethod · 0.80
map_partitionsFunction · 0.70
_validate_axisMethod · 0.45
fillnaMethod · 0.45

Tested by 4

test_skew_kurtFunction · 0.64
test_reductionsFunction · 0.64
test_bias_raisesFunction · 0.64