<p dir="ltr">> The data was sorted and so duplicates will not appear anywhere in the dataframe.<br>
> </p>
<p dir="ltr">I guess that's it. Use the standard csv module and itertools.groupby. Groupby will produce a list of grouped objects. So you can group by the first column by supplying a key function which just returns the first column.</p>
<p dir="ltr">Check this out for an example: <a href="http://stackoverflow.com/questions/773/how-do-i-use-pythons-itertools-groupby">http://stackoverflow.com/questions/773/how-do-i-use-pythons-itertools-groupby</a> (most upvoted answer)</p>