Which of the following is the correct syntax for a pandas DataFrame?

2023

Which of the following is the correct syntax for a pandas DataFrame?

  1. A.

    pandas.DataFrame(data, index, col, dtype, copy)

  2. B.

    pandas.DataFrame(data, index, row, dtype, copy)

  3. C.

    pandas.dataFrame(data, index, dtype, copy)

  4. D.

    pandas.DataFrame(data, index, dtype, copy)

Attempted by 1243 students.

Show answer & explanation

Correct answer: D

Correct signature: pandas.DataFrame(data=None, index=None, columns=None, dtype=None, copy=False) Key points: The constructor name is case-sensitive: use pandas.DataFrame, not pandas.dataFrame.

Explore the full course: Bpsc