简体   繁体   中英

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?

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.

I watch same lecture at udemy and face same problem.

I change my browser from internet explorer to chrome. (I'm using windows7 & VS2013 with PTVS)

Then, error does not occur.

However, delimeter has some problem. Space should not be used as delimeter according to lecture, however, it does. So, result is not perfect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM