def precalculate_factors(self, df):
"""Precomputes the buckets and labels for the Jackknife object.
Args:
df: A pandas dataframe.
"""
if self._unit is None:
self._buckets = np.arange(len(df))
self._bucket_labels = np.arange(len(df))
else:
self._buckets, names = pd.factorize(df[self._unit])
self._bucket_labels = np.arange(len(names))
评论列表
文章目录