I have a dataframe with 162 columns, and I want to rename the columns to variables x1, x2, ... , x(n), but keep the current column names in a dictionary for reference. I've tried a few loop methods but am not having much luck - I want to avoid doing this manually considering the number of columns. Any input is much appreciated~! Thank you.
Ex: from column names "red", "green", "blue", ... (162 total colors = column names), create dictionary {'x1':'red', 'x2':'blue,...,'xn':'lastcolor'}