Skip to main contentSkip to solution

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question