With reference to the parameter header of pd.read_csv(), which of the parameter values allow the column names to be inferred from the first line of csv file?
A. header =1
B. header = 0
C. header = True
D. header = False
With reference to the parameter header of pd.read_csv(), which of the parameter values allow the column names to be inferred from the first line of csv file?
A. header =1
B. header = 0
C. header = True
D. header = False
Solution
header=0 tells pandas that row 0, the first line of the file, holds the column names. This is also what the default header='infer' does when no names are passed.
Option A (header=1): uses the second line as the column names and discards the line above it.
Options C and D (header=True, header=False): pandas does not accept a boolean for header and raises an error. To say the file has no header row, use header=None.
Related questions:
2026: 23 May Shift 2
2026: 31 May Shift 1
2026: 23 May Shift 1