anndata.AnnData.strings_to_categoricals

AnnData.strings_to_categoricals(df=None)

Transform string annotations to categoricals.

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

Parameters:
df : DataFrame, NoneOptional[DataFrame]

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

Notes

Turns the view of an AnnData into an actual AnnData.