CBSE Class 12 Informatics Practices
Question 59 of 70
Importing/Exporting Data between CSV Files/MySQL and Pandas — Question 3
Back to all questionsThe two codes are similar in that they both use pd.read_csv() to read a CSV file named 'data.csv' into a pandas DataFrame df. However, they differ in their usage of the nrows parameter. The first code uses the nrows parameter with a value of 5, indicating that it reads only the first 5 rows of the CSV file. On the other hand, the second code does not have the nrows parameter, so it reads the entire CSV file.
For code (i), the output will be a DataFrame containing the first 5 rows of the 'data.csv' file. For code (ii), the output will be a DataFrame containing all the rows of the 'data.csv' file.