Map multiple functions to CSV rows
<p>I'm trying to do some type conversions on CSV data that is comprised entirely of strings. I was thinking I'd use a dictionary of header names to functions and map those functions over each CSV row. I'm just a little stuck on how to efficiently map multiple functions to a row. I was thinking of enumerating the headers and creating a new dictionary of indices to functions:</p>

<pre><code>header_map = {'Foo':str,
              'Bar':str,
              'FooBar':float}

csv_data = [('Foo', 'Bar', 'FooBar'),
            #lots of data...
           ]

index_map = {}

#enumerate the rows and create a dictionary of index:function
for i, header in enumerate(csv_data[0]):
    index_map[i] = header_map[header]

#retrieve the function for each index and call it on the value
new_csv = [[index_map[i](value) for i, value in enumerate(row)] 
           for row in csv_data[1:]]
</code></pre>

<p>I'm just curious if anyone knows of simpler, efficient way to accomplish this type of operation? </p>
