Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/spatialdata/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ def _add_metadata_and_validate(
# It also just changes the state of the series, so it is not a big deal.
if isinstance(data[c].dtype, CategoricalDtype) and not data[c].cat.known:
try:
data[c] = data[c].cat.set_categories(data[c].head(1).cat.categories)
data[c] = data[c].cat.set_categories(data[c].compute().cat.categories)
except ValueError:
logger.info(f"Column `{c}` contains unknown categories. Consider casting it.")

Expand Down
Loading