title: TypeError: object of type 'float' has no len() - NLP
body: <p>I am trying to create a variable with the length of the text. I am using the code below:</p>
  <pre class="lang-py prettyprint-override"><code>messages['length']=messages['Review Text'].apply(len)
  </code></pre>
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-24-fa1723bfb3a3&gt; in &lt;module&gt;
  ----&gt; 1 messages['length']=messages['Review Text'].apply(len)
  
  ~\anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
     4136             else:
     4137                 values = self.astype(object)._values
  -&gt; 4138                 mapped = lib.map_infer(values, f, convert=convert_dtype)
     4139 
     4140         if len(mapped) and isinstance(mapped[0], Series):
  
  pandas\_libs\lib.pyx in pandas._libs.lib.map_infer()
  
  TypeError: object of type 'float' has no len()
  </code></pre>
  <p>What should I do to resolve this problem?</p>