pd.read_csv prefix parameter seems do not works · Issue #27394 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

field,data,values
text1,34,hh,fail
text2,76,tt,fail2

import pandas as pd

if name == "main": data_list = pd.read_csv('test.csv', prefix="X") print(data_list)

Problem description

A documentation said:

prefix : str, optional
    Prefix to add to column numbers when no header, e.g. ‘X’ for X0, X1, …

If I understood correctly this documentation I should get this

Expected Output

field    data    values  X0
text1     34    hh        fail
text2     76    tt         fail2

But I got this anyway:

Current Output

          field  data    values
text1     34    hh      fail
text2     76    tt        fail2

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

INSTALLED VERSIONS

commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Windows
OS-release: 8.1
machine: AMD64
processor: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.24.2
pytest: None
pip: 19.1.1
setuptools: 40.1.0
Cython: None
numpy: 1.15.0
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.3
openpyxl: 2.5.5
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: 4.1.1
bs4: 4.6.0
html5lib: None
sqlalchemy: 1.2.19
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
None