CBSE Class 12 Informatics Practices Question 28 of 44

Data Handling using Pandas — Question 29

Back to all questions
29
Question

Question 26

You want to read data from a CSV file in a dataframe but you want to provide your own column names to the 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>).