def _choose_cov(self, cov_type, **cov_config):
cov_est = self._cov_estimators[cov_type]
if cov_type != "clustered":
return cov_est, cov_config
cov_config_upd = {k: v for k, v in cov_config.items()}
clusters = cov_config.get("clusters", None)
if clusters is not None:
clusters = self.reformat_clusters(clusters).copy()
for col in clusters.dataframe:
cat = pd.Categorical(clusters.dataframe[col])
clusters.dataframe[col] = cat.codes.astype(np.int64)
clusters = clusters.dataframe