1

I tried to read an excel file into the Ijupyer notebook with the following code :

import pandas as pd import numpy as np import matplotlib as plt

df=pd.read_csv('Data_2.xlsx')

However, it gave me the result : ParserError: Error tokenizing data. C error: Expected 1 fields in line 4, saw 2

The excel file looks as such

jpp
  • 134,728
  • 29
  • 196
  • 240
Matthew
  • 25
  • 7
  • Why don't you use [read_excel](http://pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.read_excel.html)? – zipa May 29 '18 at 09:00
  • Also, you have comma in your last column, which is a default separator. – zipa May 29 '18 at 09:01

1 Answers1

0

read_excel() solves it:

df=pd.read_excel('Data_2.xlsx')
zipa
  • 24,366
  • 6
  • 30
  • 49