title: Replace value of certain row in csv based on string value of adjacent row
body: <p>How can I replace value of rows in column 'B' if the rows of column 'A' has a (string) supposed I have an existing csv. Like if <code>Dog</code> is in row, change it's adjacent row in column B</p>
  
  <p>I'm looking for something like this:</p>
  
  <pre><code>for i in df['A']:
  if i =='Dog','Cat': 
  //replace value Black in column B to White
  </code></pre>
  
  <p><strong>Example:</strong></p>
  
  <p>Original CSV</p>
  
  <pre><code>A,B
  Dog,Black
  Cat,Black
  Mouse,Black
  Pig,Black
  </code></pre>
  
  <p>Replaces to:</p>
  
  <pre><code>A,B
  Dog,White
  Cat,White
  Mouse,Black
  Pig,Black
  </code></pre>
  
  <p>Here is my code, nothing shows in my csv, I don't know why</p>
  
  <pre><code>import pandas as pd
  import csv
  
  df = pd.read_csv("test.csv")
  data = { 'A': [ 'Dog', 'Cat', 'Pig'] }
  df = pd.DataFrame(data)
  class Description(dict):
       def __missing__(self, key):
           return ''
  
  desc = Description()
  desc['Dog'] = 'White'
  desc['Cat'] = 'White'
  desc['Pig'] = 'White'
  df['B'] = df['A'].apply(lambda x: desc[x])
  </code></pre>