To give a bit of backstory, I created and excel sheet that transforms the excel column index to pandas index. Which in essense is just a simple Vlookup, on a defined table e.g Column A=0, Column B=1. It gets the job done, however it's not as efficient as I would like it to be.
I use these index on my function to rename those fields to follow our current nomenclature. e.g
df = df.rename(columns={df.columns[5]: "Original Claim Type",
df.columns [1]:"Date of Loss",
df.columns[3]:"Date Reported (tpa)",
df.columns[2]:"Employer Report Date",
df.columns[4]:"Original Status",
df.columns[6]:"Date Closed",
df.columns[27]:"(net)Total Paid",
df.columns[23]:"(net) Total Incurred",
df.columns[25]:"NET Paid(Med)",
df.columns[26]:"NET Paid(Exp)",
df.columns[24]:"NET Paid (Ind)",
df.columns[18]:"Original Litigation",
df.columns[7]:"Date of Hire",
df.columns[8]:"Date of Birth",
df.columns[9]:"Benefit State",
df.columns[15]:"Original Cause",
df.columns[17]:"Body Part",
df.columns[32]:"TTD Days"})
My new solution was to create a Dictionairy that maps the values, and their corresponding index.
excel_index={'A':0,'B':1,'C':2}
test={"Claim Number":[0,1,2,3,4,5]}
test=pd.DataFrame(test)
test=test.rename(columns={ test.columns[excel_index['A']]: "Frog"})
It works, however the only problem I have is that I would have to manually type out all the index values beforehand.
What would be a more efficient way to carry this out?
-Brandon

index_col=0would make the index here A B C D... I guess I'm not really understanding your request