Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: failing example in the read_csv docs #23954

Closed
jorisvandenbossche opened this issue Nov 27, 2018 · 3 comments
Closed

DOC: failing example in the read_csv docs #23954

jorisvandenbossche opened this issue Nov 27, 2018 · 3 comments
Labels
Milestone

Comments

@jorisvandenbossche
Copy link
Member

On the travis build on master, we have the following traceback:

>>>-------------------------------------------------------------------------
Exception in /home/travis/build/pandas-dev/pandas/doc/source/io.rst at block ending on line 668
Specify :okexcept: as an option in the ipython:: block to suppress this message
---------------------------------------------------------------------------
EmptyDataError                            Traceback (most recent call last)
<ipython-input-70-2ad3ec79b56f> in <module>
----> 1 pd.read_csv(StringIO(data), comment='#', skiprows=4, header=1)
~/build/pandas-dev/pandas/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
    694                     skip_blank_lines=skip_blank_lines)
    695 
--> 696         return _read(filepath_or_buffer, kwds)
    697 
    698     parser_f.__name__ = name
~/build/pandas-dev/pandas/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
    421 
    422     # Create the parser.
--> 423     parser = TextFileReader(filepath_or_buffer, **kwds)
    424 
    425     if chunksize or iterator:
~/build/pandas-dev/pandas/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
    887             self.options['has_index_names'] = kwds['has_index_names']
    888 
--> 889         self._make_engine(self.engine)
    890 
    891     def close(self):
~/build/pandas-dev/pandas/pandas/io/parsers.py in _make_engine(self, engine)
   1114     def _make_engine(self, engine='c'):
   1115         if engine == 'c':
-> 1116             self._engine = CParserWrapper(self.f, **self.options)
   1117         else:
   1118             if engine == 'python':
~/build/pandas-dev/pandas/pandas/io/parsers.py in __init__(self, src, **kwds)
   1804         kwds['usecols'] = self.usecols
   1805 
-> 1806         self._reader = parsers.TextReader(src, **kwds)
   1807         self.unnamed_cols = self._reader.unnamed_cols
   1808 
~/build/pandas-dev/pandas/pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
EmptyDataError: No columns to parse from file
<<<-------------------------------------------------------------------------

It's failing on this example:

data = '# empty\n# second empty line\n# third empty' \
        'line\nX,Y,Z\n1,2,3\nA,B,C\n1,2.,4.\n5.,NaN,10.0'
print(data)
pd.read_csv(StringIO(data), comment='#', skiprows=4, header=1)

Failing in the dev docs (second example in the warning box): http://pandas-docs.github.io/pandas-docs-travis/io.html#ignoring-line-comments-and-empty-lines
Working find in stable docs: http://pandas.pydata.org/pandas-docs/stable/io.html#ignoring-line-comments-and-empty-lines

Not directly sure why this is failing, it might also be something sphinx/ipython related, and not necessarily a regression in read_csv.

cc @gfyoung

@jorisvandenbossche jorisvandenbossche added this to the 0.24.0 milestone Nov 27, 2018
@jorisvandenbossche
Copy link
Member Author

it might also be something sphinx/ipython related,

Ah, looking better at the rendered version of the dev docs, it indeed seems to be IPython directive related. The multi-line data definition is split somehow.

@jorisvandenbossche
Copy link
Member Author

@TomAugspurger this might be related to an earlier bug you reported to IPython?

@TomAugspurger
Copy link
Contributor

similar, but different ipython/ipython#11517

@jreback jreback added the Docs label Nov 29, 2018
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this issue Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this issue Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants