title: Vectorizing list
body: <p>need help guys. Need to vectorize list, 
  that is, replace each element of the sublist with a certain calculated number. Formula for each element of sublist <a href="https://i.stack.imgur.com/73xj9.png" rel="nofollow noreferrer">https://i.stack.imgur.com/73xj9.png</a>
  The list has the following structure: <code>list = [[document0],[document1],[document2],[document3].......]</code>
  Each document consists of terms, for example <code>document1 = ['i','love','you']</code></p>
  
  <p>I wrote my function for calculation, but it does not work correctly :(</p>
  
  <pre><code>def tfc(slova):
      import math as m
      meshokslov1=[{}for i in range(len(slova))]
      meshokslov2=[{}for i in range(len(slova))]
      SummaKvadratov=0
      for i in range(len(slova)):
          for j in range(len(slova[i])):
              n=0
              for q in slova:
                  if q.count(slova[i][j])!=0:
                      n+=1
                      if slova[i][j] in meshokslov1:
                          continue
                      else:
                          meshokslov1[i][slova[i][j]]=slova[i].count(slova[i][j])*m.log10(len(slova)/n)
                          SummaKvadratov+=(slova[i].count(slova[i][j])*m.log10(len(slova)/n))**2
      for i in range(len(slova)):
          for j in range(len(slova[i])):
              if slova[i][j] in meshokslov2:
                  continue
              else:
                  meshokslov2[i][slova[i][j]]=meshokslov1[i][slova[i][j]]/(SummaKvadratov**0.5)
      return meshokslov2
  </code></pre>