I have a table structure as a data frame like this
By inserting a pivot table and applying these changes
I get this pivot table
the formula of calculated field is
I used the following code
data = pd.read_excel(file, engine = 'openpyxl')
pvt = pd.pivot_table(data, index = ['Reason'], columns =['Date'], aggfunc = np.sum)
pvt['Date'] = ((data['Promoters'] - data['Detractor'])/ data['weights']) * 100
pvt