I have a csv file in which contains 4 classes to its corresponding ids. For example
ids   A  B  C D
1     0  1  0 0
2     0  0  1 0
3     1  0  0 0
.
.
.
10000
I am trying to put another column 'pos' which will store corresponding categories. for above example
ids pos
 1   B
 2   C
 3   A
I am using pandas to do that but here i am getting error as** key error=pos**. I am new to python. can someone help to rectify were am i doing wrong?
import pandas as pd
df=pd.read_csv("ABC.csv")
cols=['A','B','C','D']
df['arr']=df[cols].values.tolist()
print(df.head())
for ind in df.head().index:
    print(df['arr'][ind].index(1)+1)
    df['pos'][ind]=df['arr'][ind].index(1)+1