0

I have a table structure as a data frame like this

Data table

By inserting a pivot table and applying these changes

Filter

I get this pivot table

pivot table

the formula of calculated field is

calculated field snps formula

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
Luuklag
  • 3,885
  • 11
  • 38
  • 55
  • Please [do not post images](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) of your data or errors. You can include [code that creates a dataframe such as `df.to_dict()` or the output of `print(df)`](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) (include at least the few rows and columns that allow to reproduce your issue) – Cimbali Sep 28 '21 at 15:26

0 Answers0