I have the following string in Python (is not a list, is a string):
a = ['cc_call_center_sk', 'cc_call_center_id', 'cc_rec_start_date', 'cc_rec_end_date']
I also have the following dataframe:
0 1 2 3
0 AA AB BC CD
1 AZ ZR RT TN
What I want to do is to assign the string 'a' to the columns of the dataframe. I did this:
df.columns = a
But I get the following error:
TypeError: Index(...) must be called with a collection of some kind,
"['cc_call_center_sk', 'cc_call_center_id', 'cc_rec_start_date',
'cc_rec_end_date']" was passed
I cannot pass directly the string to the df.columns. Any ideas on this? Thanks!!!!