Skip to main contentSkip to solution

Data can be loaded in a DataFrame from a CSV file on the disk by using Pandas _______function.

Solution

✅ Correct Option: 2

Pandas uses pd.read_csv("file.csv") to read a CSV file from disk and return its contents as a DataFrame. The "read" in the name shows that data is being loaded into the program.


Options 1 and 3: these are malformed versions of to_csv(), which does the opposite job. It writes a DataFrame out to a CSV file instead of loading one.

Remember: read_csv() brings data in, to_csv() sends data out.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question