title: Replace values in a csv file
body: <p>I want to change values in a large amount of rows into something else.</p>
  
  <p>I open my data from a csv using pandas as follows:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import os
  
  df = pd.read_csv('data.csv', encoding = "ISO-8859-") 
  </code></pre>
  
  <p>I then slice my DF changing column names:</p>
  
  <pre><code>df1 = df['col 1', 'col 2', 'col 3' 'col 4', 'col 5']
  </code></pre>
  
  <p>Remove useless column names:</p>
  
  <pre><code>df2 = df1.columns.str.strip('col') 
  output:
  1, 2, 3, 4, 5
  a  b  a  b  c
  a  c  a  a  c
  b  a  c  a  b
  </code></pre>
  
  <p>Replace values so I can report from the data easier and replace useless answers. </p>
  
  <pre><code>df1 = df1.replace('c', None)
  df1 = df1.replace('a', 's')
  df1 = df1.replace('b', 'n')
  </code></pre>
  
  <p>Now my issues are, when I strip the columns my dataframes loses all of its values, and when I try to re-concat the new df into the previous one it didn't work. </p>
  
  <p>I'm not sure how to use the df.replace on multiple values, also when I run it in different strings and try to append/merge it into the current DF it doesn't really work.</p>
  
  <p>The output I'm after is:</p>
  
  <pre><code>   output:
      1, 2, 3, 4, 5
      s  n  s  n  NaN
      n  NaN  s  s  NaN
      n  s  NaN  s  n
  </code></pre>