Conflict b/w skiprows and default quotechar kwargs to pandas.read_table · Issue #14459 · pandas-dev/pandas (original) (raw)
A small, complete example of the issue
while trying to open a data file similar to
a
b"
c
d
e"
a,b,c
1,2,3
4,5,6
7,8,9
i expect the following code
python -c "import pandas; df = pandas.read_table('quoted_data.csv', skiprows=5, sep=','); print df"
Expected Output
a b c
0 1 2 3
1 4 5 6
2 7 8 9
Observed Output
Empty DataFrame
Columns: [7,8,9]
Index: []
Further Insight
python -c "import pandas; df = pandas.read_table('quoted_data.csv', skiprows=2, sep=','); print df"
surprisingly works. also,
python -c "import pandas; df = pandas.read_table('quoted_data.csv', skiprows=5, quotechar="?", sep=','); print df"
works
The behavior changed between pandas
0.18.0
and 0.18.1
. we suspect changes made in #12900 to be causing this.
Note that the difference in skiprows
values that works (2) and that doesn't (5) is the same as the number of lines in the file between quote chars.
Apologies for the noise if this has already been reported or is being addressed.
Output of pd.show_versions()
## INSTALLED VERSIONS
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Darwin
OS-release: 16.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.19.0
nose: 1.3.7
pip: 8.1.2
setuptools: 23.1.0
Cython: 0.24
numpy: 1.10.4
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.1
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: 2.4.0
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: 3.6.0
bs4: 4.4.1
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None