pd.read_clipboard()在Python 2上给出了一个错误

时间:2016-09-20 21:57:01

标签: python pandas numpy

这个我的代码

import numpy as np
import pandas as pd
from pandas import Series,DataFrame

import webbrowser
website = 'http://en.wikipedia.org/wiki/NFL_win-loss_records'
webbrowser.open(website)

nfl_frame = pd.read_clipboard()

以下是错误信息

CParserError                              Traceback (most recent call last)
<ipython-input-14-2e5b27c84e34> in <module>()
----> 1 nfl_frame = pd.read_clipboard()

C:\Users\Sam\Anaconda2\lib\site-packages\pandas\io\clipboard.pyc in read_clipboard(**kwargs)
     49         kwargs['sep'] = '\s+'
     50 
---> 51     return read_table(StringIO(text), **kwargs)
     52 
     53 

C:\Users\Sam\Anaconda2\lib\site-packages\pandas\io\parsers.pyc 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, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
    560                     skip_blank_lines=skip_blank_lines)
    561 
--> 562         return _read(filepath_or_buffer, kwds)
    563 
    564     parser_f.__name__ = name

C:\Users\Sam\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in _read(filepath_or_buffer, kwds)
    323         return parser
    324 
--> 325     return parser.read()
    326 
    327 _parser_defaults = {

C:\Users\Sam\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in read(self, nrows)
    813                 raise ValueError('skip_footer not supported for iteration')
    814 
--> 815         ret = self._engine.read(nrows)
    816 
    817         if self.options.get('as_recarray'):

C:\Users\Sam\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in read(self, nrows)
   1312     def read(self, nrows=None):
   1313         try:
-> 1314             data = self._reader.read(nrows)
   1315         except StopIteration:
   1316             if self._first_chunk:

pandas\parser.pyx in pandas.parser.TextReader.read (pandas\parser.c:8748)()

pandas\parser.pyx in pandas.parser.TextReader._read_low_memory (pandas\parser.c:9003)()

pandas\parser.pyx in pandas.parser.TextReader._read_rows (pandas\parser.c:9731)()

pandas\parser.pyx in pandas.parser.TextReader._tokenize_rows (pandas\parser.c:9602)()

pandas\parser.pyx in pandas.parser.raise_parser_error (pandas\parser.c:23325)()

CParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 3

0 个答案:

没有答案