Skip to content

BUG: Regression in splitting in read_table #54931

Closed
@rikardn

Description

@rikardn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO CSVread_csv, to_csvRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions