diff --git a/apis/python/src/tiledbsoma/_query.py b/apis/python/src/tiledbsoma/_query.py index 3ee8e40f7f..c3d36b0a6f 100644 --- a/apis/python/src/tiledbsoma/_query.py +++ b/apis/python/src/tiledbsoma/_query.py @@ -752,6 +752,7 @@ def to_spatialdata( # type: ignore[no-untyped-def] "Unable to export to SpatialData; exported assets have " "overlapping observations." ) from err + ad.obs["region_key"] = pd.Categorical(ad.obs["region_key"]) regions = list(region_joinids.keys()) region_key = "region_key" instance_key = "instance_key"