bioalpha.h5ad_map.H5ADMap.rename_categories

H5ADMap.rename_categories(key: str, categories: Sequence[Any])

Rename categories of annotation key in obs, var, and uns.

Only supports passing a list/array-like categories argument.

Besides calling self.obs[key].cat.categories = categories – similar for var - this also renames categories in unstructured annotation that uses the categorical annotation key.

Parameters:
  • key – Key for observations or variables annotation.

  • categories – New categories, the same number as the old categories.