How to do the equivalent of the calculated field of Excel in a pivot_table pandas (Python)?

0

I want to divide the revenue by volume into a pivot_table (such as a calculated Excel field), so that the average price per product of each month appears:

The code you'd like to do is more or less like this: df.pivot_table (index= "Produto", columns= 'Mês', values= ["Receita" / "Volume"])

            Mês         
Produto     1     2     3       4
a           14,38      14,38
b           9,78        9,78
c                             7,96
d                      18,43

But pivot_table is not allowing you to divide the revenue by volume into the "values" parameter

Thanks for the help.

    
asked by anonymous 27.09.2018 / 16:27

0 answers