title: group values in csv file and save them in another csv file
body: <p>Hello I am trying to group my csv file only using the csv module and input the result in another csv file.
  The problem that I am having is that the other fields get appended to the first field which is manufacturer and I want this to be done in the correct fields.
  in <code>row[3]</code> the car_details are saved and in <code>row[4]</code> the car.
  import csv</p>
  <pre><code>result = {}
  fields=['test','name','object']
  
  with open('work.csv', 'r') as csvfile:
      csvreader = csv.reader(csvfile, delimiter=',', quotechar='&quot;')
      writer = csv.writer(open(&quot;art1.csv&quot;,'w',newline=''), delimiter=';')
      for row in csvreader:
          if row[0] in result:
            result[row[0]].append(row[3])
          else:
              result[row[0]] = [row[1]]
  with open('art1.csv', 'w') as csvfile:
     # writer.writerow(fields)
      csvwriter = csv.writer(csvfile)
      for row in result.items():
          csvwriter.writerow(row)
  
  reader = csv.reader(open(&quot;art1.csv&quot;, &quot;r&quot;,newline=''), delimiter=',')
  writer = csv.writer(open(&quot;artgain2.csv&quot;,'w',newline=''), delimiter=';')
  writer.writerow(fields)
  writer.writerows(reader)
  </code></pre>
  <p>the csv file:</p>
  <pre><code>toyota         fast           Prius
  toyota         slow           yaris
  toyota         fast           corolla
  toyota         slow           sunshine
  mercedes       fast           benz
  mercedes       fast           something
  mazda          fast           bus
  </code></pre>
  <p>the result I want</p>
  <pre><code>manufacturer   car_details    car
  toyota         fast           Prius
                 slow           yaris
                 fast           corolla
                 slow           sunshine
  mercedes       fast           benz
                 fast           something
  mazda          fast           bus
  </code></pre>
  <p>the result I get:</p>
  <pre><code>manufacturer                      car_details    car
  toyota,fast,Priusslow,yaris,fast,corolla,slow,sunshine,
  mercedes,fast,benz,fast,something
  mazda,fast,bus
  </code></pre>
  <p>Everything is in the manufacturer column and I dont know how to split this correctly in the corresponding fields
  I feel that I am pretty close to the solution and I am probably forgetting something
  Can someone help me out ?</p>