title: How can I apply a function to remove specific characters on a column of a dataset?
body: <p>I want to apply a function that loops on a column of a dataset that contains text articles. The articles are in Arabic, so I want to remove every symbol and the entire English alphabet. It's a text cleaning for Arabic articles.</p>
  <p>I created a loop to replace specific characters with an empty value.
  When I try to apply it, I get an error said <em><strong>AttributeError: 'float' object has no attribute 'replace'</strong></em></p>
  <p>Here is the code with a screenshot of the error:</p>
  <pre><code>var = d['Text']
  
  def cleaning(var):
      to_delete_characters = &quot;1234567890abcdefghijklmnopqrstuvwxyz“”ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;*()_+-&quot;&quot;=\|/?.,&gt;&lt;;]:[؟،&quot;
      for character in to_delete_characters:
          var = var.replace(character, &quot;&quot;)
      return var
  
  var.apply(func_name)
  </code></pre>
  <p>The error screenshot link:
  <a href="https://i.stack.imgur.com/3NWq2.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>The dataset screenshot link:
  <a href="https://i.stack.imgur.com/1ZqCf.png" rel="nofollow noreferrer">enter image description here</a></p>