Skip to content

nkgfirecream/csvreader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvreader

Indexes and queries large CSV files.

Usage

Indexing

from csvreader import CSVReader
occurrence = CSVReader("data/occurrence.txt", delimiter="\t", quoteChar="\"", indexFields=["scientificName"])
print occurrence.indexes()
{
  "scientificName": {
    "Gammaropsis species 1": [447521, 469879],
    "Nebaliacea sp.": [359201],
    ...

Querying

for record in occurrence.getLines("scientificName", "Neomysis integer"):
    print record
[
  {
    "eventID": "Cruise66:Station570:EventSorbeSledge9801:Subsample15202",
    "scientificNameID": "urn:lsid:marinespecies.org:taxname:120136",
    "occurrenceID": "Ugenthyperbenthos49454",
    "basisOfRecord": "HumanObservation",
    "lifeStage": "Juvenile",
    "sex": "Unknown",
    "scientificName": "Neomysis integer",
    "id": "Cruise66:Station570:EventSorbeSledge9801:Subsample15202"
  },
  {
    "eventID": "Cruise66:Station577:EventSorbeSledge9808:Subsample17110",
    "scientificNameID": "urn:lsid:marinespecies.org:taxname:120136",
    "occurrenceID": "Ugenthyperbenthos89117",
    "basisOfRecord": "HumanObservation",
    "lifeStage": "Adult, empty",
    "sex": "female",
    "scientificName": "Neomysis integer",
    "id": "Cruise66:Station577:EventSorbeSledge9808:Subsample17110"
  },
  ...

About

Index and query large CSV files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%