在Jupyter笔记本中加载特定Seaborn数据集时出现CParseError

时间:2017-05-26 21:18:16

标签: python-2.7 jupyter-notebook seaborn

当我尝试使用以下方法加载几个数据集时,我收到错误(下面):

import seaborn as sns
exercise = sns.load_dataset("exercise")

import seaborn as sns
titanic = sns.load_dataset("titanic")
但是,这很奇怪,因为iris = sns.load_dataset("iris")效果很好;造成CParserError的原因是什么?

---------------------------------------------------------------------------
CParserError                              Traceback (most recent call last)
<ipython-input-4-6b85a4d6ff71> in <module>()
----> 1 exercise = sns.load_dataset("exercise")
      2 #iris = sns.load_dataset("iris")

    c:\python27\lib\site-packages\seaborn\utils.pyc in load_dataset(name, cache, data_home, **kws)
    425         full_path = cache_path
    426 
--> 427     df = pd.read_csv(full_path, **kws)
    428     if df.iloc[-1].isnull().all():
    429         df = df.iloc[:-1]

c:\python27\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:\python27\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:\python27\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:\python27\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:8620)()

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

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

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

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

CParserError: Error tokenizing data. C error: Expected 1 fields in line 24, saw 2

0 个答案:

没有答案