CBSE Class 12 Informatics Practices Question 49 of 70

Importing/Exporting Data between CSV Files/MySQL and Pandas — Question 4

Back to all questions
4
Question

Question 4

By default, read_csv() uses the values of first row as column headers in DataFrames. Which argument will you give to ensure that the top/first row's data is used as data and not as column headers ?

Answer

To ensure that the top/first row's data is used as data and not as column headers in a DataFrame when using the read_csv() function, we need to use the header argument and set it to None. The syntax is : <DF> = pandas.read_csv(<filepath>, header = None).