Extinct species
Tags: #iucn #opendata #extinctspecies
Author: Unknown
Source : https://www.iucnredlist.org/statistics
If you want another view of the data : Link : https://ourworldindata.org/extinctions

Input

History

The initial aim was to compare the number of threatened species per species over time (e.g. number of pandas per year).
After a lot of research, it turns out that this kind of data is not available or it is only data from one year (2015 or 2018).
Therefore, we decided to start another project: Number of threatened species per year, with details by category using data from this site : https://www.iucnredlist.org/resources/summary-statistics#Summary%20Tables
So we took the pdf from this site and turned it into a csv. But the data was heavy and not easy to use. Moreover, we thought that this would not necessarily be viable and adaptable over time.
So we decided to take another datasource on a similar subject : Extinct Species, from this website : https://www.iucnredlist.org/statistics
Tags: #iucn #opendata #extinctspecies
Author: Unknown

Import library

1
import pandas as pd
Copied!

Test with 'read_html'

We couldn't use it cause there's too many tabs in the page (it'll take too long).
1
url = "https://www.iucnredlist.org/statistics"
2
3
#dfs = pd.read_html(url)
4
#df = dfs[0]
5
6
#df
Copied!

Model

We use CSV file

CSV button on this link to download the file: https://www.iucnredlist.org/statistics
1
# We load the csv file (must be root)
2
data = pd.read_csv('Table 3 Species by kingdom and class - show all.csv',',')
3
# We set the column Name as index
4
data.set_index('Name', inplace = True)
5
# Then we select the columns EX, EW and Name, and all the lines we want in the graph
6
table = data.loc[["Total",
7
"GASTROPODA",
8
"BIVALVIA",
9
"AVES",
10
"MAMMALIA",
11
"ACTINOPTERYGII",
12
"CEPHALASPIDOMORPHI",
13
"INSECTA",
14
"AMPHIBIA",
15
"REPTILIA",
16
"ARACHNIDA",
17
"CLITELLATA",
18
"DIPLOPODA",
19
"ENOPLA",
20
"TURBELLARIA",
21
"MALACOSTRACA",
22
"MAXILLOPODA",
23
"OSTRACODA"]# add species here
24
,"EX":"EW"]
25
table
Copied!
1
# We add a new column 'CATEGORY' to our Dataframe
2
table["CATEGORY"] = ["Total",
3
"Molluscs",
4
"Molluscs",
5
"Birds",
6
"Mammals",
7
"Fishes",
8
"Fishes",
9
"Insects",
10
"Amphibians",
11
"Reptiles",
12
"Others",
13
"Others",
14
"Others",
15
"Others",
16
"Others",
17
"Crustaceans",
18
"Crustaceans",
19
"Crustaceans"]
20
table = table.loc[:,["CATEGORY","EX"]] # we drop the column "EW"
21
table
22
# ---NOTE : If you want to add new species, you have to also add his category
Copied!
1
# We groupby CATEGORIES :
2
table.reset_index(drop=True, inplace=True)
3
table = table.groupby(['CATEGORY']).sum().reset_index()
4
table.rename(columns = {'EX':'Extincted'}, inplace=True)
5
table
Copied!

Output

Graph

1
# We use plotly to show datas with an horizontal bar chart
2
import plotly.express as px
3
4
def print_graph():
5
Graph = table.sort_values('Extincted', ascending=False)
6
fig = px.bar(Graph, x="Extincted", y="CATEGORY", color="CATEGORY", orientation="h")
7
fig.update_layout(title_text = "Number of species that have gone extinct since 1500", title_x = 0.5)
8
fig.add_annotation(x=800, y=0,text="Source : IUCN Red List of Threatened Species<br>https://www.iucnredlist.org/statistics",showarrow=False)
9
fig.show()
10
11
print_graph()
Copied!
  • https://donnees.banquemondiale.org/indicator/EN.MAM.THRD.NO (only 2018)
  • https://www.eea.europa.eu/data-and-maps/data/european-red-lists-4/european-red-list/european-red-list-csv-files/view (old Dataset, last upload was in 2015)
  • https://www.worldwildlife.org/species/directory?page=2 (the years are not available)
  • https://www.worldwildlife.org/pages/conservation-science-data-and-tools (apart from the case)
  • https://databasin.org/datasets/68635d7c77f1475f9b6c1d1dbe0a4c4c/ (we can't use it)
  • https://gisandscience.com/2009/12/01/download-datasets-from-the-world-wildlife-funds-conservation-science-program/ (no datas about threatened species)
  • https://data.world/datasets/tiger (only about tigers but there are no datas usefull)
Last modified 2mo ago
Copy link
Edit on GitHub