scverse / scverse/spatialdata-io

spatialdata.write fails on Xenium sdata in env with pandas 3.0.0

Open
#364 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

xenium
Dominant language
Python
Stars
103
Forks
65
Avg merge
1h 8m
Merged PRs (30d)
3

Description

I had some headaches trying to write a Xenium dataset as spatialdata object using write.

Error message:

anndata._io.specs.registry.IORegistryError: No method registered for writing <class 'pandas.arrays.ArrowStringArray'> into <class 'zarr.core.group.Group'>
Error raised while writing key '_index' of <class 'zarr.core.group.Group'> to /tables/table/obs

Turns out, with pandas 3.0.0 the default string type changed and a new writer is missing.

Resetting to pandas to "old behavior" did fix things for me, but just letting you know.

import pandas as pd
pd.options.mode.string_storage = "python"

import anndata as ad
ad.settings.allow_write_nullable_strings = True

I'm on spatialdata-io==0.5.1 and anndata==0.12.6 at the time of writing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Xenium sdata write with pandas 3.0.0 and trace the missing writer for pandas.arrays.ArrowStringArray reported while writing table/obs/_index. Done means the dataset writes successfully with the default pandas 3.0.0 string type, without requiring the documented compatibility settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.