title: How do i create a similarity matrix based on the below code?
body: <p>I'm trying to use the gower function from this link <a href="https://sourceforge.net/projects/gower-distance-4python/files/" rel="nofollow noreferrer">https://sourceforge.net/projects/gower-distance-4python/files/</a>. I'm trying to apply it to my dataframe of categorical variables. However I can see that when i use the gower_distances function i have some non-zero values in my diagonals ( i need them to all be 0). </p>
  
  <p>I've been trying to de-bug the code. I think i know where this is happening and it's occuring in the  _gower_distance_row function. There is this line of code which i don;t understand sij_cat = np.where(xi_cat == xj_cat,np.zeros_like(xi_cat),np.ones_like(xi_cat)). But i will present it in a easier format to understand. </p>
  
  <p>Say i have:</p>
  
  <pre><code>xi=np.array(['cat','dog','monkey'])
  xj=np.array([['cat','dog','monkey'],['horse','dog','hairy']])
  sij_cat = np.where(xi == xj,np.zeros_like(xi),np.ones_like(xi))
  </code></pre>
  
  <p>I get this as my result: </p>
  
  <pre><code>array([['', '', ''],
         ['1', '', '1']], dtype='&lt;U6') 
  </code></pre>
  
  <p>since i am comparing cat with cat i want to assign zero, and where it is different e.g. cat vs horse and monkey vs hairy it should be 1. I don't get why in the above result i am getting ''? i want zeroes here. How do i fix this?</p>