CBSE Class 12 Informatics Practices Question 30 of 70

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

Back to all questions
11
Question

Question 11

While writing a DataFrame onto a CSV file, which argument would you use in to_csv() for NaN values' representation as NULL ?

  1. NaN = NULL
  2. na_rep = NULL
  3. na_value = NULL
  4. na = NULL
Answer

na_rep = NULL

Reason — The na_rep argument in the to_csv() method is used to specify the representation of NaN values in the resulting CSV file. Using na_rep = NULL means that NaN values will be represented as "NULL" in the CSV file.