title: pandas - Subtract 2 similar pivot table of data frame
body: <p>I have a 36 rows x 36 columns dataframe of pivot table which I transform using code below:</p>
  
  <pre><code>df_pivoted = pd.pivot_table(df,index='From',columns='To',values='count')
  df_pivoted.fillna(0,inplace=True)
  </code></pre>
  
  <p>I transpose the same dataframe  using this code:</p>
  
  <pre><code>df_trans = df_pivoted.transpose()
  </code></pre>
  
  <p>and want to substract those two dataframes with this code:</p>
  
  <pre><code>new_pivoted = df_pivoted - df_trans
  </code></pre>
  
  <p>It gives me 72 rows x 72 columns dataframe with NaN value in all cell.</p>
  
  <p>Then I try to use other code:</p>
  
  <pre><code>delta = df_pivoted.subtract(df_trans, fill_value=0)
  </code></pre>
  
  <p>However, it yields 72 rows x 72 columns with dataframe that looks like this:
  <a href="https://i.stack.imgur.com/RfR0v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RfR0v.png" alt="enter image description here"></a></p>
  
  <p>Please help me to find the difference between the original dataframe with the transpose dataframe.</p>