Skip to content

ENH: Multiplication of pd.ArrowDtype(pa.string()) and int should support the integral type being a series #56537

Closed
@rohanjain101

Description

@rohanjain101

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Follow up of #51970

The current implementation of multiplying pd.ArrowDtype(pa.string()) by an int, requires the int to be a scalar value. It would be nice to allow the int to be a series, that would be similar to pd.StringDtype() as well.

Feature Description

>>> binary = pd.Series(["abc", "defg"], dtype=ArrowDtype(pa.string()))
>>> repeat = pd.Series([2, -2], dtype="int64[pyarrow]")
>>> binary * repeat
0    abcabc
1
dtype: string[pyarrow]
>>>

pd.StringDtype support this:

>>> binary = pd.Series(["abc", "defg"], dtype=pd.StringDtype())
>>> repeat = pd.Series([2, -2], dtype="int64")
>>> binary * repeat
0    abcabc
1
dtype: string
>>>

Alternative Solutions

NA

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions