<div class="gmail_quote"><font size="2"><font face="tahoma,sans-serif"><div>I have a huge dataset containing millions of rows and several dozen columns in a tab delimited text file.  I need to extract a small subset of rows and only three columns. One of the three columns has two word string with header “Scientific Name”. The other two columns carry numbers for Longitude and Latitude, as below.</div>


<div><br></div><div>Sci Name<span style="white-space:pre-wrap"> </span>Longitude<span style="white-space:pre-wrap">       </span>Latitude<span style="white-space:pre-wrap">        </span>Column4</div>
<div>Gen sp1<span style="white-space:pre-wrap">   </span>82.5<span style="white-space:pre-wrap">            </span>28.4<span style="white-space:pre-wrap">            </span>…</div><div>Gen sp2<span style="white-space:pre-wrap"> </span>45.9<span style="white-space:pre-wrap">            </span>29.7<span style="white-space:pre-wrap">            </span>…</div>


<div>Gen sp1<span style="white-space:pre-wrap">   </span>57.9<span style="white-space:pre-wrap">            </span>32.9<span style="white-space:pre-wrap">            </span>…</div><div>…<span style="white-space:pre-wrap">               </span>…<span style="white-space:pre-wrap">               </span>…<span style="white-space:pre-wrap">               </span>…</div>


<div><br></div><div>Of the many species listed under the column “Sci Name”, I am interested in only one species which will have multiple records interspersed in the millions of rows, and I will probably have to use filename.readline() to read the rows one at a time. How would I search for a particular species in the dataset and create a new dataset for the species with only the three columns? </div>


<div><br></div><div>Next, I have to create such datasets for hundreds of species. All these species are listed in another text file. There must be a way to define an iterative function that looks at one species at a time in the list of species and creates separate dataset for each species. The huge dataset contains more species than those listed in the list of my interest.</div>


<div><br></div><div>I very much appreciate any help. I am a beginner in Python. So, complete code would be more helpful.</div><div><br></div><div>- Kumar</div><div><br></div></font></font><font color="#888888"><br>-- <br>

<font color="#666666" face="tahoma, sans-serif">Section of Integrative Biology<br>
University of Texas at Austin<br>Austin, Texas 78712, USA</font><br>
</font></div><br>