Skip to content

Instantly share code, notes, and snippets.

@RichardLitt
Created August 1, 2025 01:48
Show Gist options
  • Select an option

  • Save RichardLitt/5aaf2a450d080330537e52cbbbba1483 to your computer and use it in GitHub Desktop.

Select an option

Save RichardLitt/5aaf2a450d080330537e52cbbbba1483 to your computer and use it in GitHub Desktop.
How to get the scientific names from ITIS IDS using Python
# Import these libraries
# In order to run this, make sure to run pip install pytaxize first.
from pytaxize import itis
# List of TSNs (Taxonomic Serial Numbers)
# THis was a list of TSNs from a paper I had to review. I had to check them against ITIS,
# a register of scientific names. Then I made a loop that looked up each ITIS id and checked
# the scientitic name.
tsns = [
180559, 174371, 180544, 180582, 180599, 183798, 183838, 726821, 1086061,
180609, 180175, 180092, 180703, 180130, 179921, 180575, 180604, 180166,
180562, 180112, 180699, 180722, 176136
]
for tsn in tsns:
try:
record = itis.full_record(tsn=tsn)
# print(record)
combined_name = record.get('scientificName', {}).get('combinedName')
print(f"{tsn}: {combined_name}")
except Exception as e:
print(f"{tsn}: Error - {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment