Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst uses Python's pandas library to read a CSV file into a DataFrame. Which function is used to read the file?

⚠ Common exam trap

The trap is that candidates see plausible-sounding function names like import_csv or load_csv and pick them by pattern-matching, rather than recalling that pandas consistently uses the read_* naming convention for I/O.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

pd.read_csv()

pandas reads delimited text files with the top-level function pd.read_csv(), which parses the CSV into a DataFrame and supports parameters like sep, header, dtype, and parse_dates. It is the canonical entry point for CSV ingestion in pandas and is imported as part of the standard `import pandas as pd` idiom. The other options either do not exist in the pandas API or target a different file format.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    pd.import_csv()

    Why it's wrong here

    pd.import_csv() does not exist in pandas, so calling it raises an AttributeError before any parsing occurs. The tempting pull is that "import" describes loading external data, and pandas does offer import-style helpers elsewhere, such as pd.read_sql or DataFrame.to_csv for writing. Reading CSV files specifically requires pd.read_csv().

  • ✗

    pd.read_excel()

    Why it's wrong here

    pd.read_excel() parses Excel workbooks (.xlsx, .xls) through openpyxl or xlrd, not comma-separated text, so it cannot read the CSV. It is tempting because both are tabular file readers, and it would be correct had the source file been a spreadsheet.

  • ✗

    pd.load_csv()

    Why it's wrong here

    pandas exposes read_csv(); load_csv does not exist in the API, so the call raises AttributeError. It is tempting because load_csv mirrors the naming used by other libraries, such as R's read.csv or SQL loaders, and would be the natural choice when importing delimited data through those tools rather than pandas.

  • ✓

    pd.read_csv()

    Why this is correct

    `pd.read_csv()` parses delimited text into a DataFrame, handling the header row, comma delimiter and type inference automatically. It directly satisfies the stem's requirement to load a CSV file into pandas, unlike `read_excel()` or `read_sql()`, which target different source formats.

About these practice questions

This DA0-002 question is part of Courseiva's 1,004-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This DA0-002 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-002 exam.