title: Calculate concordance index in Python
body: <p>I would like to replicate a concordance index I read about in a <a href="https://mpra.ub.uni-muenchen.de/79990/1/MPRA_paper_79990.pdf" rel="nofollow noreferrer">paper</a>, however - unfortunately - I am not able to automate the calculation in Python. Hence, I am wondering if one of you could help me, please.</p>
  
  <p>I have a matrix with m rows and n columns, where the rows m contain the observations X, Y, etc. and the columns contain binary values for X,Y, etc. over t. Now I would like to compare rows according to their values in time and write the results in a matrix with the following formula:</p>
  
  <p><a href="https://i.stack.imgur.com/FiSUd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FiSUd.png" alt="concordance_formula"></a></p>
  
  <p>The results should then be a symmetric matrix, however, I am unfortunately not too familiar with Python and do not know how to automate the "comparison". I generated a small example in Excel which can be downloaded on WeTransfer here: <a href="https://transfernow.net/c1glqdkf2si9" rel="nofollow noreferrer">WeTransfer</a></p>
  
  <p>I would be very glad if someone could help me, please.</p>
  
  <p>Thank you in advance!</p>
  
  <p>Best regards
  Alex</p>