title: Pivot Table with calculation python
body: <p>I have data as below,</p>
  <pre><code>data = {'Email':  ['gee@gmail.com', 'lee@gmail.com', 'hun@gmail.com', 
                     'kui@gmail.com', 'gee@gmail.com', 'lee@gmail.com', 
                     'kui@gmail.com', 'hun@gmail.com', 'hun@gmail.com', 
                     'gee@gmail.com','kol@gmail.com','gee@gmail.com'],
  
          'Name':   ['gee', 'lee', 'hun', 'kui', 'gee', 'lee', 
                     'kui', 'hun', 'hun', 'gee', 'kol', 'gee'], 
  
          'Date':   ['21/01/2020', '03/01/2020', '06/02/2020', 
                     '07/01/2020', '16/02/2020', '09/02/2020', 
                     '07/02/2020', '05/02/2020', '08/03/2020', 
                     '09/04/2020','01/03/2020','03/05/2020'],
  
          'Amount': [20,30,10,5,10,30,20,40,60,20,10,30]}
  
  data_df = pd.DataFrame(data)
  </code></pre>
  <p>my expected output as below,</p>
  <p>expected output</p>
  <p><a href="https://i.stack.imgur.com/BNolB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BNolB.png" alt="enter image description here" /></a></p>
  <p>I have try with pivot table to group the email name and date, but it stuck on part min date, max date frequency and the rest. it is possible to create the table using python. can anyone help how to create the table using python? Thank you</p>
  <ol>
  <li><p>column explanation based on expected output:</p>
  <ol>
  <li>average = total of amount for each email divide by frequency</li>
  <li>frequency = no of date for each email</li>
  <li>min date = minimum date in each email and same as Max date.</li>
  <li>date different by month = different between max and min date by<br />
  month</li>
  <li>output = average * date different by month * frequency</li>
  </ol>
  </li>
  </ol>