Recall & Review
beginner
What is the pandas function to export a DataFrame to a CSV file?
The function is
DataFrame.to_csv(). It saves the DataFrame as a CSV file which can be opened in spreadsheet programs.Click to reveal answer
beginner
How do you export a pandas DataFrame to an Excel file?
Use
DataFrame.to_excel(). It writes the DataFrame to an Excel file with .xlsx extension.Click to reveal answer
beginner
Which pandas method exports a DataFrame to a JSON file?
Use
DataFrame.to_json(). It saves the DataFrame in JSON format, useful for web data exchange.Click to reveal answer
intermediate
What parameter in
to_csv() helps to avoid saving the row index?Set
index=False in to_csv() to prevent saving the DataFrame's row index in the file.Click to reveal answer
intermediate
Why might you choose to export data in multiple formats?
Different formats serve different needs: CSV for simple tables, Excel for formatted sheets, JSON for web apps. Exporting multiple ways makes data usable in many places.
Click to reveal answer
Which pandas method exports a DataFrame to a CSV file?
✗ Incorrect
to_csv() is used to export DataFrames to CSV files.
How do you prevent the row index from being saved in a CSV export?
✗ Incorrect
Setting index=False in to_csv() skips saving the row index.
Which file format is best for sharing data with web applications?
✗ Incorrect
JSON is widely used for web data exchange because it is easy to parse in web apps.
What pandas method would you use to export a DataFrame to an Excel file?
✗ Incorrect
to_excel() exports DataFrames to Excel files.
Which parameter controls whether column headers are saved in CSV export?
✗ Incorrect
The header parameter controls if column names are saved in the CSV file.
Explain how to export a pandas DataFrame to CSV, Excel, and JSON formats. Include key parameters to control the output.
Think about the method names and how to exclude the index or headers.
You got /5 concepts.
Why is it useful to export data in multiple formats? Give examples of when you might use CSV, Excel, and JSON.
Consider how different people or programs might want to use the data.
You got /4 concepts.