-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
3,164 additions
and
1,512 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>pytaxize.gbif.parse — pytaxize 0.6.91 documentation</title> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> | ||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
|
||
|
||
<script src="../../../_static/js/modernizr.min.js"></script> | ||
|
||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
|
||
|
||
<div class="wy-grid-for-nav"> | ||
|
||
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search"> | ||
|
||
|
||
|
||
<a href="../../../index.html" class="icon icon-home"> pytaxize | ||
|
||
|
||
|
||
</a> | ||
|
||
|
||
|
||
|
||
<div class="version"> | ||
0.6.91 | ||
</div> | ||
|
||
|
||
|
||
|
||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../col.html">Catalogue of Life</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../gnr.html">Global Names Resolver</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../gni.html">Global Names Index</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../tax.html">Variety of functions</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../ids.html">Taxonomic Identifiers Class</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../itis.html">ITIS</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../changelog_link.html">Changelog</a></li> | ||
</ul> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | ||
|
||
|
||
<nav class="wy-nav-top" aria-label="top navigation"> | ||
|
||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../index.html">pytaxize</a> | ||
|
||
</nav> | ||
|
||
|
||
<div class="wy-nav-content"> | ||
|
||
<div class="rst-content"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div role="navigation" aria-label="breadcrumbs navigation"> | ||
|
||
<ul class="wy-breadcrumbs"> | ||
|
||
<li><a href="../../../index.html">Docs</a> »</li> | ||
|
||
<li><a href="../../index.html">Module code</a> »</li> | ||
|
||
<li>pytaxize.gbif.parse</li> | ||
|
||
|
||
<li class="wy-breadcrumbs-aside"> | ||
|
||
</li> | ||
|
||
</ul> | ||
|
||
|
||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for pytaxize.gbif.parse</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">import</span> <span class="nn">json</span> | ||
<span class="kn">from</span> <span class="nn">pytaxize.refactor</span> <span class="kn">import</span> <span class="n">Refactor</span> | ||
|
||
<span class="k">try</span><span class="p">:</span> | ||
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span> | ||
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span> | ||
<span class="n">warnings</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s2">"Pandas library not installed, dataframes disabled"</span><span class="p">)</span> | ||
<span class="n">pd</span> <span class="o">=</span> <span class="kc">None</span> | ||
|
||
<span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">as_dataframe</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> | ||
<span class="sd">"""</span> | ||
<span class="sd"> Parse taxon names using the GBIF name parser.</span> | ||
|
||
<span class="sd"> :param name: A character vector of scientific names.</span> | ||
<span class="sd"> Returns a DataFrame containing fields extracted from parsed</span> | ||
<span class="sd"> taxon names. Fields returned are the union of fields extracted from</span> | ||
<span class="sd"> all species names in scientificname</span> | ||
<span class="sd"> :param as_dataframe: (optional) Type: boolean. Return as pandas data frame?</span> | ||
<span class="sd"> default: False</span> | ||
|
||
<span class="sd"> Author John Baumgartner (johnbb@student.unimelb.edu.au)</span> | ||
|
||
<span class="sd"> References http://dev.gbif.org/wiki/display/POR/Webservice+API,</span> | ||
<span class="sd"> http://tools.gbif.org/nameparser/api.do</span> | ||
|
||
<span class="sd"> Usage::</span> | ||
|
||
<span class="sd"> from pytaxize import gbif</span> | ||
<span class="sd"> gbif.parse(name=['x Agropogon littoralis'])</span> | ||
<span class="sd"> names = ['x Agropogon littoralis', 'Helianthus annuus texanus']</span> | ||
<span class="sd"> gbif.parse(names)</span> | ||
<span class="sd"> gbif.parse(names, as_dataframe=True)</span> | ||
<span class="sd"> """</span> | ||
<span class="n">name</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> | ||
<span class="n">url</span> <span class="o">=</span> <span class="s2">"https://api.gbif.org/v0.9/parser/name"</span> | ||
<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"content-type"</span><span class="p">:</span> <span class="s2">"application/json"</span><span class="p">}</span> | ||
<span class="n">tt</span> <span class="o">=</span> <span class="n">Refactor</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">payload</span><span class="o">=</span><span class="p">{},</span> <span class="n">request</span><span class="o">=</span><span class="s2">"post"</span><span class="p">)</span><span class="o">.</span><span class="n">json</span><span class="p">(</span> | ||
<span class="n">data</span><span class="o">=</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">name</span><span class="p">),</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span> | ||
<span class="p">)</span> | ||
<span class="k">if</span> <span class="n">as_dataframe</span><span class="p">:</span> | ||
<span class="n">tt</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">tt</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="n">tt</span> | ||
</pre></div> | ||
|
||
</div> | ||
|
||
</div> | ||
<footer> | ||
|
||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p> | ||
© Copyright 2020, Scott Chamberlain. | ||
|
||
</p> | ||
</div> | ||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
</footer> | ||
|
||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT:'../../../', | ||
VERSION:'0.6.91', | ||
LANGUAGE:'None', | ||
COLLAPSE_INDEX:false, | ||
FILE_SUFFIX:'.html', | ||
HAS_SOURCE: true, | ||
SOURCELINK_SUFFIX: '.txt' | ||
}; | ||
</script> | ||
<script type="text/javascript" src="../../../_static/jquery.js"></script> | ||
<script type="text/javascript" src="../../../_static/underscore.js"></script> | ||
<script type="text/javascript" src="../../../_static/doctools.js"></script> | ||
|
||
|
||
|
||
<script type="text/javascript" src="../../../_static/js/theme.js"></script> | ||
|
||
<script type="text/javascript"> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.