I am trying to create an excel file where users can manipulate the values in the columns to change the value of an output depending on their needs. I run these calculations the first time using pandas and then export to an excel file using:
df.to_excel(writer, 'ExportSheet')
I am trying to make the output column a formula that depends on the other columns in the dataframe For example:
I have 4 columns:
UniqueColumnName1 | Coeff1 | UniqueColumnName2 | Coeff2
125 | 2 | -24 | 2
In pandas I create a column:
df['Output'] = df['UniqueColumnName1'] * df['Coeff1'] - df['UniqueColumnName2'] * df['Coeff2']
I want the output column to be an excel formula referencing the values in each of those columns so users can change the value of 125 to say 250. Is there a way to do this in pandas?