Skip to main contentSkip to solution

__________ implies that column names are inferred from the first line of the file while using Pandas read_csv() function.

Solution

✅ Correct Option: 2

In pd.read_csv(), the header parameter gives the row number to use as column names. Row numbering starts at 0, so header=0 means the first line of the file becomes the column names.

This is also the default behaviour (header='infer') when no names argument is passed.


Option 3: header=1 takes the second line as column names and discards the first line.

Options 1 and 4: head is not a parameter of read_csv(). head() is a DataFrame method that shows the first few rows, and it is not related to column names.

Keyboard Shortcuts

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