title: Add new rows to calculate the sum and average from exiting pandas dataframe
body: <p>My goal is to write a program that take in user input, calculates the prices of the orders (apple cider and apple juice) and print a table as follew: </p>
  
  <p>Names Cider Juice Subtotal (Cider) Subtotal (Juice) Total</p>
  
  <p>Richard 13 9 $ 71.50 $ 40.50 $ 112.00</p>
  
  <p>George 7 21 $ 38.50 $ 94.50 $ 133.00</p>
  
  <p>Paul 0 23 $ 0.00 $ 103.50 $ 103.50</p>
  
  <p>John 22 5 $ 121.00 $ 22.50 $ 143.50</p>
  
  <p>Total 42 58 $ 231.00 $ 261.00 $ 492.00</p>
  
  <p>Average 10.50 14.50 $ 57.75 $ 65.25 $ 123.00</p>
  
  <p>The program should:</p>
  
  <p>• ask for a number of people who ordered</p>
  
  <p>• use an array of Strings to store names, an array of integers to store the number of orders of apple cider (each priced at $5.50), and an array of integers to store the number of orders of apple juice (each priced at $4.50)</p>
  
  <p>• read a list of names, numbers of apple cider orders, and numbers of apple juice</p>
  
  <p>• store them in the corresponding arrays</p>
  
  <p>• keep track of the total number of apple cider orders and the total number of apple juice orders</p>
  
  <p>• print all the names, the numbers of orders for each kind, the subtotal prices for each kind, and the total price for the person
  At the end, it should also print:</p>
  
  <p>• the total number of orders for each kind, the subtotal prices of the total orders, and the grand total price</p>
  
  <p>• an average number of orders for each kind, an average subtotal price of each kind, and an average price for each person</p>
  
  <p>The below is a sample run (the bold fonts indicate the user-input):
  This program calculates the prices of the orders.</p>
  
  <p>How many people ordered? <strong>4</strong></p>
  
  <p>Enter the name of Person #1: <strong>Richard</strong></p>
  
  <p>How many orders of cider did Richard have? <strong>13</strong></p>
  
  <p>How many orders of juice did Richard have? <strong>9</strong></p>
  
  <p>Enter the name of Person #2: <strong>George</strong></p>
  
  <p>How many orders of cider did George have? <strong>7</strong></p>
  
  <p>How many orders of juice did George have? <strong>21</strong></p>
  
  <p>Enter the name of Person #3: <strong>Paul</strong></p>
  
  <p>How many orders of cider did Paul have? <strong>0</strong></p>
  
  <p>How many orders of juice did Paul have? <strong>23</strong></p>
  
  <p>Enter the name of Person #4: <strong>John</strong></p>
  
  <p>How many orders of cider did John have? <strong>22</strong></p>
  
  <p>How many orders of juice did John have? <strong>5</strong></p>
  
  <p>I have solved lines before the row "Total" and "Average". </p>
  
  <pre><code>import pandas as pd
  </code></pre>
  
  <p>df = pd.DataFrame(columns=["Names", "Cider", "Juice", "Subtotal(Cider)", "Subtotal(Juice)", "Total"])
  people_ordered = input('How many people ordered? ')  # type str</p>
  
  <p>'''Create the 4x3 table from user input'''
  for i in range(int(people_ordered)):
      names = input("Enter the name of Person #" + str(i + 1) + " ")  # type str</p>
  
  <pre><code>cider_orderred = float(input("How many orders of cider did {} have? ".format(names)))  # type str
  juice_orderred = float(input("How many orders of juice did {} have? ".format(names)))  # type str
  
  # store the values of the subtotals from user inputs
  cider_sub = 5.50 * cider_orderred  # type float
  juice_sub = 4.50 * juice_orderred  # type float
  total = cider_sub + juice_sub  # type float
  
  # create the 4x6 table
  df1 = pd.DataFrame(
      data=[[names, cider_orderred, juice_orderred, cider_sub, juice_sub, total]],
      columns=["Names", "Cider", "Juice", "Subtotal(Cider)", "Subtotal(Juice)", "Total"])
  # merge the the 4x3 into the 4x6 table
  
  df = pd.concat([df, df1], axis=0)
  </code></pre>
  
  <p>Now I have a table:</p>
  
  <pre><code>    Names   Cider   Juice   Subtotal(Cider) Subtotal(Juice) Total
  0   Richard 13.0    9.0 71.5    40.5    112.0
  0   George  7.0 21.0    38.5    94.5    133.0
  0   Paul    0.0 23.0    0.0 103.5   103.5
  0   John    22.0    5.0 121.0   22.5    143.5
  </code></pre>
  
  <p>How can I calculate the "Total" and "Average" from the from the columns and concatenate them to the final dataframe?</p>