I have a data frame named "master", with columns names like this:
Code, 7/1/2021 , 6/29/2021, 5/22/2021, 6/1/2021
In order to re-arrange them by date, I created a list:
dates = list(master.columns.values)
since I just want to sort everything by "Code", I removed it from the list and sort them:
dates.remove('Code')
dates.sort()
in the last part to re-arrange them I'm using this:
master = master[['SOURCE', dates]]
but it's not working, it's giving me this error:
> KeyError: '["\'5/22/2021\',\'6/1/2021\',\'6/29/2021\',\'7/1/2021\'"]
> not in index'