Skip to content

BUG: Multiplying a series of strings with a boolean different for arrow vs. python #62595

@Dr-Irv

Description

@Dr-Irv

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
pd.Series(["a", "b", "c"], dtype="string[python]") * True  # works
pd.Series(["a", "b", "c"], dtype="string") * True  # fails

Issue Description

Multiplying a string series by a boolean doesn't work with arrow based strings
Error reported:

  File "C:\Code\pandas_dev\pandas\pandas\core\ops\common.py", line 70, in new_method
    return method(self, other)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\arraylike.py", line 205, in __mul__
    return self._arith_method(other, operator.mul)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\series.py", line 5924, in _arith_method
    return base.IndexOpsMixin._arith_method(self, other, op)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\base.py", line 1485, in _arith_method
    result = ops.arithmetic_op(lvalues, rvalues, op)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\ops\array_ops.py", line 272, in arithmetic_op
    res_values = op(left, right)
                 ^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\ops\common.py", line 70, in new_method
    return method(self, other)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\arraylike.py", line 205, in __mul__
    return self._arith_method(other, operator.mul)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\arrays\arrow\array.py", line 1051, in _arith_method
    result = self._evaluate_op_method(other, op, ARROW_ARITHMETIC_FUNCS)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\pandas_dev\pandas\pandas\core\arrays\arrow\array.py", line 970, in _evaluate_op_method
    raise TypeError("Can only string multiply by an integer.")
TypeError: Can only string multiply by an integer.

Expected Behavior

No error

Installed Versions

INSTALLED VERSIONS

commit : bb10b27
python : 3.11.13
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.26100
machine : AMD64
processor : Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 3.0.0.dev0+2306.gbb10b27dea.dirty
numpy : 2.2.6
dateutil : 2.9.0.post0
pip : 25.2
Cython : 3.1.3
sphinx : 8.3.0
IPython : 9.5.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.14.0
bottleneck : 1.6.0
fastparquet : 2024.11.0
fsspec : 2025.9.0
html5lib : 1.1
hypothesis : 6.138.15
gcsfs : 2025.9.0
jinja2 : 3.1.6
lxml.etree : 6.0.1
matplotlib : 3.10.6
numba : 0.61.2
numexpr : 2.10.2
odfpy : None
openpyxl : 3.1.5
psycopg2 : 2.9.10
pymysql : 1.4.6
pyarrow : 19.0.1
pyiceberg : 0.9.1
pyreadstat : 1.3.1
pytest : 8.4.2
python-calamine : None
pytz : 2025.2
pyxlsb : 1.0.10
s3fs : 2025.9.0
scipy : 1.16.1
sqlalchemy : 2.0.43
tables : 3.10.2
tabulate : 0.9.0
xarray : 2025.9.0
xlrd : 2.0.2
xlsxwriter : 3.2.5
zstandard : 0.24.0
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operationsStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions