-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: rsplit
not behaving as expected with regex "\s" for whitespace
#49006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
rsplit
not behaving as expected with regex "\s" for whitespace
An observation - Pandas split - pandas/pandas/core/strings/accessor.py Lines 858 to 875 in 55dc324
rsplit - pandas/pandas/core/strings/accessor.py Lines 890 to 894 in 55dc324
I believe this is the expected behavior as per current pandas code |
I don't think this is possible - can you check the issue tracker for duplicates please? Pretty sure this is there |
Here it is #46488
|
Closing then, but thanks for the suggestion |
@dannyi96 @MarcoGorelli Thank you for taking the time to look at it and providing the link to the issue that explains that |
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
Issue Description
Splitting is not done at the whitespace before the string "sentence"
Also tried:
s.str.rsplit(r"\s", n=1, expand=True)
What worked:
s.str.rsplit(" ", n=1, expand=True)
Expected Behavior
Installed Versions
INSTALLED VERSIONS
commit : 87cfe4e
python : 3.10.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 167 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.4
dateutil : 2.8.2
setuptools : 58.1.0
pip : 22.2.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.5.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: