I have a python program to generate excel reports. It creates an additional column next to a column where logic condition is met. The header of this column has to contain the header (field label) of column where condition is met. Currently the header of this column is always "Duration", but I want it to be '"header of column where condition was met" + space + "Duration"'. Header of column where condition was met is 'Field_Label' in CSV file. For example the header of column where condition is met is "Order Date", the header of new column has to be "Order Date Duration". Below is portion of code that inserts this column. I would appreciate any ideas. The expected output is number of days between 2 dates.
'''
df_Temp.insert(position, 'Duration', pd.to_datetime(df_Temp[fieldRow['Field_Label']], errors = 'coerce') - pd.to_datetime(df_Temp[fieldRow['Calc_Field']], errors = 'coerce'))
df_Temp['Duration'] = df_Temp['Duration'].dt.days
'''