Skip to content

BUG: Regression in splitting in read_table #54931

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

Closed
2 of 3 tasks
rikardn opened this issue Sep 1, 2023 · 1 comment · Fixed by #54954
Closed
2 of 3 tasks

BUG: Regression in splitting in read_table #54931

rikardn opened this issue Sep 1, 2023 · 1 comment · Fixed by #54954
Labels
Bug IO CSV read_csv, to_csv Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@rikardn
Copy link

rikardn commented Sep 1, 2023

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

s =  """ITERATION    THETA1       THETA2       THETA3       SIGMA(1,1)   OMEGA(1,1)   OMEGA(2,1)   OMEGA(2,2)   OBJ
            0  4.69307E-03  1.00916E+00  1.00000E-01  1.30865E-02  3.09626E-02  0.00000E+00  3.11280E-02    587.36644134661617
"""

import pandas as pd
from io import StringIO

df = pd.read_table(StringIO(s), sep=r'\s+', engine='c')
df.columns

# Output:
#Index(['ITERATION', 'THETA1', 'THETA2', 'THETA3', 'SIGMA(1', '1)', 'OMEGA(1',
#       '1).1', 'OMEGA(2', '1).2', 'OMEGA(2.1', '2)', 'OBJ'],
#      dtype='object')

Issue Description

Using pandas 2.1.0 the example doesn't split the column labels correctly. It splits on booth spaces and commas. This used to work fine in earlier versions of pandas.

Expected Behavior

Expected is to not split on commas here.

Installed Versions

INSTALLED VERSIONS

commit : ba1cccd
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-82-generic
Version : #91-Ubuntu SMP Mon Aug 14 14:14:14 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 : 2022.1
dateutil : 2.8.2
setuptools : 59.6.0
pip : 22.0.2
Cython : None
pytest : 7.2.2
hypothesis : None
sphinx : 6.1.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.31.1
pandas_datareader : None
bs4 : 4.10.0
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : 2023.4.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : 2.3.0
pyqt5 : None

@rikardn rikardn added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 1, 2023
@rhshadrach
Copy link
Member

rhshadrach commented Sep 1, 2023

Looks like a duplicate of #54918 (assuming the code paths are the same).

@lithomas1 lithomas1 added IO CSV read_csv, to_csv Regression Functionality that used to work in a prior pandas version and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 2, 2023
@lithomas1 lithomas1 added this to the 2.1.1 milestone Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO CSV read_csv, to_csv Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants