Python error "pandas.errors.ParserError: Error tokenizing data"

0 votes

Python Code:

# -*- coding: utf-8 -*-
import pandas as pd

df = pd.read_csv("C:\Users\Kamal\Desktop\Desktop\datasets\ex.xlsx")

for index, row in df.iterrows():
    print (row[1]['emailid'])


  File "pandas\_libs\parsers.pyx", line 899, in
  File "pandas\_libs\parsers.pyx", line 914, in pandas._libs.parsers.TextReader._read_low_memory
  File "pandas\_libs\parsers.pyx", line 968, in pandas._libs.parsers.TextReader._read_rows
  File "pandas\_libs\parsers.pyx", line 955, in pandas._libs.parsers.TextReader._tokenize_rows
  File "pandas\_libs\parsers.pyx", line 2172, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 2 fields in line 11, saw 3
5 days ago in Python by Kamal

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Pandas do not take .xlsx files. Rename the file to .csv and it should work and use the .csv file instead of the .xslx

# -*- coding: utf-8 -*-
import pandas as pd

df = pd.read_csv("C:\Users\Kamal\Desktop\Desktop\datasets\ex.csv")

for index, row in df.iterrows():
    print (row[1]['emailid'])
answered 5 days ago by Rhea

Related Questions In Python

0 votes
1 answer

How to replace values with None in Pandas data frame in Python?

Actually in later versions of pandas this ...READ MORE

answered Aug 30, 2018 in Python by Priyaj
• 56,140 points
0 votes
1 answer

Python pandas axis error

When you are applying sum() you don't ...READ MORE

answered Jan 8 in Python by Omkar
• 66,880 points
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

answered Mar 6 in Python by Mohammad
• 1,400 points
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
+4 votes
6 answers
0 votes
1 answer

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

There is no attribute called “rows”. The ...READ MORE

answered Mar 28 in Python by Shri
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,700 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.