Description
Code Sample
from io import StringIO
import pandas as pd
# Notice that the second row has an extra column
data = """UNITID,XTUIT1,TUITION1
100636,"R",0,
"""
f = StringIO(data)
df = pd.read_csv(f)
print(df)
Actual Output
UNITID XTUIT1 TUITION1
100636 R 0
Problem description
This behavior shifts column names, where the first column of data no longer matches the first column name. It also sets the extra data as the index, leading to very unexpected results.
Expected Output
UNITID XTUIT1 TUITION1 Unnamed: 3
0 100636 R 0
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.0.final.0
python-bits: 64
OS: Darwin
OS-release: 16.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 34.0.1
Cython: None
numpy: 1.12.0
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.9999999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.4
boto: None
pandas_datareader: None