Skip to content
Advertisement

problem with csv file to open it with csv.reader

I have the following code:

JavaScript

But it errors:

JavaScript

When I change 'rb' to 'rt':

JavaScript

It says:

JavaScript

And when I delete .astype('float'), the result is (769, 9) but the expected result is (768, 9).

It counts the header as data. Can you tell me why?

Advertisement

Answer

Before you do following:

JavaScript

try

JavaScript

which should skip the header of csvfiles.

It is described @ https://docs.python.org/3/library/csv.html#csv.csvreader.__next__

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement