Skip to content

StringMethods.extract fails on empty series #7241

Closed
@wabu

Description

@wabu

When using extract with more then one group, it fails on empty series:

>>> pd.Series([], dtype=str).str.extract('()')
Series([], dtype: float64)

>>> pd.Series([], dtype=str).str.extract('()()')
ValueError: Shape of passed values is (0, 0), indices imply (2, 0)

I expect it to return an empty DataFrame with the correct columns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions