CBSE Class 12 Informatics Practices Question 48 of 70

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

Back to all questions
3
Question

Question 3

You want to read data from a CSV file in a DataFrame but you want to provide your own column names to DataFrame. What additional argument would you specify in read_csv() ?

Answer

To read data from a CSV file into a DataFrame while providing our own column names, we can use the names argument in the read_csv() function. The syntax is : <DF> = pandas.read_csv(<filepath>, names = <sequence containing column names>).