Skip to content

Problem detecting separator (sep=None) with a DataFrame with a single column #17333

Closed
@Leobouloc

Description

@Leobouloc

Code Sample

from io import StringIO

import pandas as pd

TESTDATA=StringIO("""col1
    val1
    val2d
    val3
    val4
    """)

df = pd.read_csv(TESTDATA, sep=None, engine='python')
print(df)

returns:

           c  l1
0       val1 NaN
1      val2d NaN
2       val3 NaN
3       val4 NaN

Problem

I would expect the input to be detected as a DataFrame with one column (with no seperator) which is not the case here...

Expected Output

        col1
0       val1
1      val2d
2       val3
3       val4

Output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-92-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.20.3
pytest: None
pip: 9.0.1
setuptools: 35.0.2
Cython: 0.23.4
numpy: 1.13.1
scipy: 0.19.0
xarray: None
IPython: 6.0.0
sphinx: 1.5.5
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.3
feather: None
matplotlib: 1.5.1
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: 0.7.3
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: 1.1.9
pymysql: None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions