anndata.AnnData.strings_to_categoricals

anndata.AnnData.strings_to_categoricals#

AnnData.strings_to_categoricals(df=None)[source]#

Transform string annotations to categoricals.

Only affects string annotations that lead to less categories than the total number of observations.

Parameters:
df DataFrame | None (default: None)

If df is None, modifies both obs and var, otherwise modifies df inplace.

Notes

Turns the view of an AnnData into an actual AnnData.