anndata.AnnData.obs_names_make_unique

AnnData.obs_names_make_unique(join='-')

Makes the index unique by appending ‘1’, ‘2’, etc.

The first occurance of a non-unique value is ignored.

Parameters:
join : str, optional (default: ‘’)

The connecting string between name and integer.

Examples

>>> adata1 = sc.AnnData(np.ones((3, 2)), {'obs_names': ['a', 'b', 'c']})
>>> adata2 = sc.AnnData(np.zeros((3, 2)), {'obs_names': ['d', 'b', 'b']})
>>> adata = adata1.concatenate(adata2)
>>> adata.obs_names
Index(['a', 'b', 'c', 'd', 'b', 'b'], dtype='object')
>>> adata.obs_names_make_unique()
>>> adata.obs_names
Index(['a', 'b', 'c', 'd', 'b-1', 'b-2'], dtype='object')