Dance Party2
Dance Party2

Reputation: 7536

Pandas Read Irregular Data From Clipboard

I am trying to copy data from this CSV file and read it via Pandas.read_clipboard().

I keep getting this error:

ParserError: Error tokenizing data. C error: Expected 5 fields in line 6, saw 7

Is it possible to read in data like this? It works with read_csv (encoding='latin-1') but not read_clipboard.

Thanks in advance!

Upvotes: 1

Views: 1078

Answers (1)

Scott Boston
Scott Boston

Reputation: 153460

Let's use skiprows=6 parameter, to ignore the data at the top of the file which looks like a header and not part of the core dataframe:

df = pd.read_clipboard(sep='\t', skiprows=6)

Upvotes: 2

Related Questions