CBSE Class 12 Informatics Practices Question 50 of 70

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

Back to all questions
5
Question

Question 5

Which argument would you give to read_csv() if you only want to read top 10 rows of data ?

Answer

The nrows argument can be used to read only the top 10 rows of data from a CSV file using the read_csv() function in pandas. The nrows argument specifies the number of rows of the file to read. The syntax is : df = pandas.read_csv(<filepath>, nrows = 10).