Skip to main content

Data conversion tools for iNaturalist observations and taxonomy

Project description

pyinaturalist-convert

Build status codecov Docs PyPI Conda PyPI - Python Versions

This package provides tools to convert iNaturalist observation data to and from a wide variety of useful formats. This is mainly intended for use with the iNaturalist API via pyinaturalist, but also works with other data sources.

Complete project documentation can be found at pyinaturalist-convert.readthedocs.io.

Formats

Import

Export

  • CSV, Excel, and anything else supported by tablib
  • Dataframes, Feather, Parquet, and anything else supported by pandas
  • Darwin Core
  • GeoJSON
  • GPX
  • SQLite
  • SQLite + FTS5 text search for taxonomy

Installation

Install with pip:

pip install pyinaturalist-convert

Or with conda:

conda install -c conda-forge pyinaturalist-convert

To keep things modular, many format-specific dependencies are not installed by default, so you may need to install some more packages depending on which features you want. Each module's docs lists any extra dependencies needed, and a full list can be found in pyproject.toml.

For getting started, it's recommended to install all optional dependencies:

pip install pyinaturalist-convert[all]

Usage

Export

Get your own observations and save to CSV:

from pyinaturalist import get_observations
from pyinaturalist_convert import *

observations = get_observations(user_id='my_username')
to_csv(observations, 'my_observations.csv')

Or any other supported format:

to_dwc(observations, 'my_observations.dwc')
to_excel(observations, 'my_observations.xlsx')
to_feather(observations, 'my_observations.feather')
to_geojson(observations, 'my_observations.geojson')
to_gpx(observations, 'my_observations.gpx')
to_hdf(observations, 'my_observations.hdf')
to_json(observations, 'my_observations.json')
to_parquet(observations, 'my_observations.parquet')
df = to_dataframe(observations)

Import

Most file formats can be loaded via pyinaturalist_convert.read():

observations = read('my_observations.csv')
observations = read('my_observations.xlsx')
observations = read('my_observations.feather')
observations = read('my_observations.hdf')
observations = read('my_observations.json')
observations = read('my_observations.parquet')

Download

Download the complete research-grade observations dataset:

download_dwca_observations()

And load it into a SQLite database:

load_dwca_observations()

And do the same with the complete taxonomy dataset:

download_dwca_taxa()
load_dwca_taxa()

Load taxonomy data into a full text search database:

load_taxon_fts_table(languages=['english', 'german'])

And get lightning-fast autocomplete results from it:

ta = TaxonAutocompleter()
ta.search('aves')
ta.search('flughund', language='german')

Feedback

If you have any problems, suggestions, or questions about pyinaturalist-convert, you are welcome to create an issue or discussion. Also, PRs are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyinaturalist_convert-0.8.3.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyinaturalist_convert-0.8.3-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file pyinaturalist_convert-0.8.3.tar.gz.

File metadata

  • Download URL: pyinaturalist_convert-0.8.3.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyinaturalist_convert-0.8.3.tar.gz
Algorithm Hash digest
SHA256 e40dc22029306b6b92a34d03f76cc8ddcf00ae927479ab5a1816f4ff7f4021b0
MD5 ae19acc2b72efefc27b8696e3278c5b5
BLAKE2b-256 3c4e6537cb5cdd845e75edad9d9140bfb0d44099418aa59dafc6aa768598cece

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyinaturalist_convert-0.8.3.tar.gz:

Publisher: deploy.yml on pyinat/pyinaturalist-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyinaturalist_convert-0.8.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pyinaturalist_convert-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 53acda664495f893b544bbc0c142fcb3980b7924a6fac2a36cdd1e65db0093c4
MD5 b7fbf7f8bd4e1e0c1bcdb0b9d3d8be0f
BLAKE2b-256 33c08db6a2535f114bbbbe26a90e85d0ae7b1ebbfdc301cc3f862ed47c5dacd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyinaturalist_convert-0.8.3-py3-none-any.whl:

Publisher: deploy.yml on pyinat/pyinaturalist-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page