Skip to content

BUG: support variable-width strings in str.extract - #11793

Open
jdotc1 wants to merge 3 commits into
pydata:mainfrom
jdotc1:fix/jdotc1-pr-10-xarray-string-extract-20261023
Open

jdotc1 wants to merge 3 commits into
pydata:mainfrom
jdotc1:fix/jdotc1-pr-10-xarray-string-extract-20261023

Conversation

@jdotc1

@jdotc1 jdotc1 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Description

DataArray.str.extract(..., dim=...) fails for NumPy variable-width string arrays because elements reaching the capture helper are Python strings without a dtype attribute. Use object arrays for the intermediate captures, then retain the existing cast to the input string dtype kind.

The regression covers raw and compiled patterns for variable-width strings, Unicode and bytes, including optional groups and unmatched values. The entire string-accessor test module passed locally (265 tests), as did Ruff lint and formatting checks on the two Python files. Full project CI and the dependency/platform matrix remain outstanding.

Related to #11785; this addresses the extraction failure only.

Checklist

  • Regression tests added.
  • Visible bug fix documented in doc/whats-new.rst.
  • No public API or dependency added.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant