diff --git a/src/spatialdata_io/readers/xenium.py b/src/spatialdata_io/readers/xenium.py index 5940ae3d..deea8914 100644 --- a/src/spatialdata_io/readers/xenium.py +++ b/src/spatialdata_io/readers/xenium.py @@ -468,6 +468,8 @@ def _get_labels_and_indices_mapping( "label_index": real_label_index.astype(np.int64), } ) + # because AnnData converts the indices to str + indices_mapping.index = indices_mapping.index.astype(str) return labels, indices_mapping @@ -497,6 +499,8 @@ def _get_cells_metadata_table_from_zarr( cell_id_str = cell_id_str_from_prefix_suffix_uint32(cell_id_prefix, dataset_suffix) df[XeniumKeys.CELL_ID] = cell_id_str + # because AnnData converts the indices to str + df.index = df.index.astype(str) return df