title: Calculate the % difference of two columns in pivot table
body: <p>I have two columns on pivot table and I would like to find the %difference. </p>
  
  <pre><code>table['% average_change'] = ["Price per carat, 2015" / "Price per carat, 2019"]
  print(table)
  average_count = pd.pivot_table(df,index=["color", "carat"],values=["Price per carat","Year"],columns=["Year"])
  print(average_count)
  average_count = pd.pivot_table(df,index=["color", "carat"],values=["Price per carat","Year"],columns=["Year"])
  print(average_count)
                    Price per carat              
  Year                         2015          2019
  color carat                                    
  DI1   0.3 - 0.39      1356.500000           NaN
        0.50 - 0.69     1983.500000           NaN
        0.70 - 0.79     2415.000000           NaN
        0.90 - 0.99     2848.000000           NaN
        1.00 - 1.24     3279.555556   3361.000000
        1.25 - 1.49     4209.333333           NaN
        1.50 - 1.99     3609.333333           NaN
        2.00 - 2.99     4784.000000           NaN
        3.00 - 3.99     4695.000000           NaN
  DIF   0.23 - 0.29     3307.000000           NaN
        0.3 - 0.39      4816.687500   2553.555556
        0.4 - 0.44              NaN   3365.500000
        0.45 - 0.49     4977.000000           NaN
        0.50 - 0.69     7486.333333           NaN
        0.70 - 0.79     7181.000000   5455.000000
        0.80 - 0.89     9024.000000           NaN
        0.90 - 0.99    10202.000000           NaN
        1.00 - 1.24    15624.464286   9510.333333
        1.50 - 1.99             NaN  15730.000000
        2.00 - 2.99             NaN  21285.000000
        3.00 - 3.99             NaN  86900.000000
  DSI1  0.18 - 0.22             NaN   1519.000000
        0.23 - 0.29     2214.750000   1300.000000
        0.3 - 0.39      2070.844860   1829.000000
        0.4 - 0.44      2097.825871           NaN
        0.45 - 0.49     2271.428571           NaN
        0.50 - 0.69     3039.090024   2656.857143
        0.70 - 0.79     3922.832031   3559.400000
        0.80 - 0.89     4288.363636           NaN
        0.90 - 0.99     4829.680233           NaN
  ...                           ...           ...
  MVS2  1.25 - 1.49             NaN   3089.333333
        2.00 - 2.99             NaN   4296.000000
        3.00 - 3.99             NaN   6187.000000
  MVVS1 1.00 - 1.24             NaN   2553.500000
        1.25 - 1.49             NaN   3277.000000
        1.50 - 1.99             NaN   3896.000000
        2.00 - 2.99             NaN   5618.500000
        3.00 - 3.99             NaN   9570.000000
  MVVS2 1.00 - 1.24             NaN   3251.000000
        1.25 - 1.49             NaN   3174.500000
        1.50 - 1.99             NaN   3702.500000
        2.00 - 2.99             NaN   5379.500000
        3.00 - 3.99             NaN   5329.000000
        5.00 - 5.99             NaN   9614.000000
  NSI1  2.00 - 2.99             NaN   2574.000000
  NVS1  1.00 - 1.24             NaN   2926.000000
        2.00 - 2.99             NaN   4108.666667
        3.00 - 3.99             NaN   5141.666667
        4.00 - 4.99             NaN   4950.000000
  NVS2  1.50 - 1.99             NaN   3520.000000
        2.00 - 2.99             NaN   4114.000000
        4.00 - 4.99             NaN   6264.000000
  NVVS1 1.50 - 1.99             NaN   3643.000000
        2.00 - 2.99             NaN   5033.666667
        3.00 - 3.99             NaN   6412.000000
  NVVS2 1.00 - 1.24             NaN   3303.250000
        1.25 - 1.49             NaN   3103.000000
        1.50 - 1.99             NaN   3388.000000
        2.00 - 2.99             NaN   4643.000000
        3.00 - 3.99             NaN   6007.750000
  
  [788 rows x 2 columns]
  count
  average_count.info()
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  MultiIndex: 788 entries, (DI1, 0.3 - 0.39) to (NVVS2, 3.00 - 3.99)
  Data columns (total 2 columns):
  (Price per carat, 2015)    626 non-null float64
  (Price per carat, 2019)    457 non-null float64
  dtypes: float64(2)
  memory usage: 14.8+ KB
  age_count
  average_count['% average_change'] = ["Price per carat, 2015" / "Price per carat, 2019"]
  print(average_count)
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-145-55289a2a7674&gt; in &lt;module&gt;
  ----&gt; 1 average_count['% average_change'] = ["Price per carat, 2015" / "Price per carat, 2019"]
        2 print(average_count)
  
  TypeError: unsupported operand type(s) for /: 'str' and 'str'
  </code></pre>