cbll cbll - 1 year ago 160
Python Question

Python 2.7 Anaconda Pandas error(Ubuntu 14.04)

I'm doing a data science course on udemy using python 2.7, running Anaconda. My OS is Ubuntu 14.04.

I'm getting the following error running with the pandas module:

Traceback (most recent call last):
File "/home/flyveren/PycharmProjects/Udemy/15_DataFrames.py", line 13, in <module>
nfl_frame = pd.read_clipboard()
File "/home/flyveren/anaconda/lib/python2.7/site-packages/pandas/io/clipboard.py", line 51, in read_clipboard
return read_table(StringIO(text), **kwargs)
File "/home/flyveren/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py", line 474, in parser_f
return _read(filepath_or_buffer, kwds)
File "/home/flyveren/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py", line 260, in _read
return parser.read()
File "/home/flyveren/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py", line 721, in read
ret = self._engine.read(nrows)
File "/home/flyveren/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py", line 1170, in read
data = self._reader.read(nrows)
File "pandas/parser.pyx", line 769, in pandas.parser.TextReader.read (pandas/parser.c:7544)
File "pandas/parser.pyx", line 791, in pandas.parser.TextReader._read_low_memory (pandas/parser.c:7784)
File "pandas/parser.pyx", line 844, in pandas.parser.TextReader._read_rows (pandas/parser.c:8401)
File "pandas/parser.pyx", line 831, in pandas.parser.TextReader._tokenize_rows (pandas/parser.c:8275)
File "pandas/parser.pyx", line 1742, in pandas.parser.raise_parser_error (pandas/parser.c:20691)
pandas.parser.CParserError: Error tokenizing data. C error: Expected 11 fields in line 5, saw 12

I've tried
conda uninstall pandas
and subsequently
conda install pandas
again to see, however with the same result. The package is there, it tells me an error if I uninstall and try to run the code again with missing package, but it gives this error when it's properly installed.

Anyone knows what's up?

Answer Source

So, the solution was essentially to create a virtual environment and install the needed packages independently. Some issues with dependencies on my system, I believe.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download