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

Method kurtosis

dask/dataframe/dask_expr/_collection.py:1708–1769  ·  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

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