title: Pandas - get row and column name for each element during applymap
body: <p>I am trying to compare one list of strings for similarity and get the results in a pandas dataframe for inspection; so I use one list as index and the other as column list. I then want to compute the &quot;Levenshtein similarity&quot; on them (a function that compares the similarity between two words).</p>
  <p>I am trying to do that using <code>applymap</code> on every cell, and compare the cell index to the cell column. How could I do that? Or simpler alternatives?</p>
  <pre><code>things = ['car', 'bike', 'sidewalk', 'eatery']
  action = ['walking', 'caring', 'biking', 'eating']
  matrix = pd.DataFrame(index = things, columns = action)
  
  def lev(x):
      x = Levenshtein.distance(x.index, x.column)  
  matrix.applymap(lev)
  </code></pre>
  <p>so far I resorted to use the following (below) but I find it clumsy and slow</p>
  <pre><code>matrix = pd.DataFrame(data = [action for i in things], index = things, columns = action)
  for i, values in matrix.iterrows():
      for j, value in enumerate(values):
          matrix.ix[i,j] = Levenshtein.distance(i, value)
  </code></pre>