title: Dictionary from CSV file using the DictReader object
body: <p>To set the context i need to transform a csv file as per my requirements to create a transformed csv output file.</p>
  
  <p>For this problem statement i learned that i need to use a <code>DictReader</code> from python csv. After transformation i tried creating another dictionary called new_point which needs to be persisted to a csv file.</p>
  
  <p>The issue is, dictionary generation seems to be flawed in my code as when i print the dictionary it is neither an array of dictionaries nor a dictionary.</p>
  
  <pre><code>with open(out_file, 'w') as f_out, open(in_file, 'r') as f_in:
          out_colnames = ['duration', 'month', 'hour', 'day_of_week', 'user_type']        
          trip_writer = csv.DictWriter(f_out, fieldnames = out_colnames)
          trip_writer.writeheader()
  
          trip_reader = csv.DictReader(f_in)
  
          # collect data from and process each row
          for row in trip_reader:
              # set up a dictionary to hold the values for the cleaned and trimmed
              # data point
              new_point = {}
              ## TODO: use the helper functions to get the cleaned data from  ##
              ## the original data dictionaries.                              ##
              ## Note that the keys for the new_point dictionary should match ##
              ## the column names set in the DictWriter object above.         ##
              duration = duration_in_mins(row, city)
              month,hour,day_of_week = time_of_trip(row, city)
              user_type = type_of_user(row, city)
  
              new_point['duration'] = duration
              new_point['month'] = month
              new_point['hour'] = hour
              new_point['day_of_week'] = day_of_week
              new_point['user_type'] = user_type
  
              pprint(new_point)
  </code></pre>
  
  <p>if i print the <code>type(new_point)</code> i am getting the output as below</p>
  
  <pre><code>Class &lt;Dict&gt;
  </code></pre>
  
  <p>when i print the new_point dict i am getting the below.</p>
  
  <pre><code>{'day_of_week': 'Thursday',
   'duration': 7.123116666666666,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 9.792516666666668,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 6.632983333333333,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 7.4047,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 13.014583333333333,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 17.0552,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 11.01165,
   'hour': 22,
   'month': 3,
   'user_type': 'Registered'}
  {'day_of_week': 'Thursday',
   'duration': 30.01175,
   'hour': 21,
   'month': 3,
   'user_type': 'Registered'}
  </code></pre>
  
  <p>Can someone who has already followed this approach of creating a dictionary from a DictReader object help me solving this problem.</p>
  
  <p>If you find this question very naive my sincere apologies. I am completely new to python. I tried reading the docs but did not understand the concept. I could not even find a detailed explanation anywhere.</p>