datetype=['Date received', 'Date sent to company', 'Date']
cols=[] 
for col in datetype:
   cols.append(col)
   for i in range(len(datatype)):
       if (col!=datetype[i]):
          name=col+"_"+datetype[i]
          df[name]=df[col]-df[datetype][i]
Date received, Date sent to company and Date all these contain dates. I was trying to find a difference between these fields. for instance, we have 3 columns date received, Date sent to company and Date. Then you will form 3 new columns containing difference of these dates by taking 2 dates at a time. I am getting an error KeyError: 1
I am new to python programming any help would be appreciated
