From b2d4f62f4122421ecf85dd6c6f14cc59ae199abd Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Fri, 17 Jan 2025 16:36:12 -0500 Subject: [PATCH] Make region_key a categorical when exporting to SpatialData --- apis/python/src/tiledbsoma/_query.py | 1 + 1 file changed, 1 insertion(+) 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"