Alice is analyzing financial data in a pandas DataFrame named df_finances and wants to update the column names to reflect the new fiscal year's terminology. She has a list of new column names: ['Q1_2024', 'Q2_2024', 'Q3_2024', 'Q4_2024']. Which of the following options should Alice use to correctly update the column names in her DataFrame?

1
df_finances.columns['Q1_2024', 'Q2_2024', 'Q3_2024', 'Q4_2024']
2
df_finances.rename(columns=['Q1_2024', 'Q2_2024', 'Q3_2024', 'Q4_2024'])
3
df_finances.columns = ['Q1_2024', 'Q2_2024', 'Q3_2024', 'Q4_2024']
4
df_finances.columns() = ['Q1_2024', 'Q2_2024', 'Q3_2024', 'Q4_2024']

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation