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?
- A.
pandas.DataFrame(data, index, col, dtype, copy)
- B.
pandas.DataFrame(data, index, row, dtype, copy)
- C.
pandas.dataFrame(data, index, dtype, copy)
- 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.