Import CSV and create one list for each column in Python
<p>I am processing a CSV file in python thats delimited by a comma (,).</p>
<p>Each column is a sampled parameter, for instance column 0 is time, sampled at once a second, column 1 is altitude sampled at 4 times a second, etc.</p>
<p>So columns will look like as below:</p>
<pre><code>Column 0 -&gt; [&quot;Time&quot;, 0, &quot; &quot;,&quot; &quot;,&quot; &quot;,1] 
Column 1 -&gt; [&quot;Altitude&quot;, 100, 200, 300, 400]
</code></pre>
<p>I am trying to create a list for each column that captures its name and all its data. That way I can do calculations and organize my data into a new file automatically (the sampled data I am working with has substantial number of rows)</p>
<p>I want to do this for any file not just one, so the number of columns can vary.</p>
<p>Normally if every file was consistent I would do something like:</p>
<pre><code>import csv
time =[]
alt = []
dct = {}
with open('test.csv',&quot;r&quot;) as csvfile:
    csv_f = csv.reader(csvfile)
    for row in csv_f:
        header.append(row[0])
        alt.append(row[1]) #etc for all columns
</code></pre>
<p>I am pretty new in python. Is this a good way to tackle this, if not what is better methodology?</p>
<p>Thanks for your time</p>