title: TypeError: object of type 'map' has no len()
body: <p>I am using the function below to compute inverse term frequencies.</p>
  
  <pre><code>all_tokens_set = set([item for sublist in tokenized_documents for item in sublist]) 
  
  def inverse_document_frequencies(tokenized_documents):
  idf_values = {}
  global dfInv
  dfInv = pd.DataFrame() 
  tokenized_documents = [tokenize(d) for d in words]
  all_tokens_set = set([item for sublist in tokenized_documents for item in sublist])
  for tkn in all_tokens_set:
      contains_token = map(lambda doc: tkn in doc, tokenized_documents)
      idf_values[tkn] = 1 + math.log(len(tokenized_documents)/(sum(contains_token))) 
  dfInv=pd.DataFrame(data ={'tkn':contains_token,'idf_values':idf_values[tkn]})
  return dfInv
  inverse_document_frequencies(total_all)
  </code></pre>
  
  <p><code>total_all</code> is a list. </p>
  
  <p>I am getting the error message that:</p>
  
  <blockquote>
    <p>TypeError: object of type 'map' has no len()</p>
  </blockquote>