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.
import pandas as pd from IPython.display import display values = ["a", None, "b"] tuple_arg = ("a", "b") o = pd.Series(values, dtype=object) s = pd.Series(values, dtype="string") a = pd.Series(values, dtype="string[pyarrow]") display( o.str.startswith(tuple_arg), s.str.startswith(tuple_arg), ) try: display( a.str.startswith(tuple_arg) ) except TypeError as e: display(e) # TypeError('expected bytes, tuple found')Issue Description
str.startswith
and str.endswith
methods support arguments of type tuple[str, ...]
. For dtype "string[pyarrow]"
this raises a type error. I've already written a fix and provide a pull request soon.
Don't throw an error and exhibit same behaviour as the object type string array and the pandas string extension array.
Installed Versionspd.show_versions()
INSTALLED VERSIONS ------------------ commit : ba1cccd19da778f0c3a7d6a885685da16a072870 python : 3.11.4.final.0 python-bits : 64 OS : Linux OS-release : 5.15.90.1-microsoft-standard-WSL2 Version : #1 SMP Fri Jan 27 02:56:13 UTC 2023 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 2.1.0
numpy : 1.25.2
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.1.2
lxml.etree : 4.9.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.14.0
pandas_datareader : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 12.0.1
pyreadstat : None
pyxlsb : 1.0.10
s3fs : None
scipy : 1.11.1
sqlalchemy : 2.0.20
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4