title: Why do I get AttributeError: 'numpy.ndarray' object has no attribute 'replace' in python?
body: <p>I am trying to standardize my data in my csv file:</p>
  
  <pre><code>import pandas as pd
  my_city = pd.read_csv('sample4_addlink.csv')['City'].unique()
  
  my_city
  Out[70]: 
  array(['Lancaster', 'Canton', 'Edison', ..., 'Upton', 'Irvington',
         'El Cerrito'], dtype=object)
  </code></pre>
  
  <p>Now as you see in my_city, there are some cities with space between names like El Cerrito. I want to replace the space with an underscore</p>
  
  <pre><code>my_cities =my_city.replace(" ", "_")
  Traceback (most recent call last):
  
    File "&lt;ipython-input-71-53c4a0662dd7&gt;", line 1, in &lt;module&gt;
      my_cities =my_city.replace(" ", "_")
  
  AttributeError: 'numpy.ndarray' object has no attribute 'replace'
  </code></pre>
  
  <p>I get this error when I use the .replace function. What is the best way to get around this?</p>