title: Read from and write to CSV file using pandas
body: <p>I have a csv file like below</p>
  
  <pre><code>a,v,s,f
  china,usa,china and uk,france
  india,australia,usa,uk
  japan,south africa,japan,new zealand
  </code></pre>
  
  <p>I'm trying to get output like below, by removing repeated words in each row</p>
  
  <pre><code>       a             v        s            f
  0  china           usa   and uk       france
  1  india     australia      usa           uk
  2  japan  south africa           new zealand
  </code></pre>
  
  <p>for which I'm doing </p>
  
  <pre><code>import pandas as pd
  from io import StringIO
  
  
  data="""a,v,s,f
  china,usa,china and uk,france
  india,australia,usa,uk
  japan,south africa,japan,new zealand"""
  
  df= pd.read_csv(StringIO(data).decode('UTF-8') )
  
  
  from collections import Counter
  def trans(x):
      d=[y for y in x]
      i=0
      while i&lt;len(d):
          j=i+1
          item=d[i]
          while j&lt;len(d):
              if item in d[j]:
                  d[j]=d[j].replace(item,'')
              j+=1
          i+=1
      return d
  
  print df.apply(lambda x:trans(x),axis=1 )
  </code></pre>
  
  <p>It works fine as long as I input the data into variable 'data'. But if I want to import that from csv file by doing <code>data = pd.read_csv("trial.csv")</code>, it doesn't work. I get an error message saying <code>'DataFrame' object has no attribute 'decode'</code>. How can I read the data from a CSV file and write output to CSV file using pandas? Where am I going wrong?</p>