Python Pandas Error: ValueError: Expected "X" fields in line "Y", saw "Z"

Viewed 3616

I'm trying to use this code to read in data from an Excel file:

import pandas as pd
import numpy as np
df = pd.read_excel('flielocation.xlsx',  sheetname=None)

I get an error that says ValueError: Expected 9 fields in line 3, saw 8. How can I fix it?

2 Answers

In my case, reading in a csv file using ; as separator, I'd forgotten to inform python of this. So now I have: x = pd.read_csv('path/to/file/file.csv', sep = ';'). Which works file.

Related