A

Admin • 831.35K Points
Coach

Q. How do you change the column names of a DataFrame?

  • (A) df.columns = ['A', 'B']
  • (B) df.rename(columns=['A', 'B'])
  • (C) df.set_columns(['A', 'B'])
  • (D) df.change_columns(['A', 'B'])
  • Correct Answer - Option(A)
  • Views: 8
  • Filed under category Pandas
  • Hashtags:

Explanation by: Admin
You can assign a new list directly to `df.columns` to rename all columns.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.