What will be the default value of parameter 'header' while loading a 'csv' file in to a DataFrame?
What will be the default value of parameter 'header' while loading a 'csv' file in to a DataFrame?
Solution
✅ Correct Option: 1
In pandas, read_csv() uses header='infer' by default. When no names are passed, this behaves like header=0, so the first row of the file is taken as the column names.
Option 3: header=None (the Python value, not the string 'None') tells pandas the file has no header row, so columns get default integer labels. It is not the default.
Options 2 and 4: 'NaN' and 'NULL' are not valid values for header.
Related questions:
2025: 3 June Shift 2
2025: 16 May Shift 1
2025: 27 May Shift 2