You want header=None False gets the type pushed to int at 0 , see docs :
header: int or list of ints, default 'infer The number of rows to use as column names and the start of the data. The default behavior looks like it is set to 0 if the names are not passed, otherwise None . Explicitly pass header = 0 to be able to replace existing names. The header can be a list of integers indicating the location of the rows for the multi-index on the columns, for example [0,1,3]. Intermediate lines that are not specified will be skipped (for example, 2 is skipped in this example). Note that this parameter ignores commented lines and empty lines if skip_blank_lines = True, so header = 0 indicates the first line of data, and not the first line of the file.
You can see the difference in behavior, first with header=0 :
In [95]: import io import pandas as pd t="""a,b,c 0,1,2 3,4,5""" pd.read_csv(io.StringIO(t), header=0) Out[95]: abc 0 0 1 2 1 3 4 5
Now with None :
In [96]: pd.read_csv(io.StringIO(t), header=None) Out[96]: 0 1 2 0 abc 1 0 1 2 2 3 4 5
Note that in the latest version 0.19.1 will now be displayed:
In [98]: pd.read_csv(io.StringIO(t), header=False)
TypeError: passing a bool header is not allowed. Use header = None for no header or header = int or list-like from int to specify the row (s) creating the column names
Edchum
source share