Other methods

tax.names_list(size=10, as_dataframe=False)

Get a random vector of species names.

Parameters
  • rank – Taxonomic rank, one of species, genus (default), family, order.

  • size – Number of names to get. Maximum depends on the rank.

  • as_dataframe – (optional) Type: boolean. Return as pandas data frame? default: False

Usage:

import pytaxize
pytaxize.names_list(size=10)
pytaxize.names_list('species', size=10)
pytaxize.names_list('family', size=10)
pytaxize.names_list('order', size=10)
pytaxize.names_list('order', 2)
pytaxize.names_list('order', 15)

Search the CANADENSYS Vascan API.

Parameters
  • q – Taxonomic rank, one of species, genus (default), family, order.

  • format – Number of names to get. Maximum depends on the rank.

  • raw – Raw data or not (default)

  • callopts – Further args passed to request

Usage:

import pytaxize
pytaxize.vascan_search(q = ["Helianthus annuus"])
pytaxize.vascan_search(q = ["Helianthus annuus"], raw=True)
pytaxize.vascan_search(q = ["Helianthus annuus", "Crataegus dodgei"], raw=True)

# format type
## json
pytaxize.vascan_search(q = ["Helianthus annuus"], format="json", raw=True)

## xml
pytaxize.vascan_search(q = ["Helianthus annuus"], format="xml", raw=True)

# lots of names, in this case 50
splist = pytaxize.names_list(rank='species', size=50)
pytaxize.vascan_search(q = splist)
tax.scrapenames(file=None, text=None, engine=None, unique=None, verbatim=None, detect_language=None, all_data_sources=None, data_source_ids=None, as_dataframe=False)

Resolve names using Global Names Recognition and Discovery.

Uses the Global Names Recognition and Discovery service, see http://gnrd.globalnames.org/.

Parameters
  • url – An encoded URL for a web page, PDF, Microsoft Office document, or image file, see examples

  • file – When using multipart/form-data as the content-type, a file may be sent. This should be a path to your file on your machine.

  • text – Type: string. Text content; best used with a POST request, see examples

  • engine – (optional) Type: integer, Default: 0. Either 1 for TaxonFinder, 2 for NetiNeti, or 0 for both. If absent, both engines are used.

  • unique – (optional) Type: boolean. If True (default), response has unique names without offsets.

  • verbatim – (optional) Type: boolean, If True (default to False), response excludes verbatim strings.

  • detect_language – (optional) Type: boolean, When True (default), NetiNeti is not used if the language of incoming text is determined not to be English. When ‘false’, NetiNeti will be used if requested.

  • all_data_sources – (optional) Type: bolean. Resolve found names against all available Data Sources.

  • data_source_ids – (optional) Type: string. Pipe separated list of data source ids to resolve found names against. See list of Data Sources.

  • as_dataframe – (optional) Type: boolean. Return as pandas data frame? default: False

Usage:

import pytaxize

# Get data from a website using its URL
out = pytaxize.scrapenames(url = 'https://en.wikipedia.org/wiki/Spider')
out['data'].head() # data
out['meta'] # metadata

# Scrape names from a pdf at a URL
out = pytaxize.scrapenames(url = 'http://www.mapress.com/zootaxa/2012/f/z03372p265f.pdf')
out['data'].head() # data
out['meta'] # metadata

# With arguments
pytaxize.scrapenames(url = 'http://www.mapress.com/zootaxa/2012/f/z03372p265f.pdf', unique=True)
pytaxize.scrapenames(url = 'http://www.mapress.com/zootaxa/2012/f/z03372p265f.pdf', all_data_sources=True)

# Get data from text string as an R object
pytaxize.scrapenames(text='A spider named Pardosa moesta Banks, 1892')
taxo.taxo_datasources()

Get data sources for Taxosaurus. Retrieve data sources used in Global Names Index, see http://taxosaurus.org/ for information.

Usage:

# all data sources
import pytaxize
pytaxize.taxo_datasources()

# Output a dict
pytaxize.taxo_datasources(False)
taxo.taxo_resolve(source=None, code=None, http='get')

Uses Taxosaurus to resolve scientific names

Parameters
  • query – List of taxonomic names

  • source – (optional) Source to pull from

  • code – (optional) the abbreviation for one of the nomenclature codes (ICZN: International Code of Zoological Nomenclature; ICN: International Code of Nomenclature for algae, fungi, and plants; ICNB: International Code of Nomenclature of Bacteria)

  • http – (optional) The HTTP method to use, one of “get” or “post”. Default=”get”

Usage:

import pytaxize
pytaxize.taxo_resolve(query='Helianthus annus')
pytaxize.gnr_resolve(['Helianthus annus','Poa annua'])