In [1]:
import os
print(os.getcwd())
#os.chdir('../blocking/')
import pandas as pd
import py_stringmatching as sm
import math
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import style
import re
from numpy import genfromtxt


/Users/andrew/workspace/endangeredanimals/analysis

In [2]:
df = pd.read_csv("labeled.csv", encoding="ISO-8859-1", index_col='_id')

In [3]:
df


Out[3]:
Unnamed: 0 ltable_name ltable_family ltable_ecology ltable_countries ltable_threat_paragraph ltable_conservation_paragraph ltable_pop_trend ltable_status ltable_country_count ... rtable_conservation rtable_threat_keywords rtable_conservation_keywords rtable_status rtable_countries rtable_country_count rtable_tCount label weight length
_id
1522478 7 caterpillar slug Veronicellidae NaN South Africa (KwaZulu-Natal); NaN NaN Unknown Endangered 1 ... Although there are currently no conservation m... loss;environment; Endangered ['India', 'Russia', 'Malaysia', 'China', 'Indo... 5 2 1.0 NaN 0.090
8689373 17 catalina mahogany Rosaceae NaN United States (California); NaN NaN NaN Critically Endangered 1 ... Conservation efforts began in the 1970s with a... loss;invasive; Critically Endangered ['Ukraine', 'Morocco', 'Russia', 'Hungary'] 4 2 1.0 NaN NaN
7512846 21 lorenz von liburnaus woolly lemur, western ava... Indriidae Terrestrial Madagascar; \r\r\r\r\r\n The major threat is forest des... ['\n This species is listed on Appendix I o... Decreasing Endangered 1 ... The western woolly lemur is confirmed in only ... hunting; protected; Critically Endangered ['Australia'] 1 1 1.0 0.0 NaN
1191527 23 bluelegged mantella, tular golden frog, tular ... Mantellidae Terrestrial; Freshwater Madagascar; \r\r\r\r\r\n The main threat to this specie... ['\n It occurs in Parque Nacional de Isalo.... Decreasing Endangered 1 ... Listing on Appendix II of the Convention on In... loss; Endangered ['Taiwan', 'China', 'Vietnam'] 3 1 1.0 3.0 NaN
4646125 25 malagasy giant jumping rat, malagasy giant rat Nesomyidae Terrestrial Madagascar; \r\r\r\r\r\n The historical decline of this... ['\n The new Menabe-Antimena protected area... Decreasing Endangered 1 ... This large rodent is in urgent need of conserv... loss;pet; captive breeding;protected; Endangered ['Canada'] 1 2 1.0 5000.0 NaN
8966650 33 lydenburg cycad Zamiaceae Terrestrial South Africa (Limpopo Province); \r\r\r\r\r\n This species has suffered much... ['\n This species is listed on Appendix I o... Decreasing Critically Endangered 1 ... There are not known to be any specific conserv... loss; cites;protected; Critically Endangered ['Australia', 'South Africa', 'Brazil'] 3 1 1.0 NaN NaN
1199442 48 bluelegged mantella, tular golden frog, tular ... Mantellidae Terrestrial; Freshwater Madagascar; \r\r\r\r\r\n The main threat to this specie... ['\n It occurs in Parque Nacional de Isalo.... Decreasing Endangered 1 ... Listing on Appendix II of the Convention on In... loss; Endangered ['Turkey'] 1 1 1.0 3.0 NaN
4143489 49 jeweled toad Bufonidae Terrestrial; Freshwater Mexico; \r\r\r\r\r\n The main threat is habitat los... ['\n Protection of the suburban and tropica... Decreasing Endangered 1 ... The jeweled toad is legally protected in Mexic... loss;disease;pollution; captive breeding;protected; Endangered ['Cambodia', 'Vietnam'] 2 3 1.0 NaN 0.080
4979395 53 mitred leaf monkey, sumatran surili Cercopithecidae Terrestrial Indonesia (Sumatera); \r\r\r\r\r\n There has been extensive loss ... ['\n This species is listed under CITES App... Decreasing Endangered 1 ... The mitred leaf monkey is protected by nationa... loss;poaching;pet; cites;protected; Endangered ['China'] 1 3 1.0 4000.0 NaN
7199307 55 twofingered skink Scincidae Terrestrial Spain; Algeria; Morocco; \r\r\r\r\r\n Development of coastal areas f... ['\n Further surveys are needed to better d... Decreasing Endangered 3 ... The two-fingered skink occurs in a few protect... protected; Critically Endangered ['Montenegro'] 1 0 1.0 NaN NaN
4464235 56 nilgiri longtailed tree mouse Muridae Terrestrial India; \r\r\r\r\r\n Human disturbance, use of pest... ['\n It is listed as a vermin under Schedul... Decreasing Endangered 1 ... There are currently no conservation measures i... loss;fragmentation; protected; Endangered ['Sri Lanka'] 1 2 1.0 0.0 NaN
6186039 61 salvins mushroomtongue salamander Plethodontidae Terrestrial El Salvador; Guatemala; \r\r\r\r\r\n The major threat in the past h... ['\n It is not currently known from any pro... Decreasing Endangered 2 ... No specific conservation measures are currentl... loss;fragmentation;environment;disease; protected; Critically Endangered ['Bermuda'] 1 4 1.0 NaN 0.068
7610113 70 rednosed bearded saki, rednosed saki, whitenos... Pitheciidae Terrestrial Brazil; \r\r\r\r\r\n The Trans-Amazon highway bisec... ['\n This species occurs in the Parque Naci... Decreasing Endangered 1 ... As well as being listed on Appendix I of the C... cites;protected;endangered species act; Critically Endangered ['Malta'] 1 0 NaN NaN 0.507
8862181 80 club naiad, clubshell, clubshell pearly mussel Unionidae NaN United States; NaN NaN NaN Critically Endangered 1 ... The clubshell pearly mussel is federally liste... invasive;pollution; Critically Endangered ['South Africa'] 1 2 NaN NaN NaN
9125918 89 delta green ground beetle Carabidae NaN United States; NaN NaN NaN Critically Endangered 1 ... The delta green ground beetle is protected by ... protected; Critically Endangered ['Angola', 'Equatorial Guinea', 'Gabon', 'Cent... 5 0 NaN NaN NaN
2099479 111 dark red meranti Dipterocarpaceae Terrestrial Indonesia (Sumatera); NaN ['\n Some subpopulations are found in prima... NaN Endangered 1 ... Some subpopulations of this species are found ... Endangered ['Seychelles'] 1 0 NaN NaN NaN
1089171 121 blue mountain water skink Scincidae NaN Australia; NaN NaN NaN Endangered 1 ... With high levels of <strong>endemism</strong> ... pollution; Endangered ['Russia', 'Georgia', 'Turkey'] 3 1 NaN 0.0 NaN
5575006 123 blackfaced black spider monkey, chamek spider ... Atelidae Terrestrial Bolivia, Plurinational States of; Brazil (Acre... \r\r\r\r\r\n The major threat is subsistenc... ['\n This species is confirmed, or may occu... Decreasing Endangered 3 ... The Peruvian spider monkey occurs in many prot... loss;hunting; cites;protected; Critically Endangered ['Taiwan', 'Philippines', 'China'] 3 2 NaN 7000.0 NaN
4638210 124 malagasy giant jumping rat, malagasy giant rat Nesomyidae Terrestrial Madagascar; \r\r\r\r\r\n The historical decline of this... ['\n The new Menabe-Antimena protected area... Decreasing Endangered 1 ... This large rodent is in urgent need of conserv... loss;pet; captive breeding;protected; Endangered ['Tanzania', 'Kenya'] 2 2 NaN 5000.0 NaN
3047256 139 golden bamboo lemur, golden lemur Lemuridae Terrestrial Madagascar; \r\r\r\r\r\n The major threat is habitat lo... ['\n This species is listed on Appendix I o... Decreasing Critically Endangered 1 ... In 1991 three areas of land around the village... loss;hunting;pet; Endangered ['Australia', 'United States'] 2 3 NaN 5000.0 NaN
5817875 152 queen alexandras birdwing Papilionidae NaN Papua New Guinea; NaN NaN NaN Endangered 1 ... Threatened by illegal trade and habitat loss t... loss; cites; Critically Endangered [] 0 1 NaN NaN NaN
2081657 158 danube salmon, huchen Salmonidae Freshwater Austria; Bosnia and Herzegovina; Croatia; Czec... \r\r\r\r\r\n Historically overfishing, poll... ['\n Restocking, fishing regulations. A EU ... Unknown Endangered 13 ... Conservation efforts to date have involved the... pollution; Endangered ['United States'] 1 1 NaN 3000.0 NaN
4472150 170 nilgiri longtailed tree mouse Muridae Terrestrial India; \r\r\r\r\r\n Human disturbance, use of pest... ['\n It is listed as a vermin under Schedul... Decreasing Endangered 1 ... There are currently no conservation measures i... loss;fragmentation; protected; Endangered ['Sri Lanka'] 1 2 NaN 0.0 NaN
9108068 172 delacours langur Cercopithecidae Terrestrial Viet Nam; \r\r\r\r\r\n Hunting for the purposes of tr... ["\n This species is currently listed only ... Decreasing Critically Endangered 1 ... Four areas where Delacourâ??s langurs are p... loss;hunting;environment; protected; Critically Endangered ['Ecuador'] 1 3 NaN 2000.0 0.880
5893603 193 orangebellied racer, redbellied racer, saba racer Dipsadidae NaN Saint Kitts and Nevis; Bonaire, Sint Eustatius... \r\r\r\r\r\n Extirpated historically from N... NaN NaN Endangered 2 ... Fortunately there are some systems in place to... protected; Critically Endangered ['Italy', 'Mexico'] 2 0 NaN NaN 0.920
83513 195 albanian water frog Ranidae Terrestrial; Freshwater Albania; Montenegro; \r\r\r\r\r\n The major threat is drainage o... ["\n It is listed on Appendix III of the Be... Decreasing Endangered 2 ... The Albanian water frog is listed on Appendix ... pet;pollution; protected; Endangered ['Montenegro', 'Albania'] 2 2 NaN NaN 0.074
1823172 209 cornish pathmoss Ditrichaceae Terrestrial United Kingdom (Great Britain); \r\r\r\r\r\n Habitat is threatened by encro... NaN Unknown Endangered 1 ... This species' rarity and the precarious state ... loss; Endangered ['Australia', 'United States'] 2 1 NaN NaN NaN
2604058 210 celebes tortoise, forstens tortoise, travancor... Testudinidae NaN Indonesia; NaN ['\n It is listed on CITES Appendix II.\n\n... NaN Endangered 1 ... International trade in Forsten's tortoise is r... pet; cites; Endangered ['Dominican Republic', 'Haiti'] 2 1 NaN 5000.0 NaN
8421174 211 blackeared golden mantella, blackeared mantella Mantellidae Terrestrial; Freshwater Madagascar; \r\r\r\r\r\n The area where this species oc... ['\n It is not known from any protected are... Decreasing Critically Endangered 1 ... For this species to persist trade must be care... loss;pet; protected; Critically Endangered ['India', 'Bangladesh', 'China', 'Laos', 'Myan... 13 2 NaN NaN NaN
7004837 215 tehuantepec hare, tehuantepec jackrabbit, tehu... Leporidae Terrestrial Mexico (Oaxaca); \r\r\r\r\r\n The species' habitat is threat... ['\n The Tehuantepec jackrabbit is listed a... Decreasing Endangered 1 ... The Tehuantepec jackrabbit is listed as Critic... loss;hunting; captive breeding;protected; Critically Endangered [] 0 2 NaN 4000.0 NaN
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
5701602 793 NaN Nepenthaceae Terrestrial Malaysia (Sabah); NaN ['\n On CITES Appendix II.\n\n \n '] NaN Endangered 1 ... <i>Nepenthes burbidgeae</i> is found only on M... loss;environmental;environment; cites;protected; Endangered ['Cuba'] 1 3 1.0 NaN NaN
5693687 794 NaN Nepenthaceae Terrestrial Malaysia (Sabah); NaN ['\n On CITES Appendix II.\n\n \n '] NaN Endangered 1 ... <i>Nepenthes burbidgeae</i> is found only on M... loss;environmental;environment; cites;protected; Endangered ['China'] 1 3 1.0 NaN NaN
7689716 795 melodius coqui, wightmans robber frog Eleutherodactylidae Terrestrial Puerto Rico; \r\r\r\r\r\n Although some habitat destruct... ["\n It occurs in several protected areas, ... Decreasing Endangered 1 ... Despite not being the target of any known cons... disease;pollution; protected; Critically Endangered ['Turkey', 'Greece', 'Mauritania'] 3 2 1.0 NaN 0.020
1491981 801 NaN Bufonidae Terrestrial Brazil; \r\r\r\r\r\n The major threats are habitat ... ['\n It might occur in the Estacion BiÃ?Â... Decreasing Endangered 1 ... Carvalhoâ??s tree toad is found in protecte... loss; protected; Endangered ['United States'] 1 1 1.0 NaN NaN
75598 811 albanian water frog Ranidae Terrestrial; Freshwater Albania; Montenegro; \r\r\r\r\r\n The major threat is drainage o... ["\n It is listed on Appendix III of the Be... Decreasing Endangered 2 ... The Albanian water frog is listed on Appendix ... pet;pollution; protected; Endangered ['Montenegro', 'Albania'] 2 2 1.0 NaN 0.074
234110 813 aran rock lizard Lacertidae Terrestrial France; Spain; \r\r\r\r\r\n This species is possibly threa... ['\n This species is listed on Appendix III... Decreasing Endangered 2 ... The Aran rock lizard is listed on Appendix III... protected; Endangered ['Thailand', 'Bangladesh', 'India', 'Malaysia'] 4 0 1.0 NaN 0.060
3621991 817 black howling monkey, guatemalan black howler,... Atelidae Terrestrial Belize; Guatemala; Mexico (Campeche, Chiapas, ... \r\r\r\r\r\n The main threats to this speci... ['\n This species occurs, or may occur, in ... Decreasing Endangered 3 ... The Guatemalan black howler is known to occur ... hunting; protected; Endangered ['New Zealand'] 1 1 1.0 4000.0 0.710
8429089 831 blackeared golden mantella, blackeared mantella Mantellidae Terrestrial; Freshwater Madagascar; \r\r\r\r\r\n The area where this species oc... ['\n It is not known from any protected are... Decreasing Critically Endangered 1 ... For this species to persist trade must be care... loss;pet; protected; Critically Endangered [] 0 2 1.0 NaN NaN
166554 854 blind swamp eel Synbranchidae NaN Mexico; NaN NaN NaN Endangered 1 ... There are currently no conservation measures t... pollution; Endangered ['Oman', 'United Arab Emirates'] 2 1 1.0 NaN NaN
4616327 857 ginkgo, maidenhair tree Ginkgoaceae Terrestrial China (Zhejiang); NaN ['\n The species has been widespread in cul... NaN Endangered 1 ... It is uncertain whether the maidenhair tree st... loss; Endangered ['Philippines', 'China'] 2 1 1.0 NaN NaN
2837560 869 giant bushytailed cloud rat, luzon bushytailed... Muridae Terrestrial Philippines; \r\r\r\r\r\n It is supposed that hunting is... ['\n Stricter enforcement of hunting restri... Decreasing Endangered 1 ... The giant bushy-tailed cloud rat occurs in sev... loss;pet; Endangered ['New Caledonia'] 1 2 1.0 5000.0 NaN
2013291 880 NaN Zamiaceae Terrestrial Mexico (Oaxaca, Veracruz); \r\r\r\r\r\n This species is affected by se... ['\n This species is listed on Appendix II ... Decreasing Endangered 1 ... Cycads are of great conservation interest as t... loss; cites; Endangered ['Philippines'] 1 1 1.0 NaN 16.000
2520162 882 fivekeeled spinytailed iguana, oaxacan spinyta... Iguanidae Terrestrial Costa Rica; Nicaragua; \r\r\r\r\r\n Habitat loss through deforesta... ['\n This species currently is not under an... Decreasing Endangered 2 ... Five-keeled spiny-tailed iguanas currently hav... loss;pet; Endangered ['South Africa'] 1 2 1.0 NaN 0.475
3379785 884 greater bigfooted mouse, longtailed bigfooted ... Nesomyidae Terrestrial Madagascar; \r\r\r\r\r\n This species is threatened by ... ['\n This species is present in the Ankaraf... Decreasing Endangered 1 ... The greater big-footed mouse occurs within the... Endangered ['Mauritius', 'Reunion'] 2 0 1.0 0.0 NaN
1722091 888 central anatolian spined loach Cobitidae Freshwater Turkey (Turkey-in-Asia); \r\r\r\r\r\n Droughts due to over exploitat... ['\n', <p><span class="st"><span lang="EN-GB">... Decreasing Endangered 1 ... <em>Cobitis turcica</em> has not been the targ... pet;pollution; Endangered ['Vietnam', 'Malaysia', 'Indonesia', 'Thailand'] 4 2 1.0 NaN 0.081
8777688 914 china alligator, chinese alligator Alligatoridae Terrestrial; Freshwater China (Anhui, Jiangsu, Zhejiang); NaN ['\n It is listed on CITES Appendix I.\n\n ... NaN Critically Endangered 1 ... In contrast to the decimated wild population t... protected; Critically Endangered [] 0 0 1.0 0.0 NaN
2426517 915 NaN Cyprinidae Freshwater Greece; \r\r\r\r\r\n Water extraction and pollution... ['\n None.\n\n \n '] Decreasing Endangered 1 ... The Evrotas River home to the European dace is... loss;pollution; protected; Endangered ['China'] 1 2 1.0 NaN 0.250
5054359 924 NaN Amaryllidaceae Terrestrial Spain; \r\r\r\r\r\n This species is vulnerable to ... ['\n This species is included in various Na... Decreasing Endangered 1 ... <em>Narcissus longispathus</em> is present in ... Endangered ['Italy'] 1 0 1.0 NaN NaN
2820516 938 germains langur, germains silver langur, indoc... Cercopithecidae Terrestrial Cambodia; Lao People's Democratic Republic; My... \r\r\r\r\r\n The major threats to this spec... ['\n This species is listed on CITES Append... Decreasing Endangered 5 ... Germainâ??s langur occurs in a number of pr... loss;hunting;pet; cites;protected; Endangered ['Brazil'] 1 3 1.0 NaN 0.840
6178124 950 salvins mushroomtongue salamander Plethodontidae Terrestrial El Salvador; Guatemala; \r\r\r\r\r\n The major threat in the past h... ['\n It is not currently known from any pro... Decreasing Endangered 2 ... No specific conservation measures are currentl... loss;fragmentation;environment;disease; protected; Critically Endangered ['Bermuda', 'South Africa', 'United States'] 3 4 1.0 NaN 0.068
4932151 954 mexican water mouse Cricetidae Terrestrial; Freshwater Mexico; \r\r\r\r\r\n This species is threatened by ... ['\n More research is needed to determine t... Unknown Endangered 1 ... The Mexican water mouse is classed as â??Ra... pollution; Endangered ['Sri Lanka'] 1 1 1.0 8.0 NaN
8879437 959 cooks holly Aquifoliaceae Terrestrial Puerto Rico; \r\r\r\r\r\n The construction of communicat... ['\n It is listed on the US Endangered Spec... NaN Critically Endangered 1 ... Cookâ??s holly was listed on the US Endange... endangered species act; Critically Endangered [] 0 0 1.0 NaN NaN
3012210 962 glittering demoiselle Calopterygidae Terrestrial; Freshwater Algeria; Morocco; Tunisia; \r\r\r\r\r\n Water pollution, drying up of ... ['\n Control of water pollution and reserve... Decreasing Endangered 3 ... There are currently no known conservation init... loss;pollution; Endangered ['India'] 1 2 1.0 NaN 0.042
5062274 974 NaN Amaryllidaceae Terrestrial Spain; \r\r\r\r\r\n This species is vulnerable to ... ['\n This species is included in various Na... Decreasing Endangered 1 ... <em>Narcissus longispathus</em> is present in ... Endangered ['South Africa'] 1 0 1.0 NaN NaN
1364211 976 NaN Cactaceae Terrestrial Brazil (Bahia); \r\r\r\r\r\n The species is threatened by s... ['\n The species occurs in the Parque Estad... Decreasing Endangered 1 ... <i>Melocactus glaucescens</i> has been placed ... cites;protected; Endangered ['Tunisia', 'Morocco', 'Algeria'] 3 0 1.0 NaN NaN
1348381 978 NaN Cactaceae Terrestrial Brazil (Bahia); \r\r\r\r\r\n The species is threatened by s... ['\n The species occurs in the Parque Estad... Decreasing Endangered 1 ... <i>Melocactus glaucescens</i> has been placed ... cites;protected; Endangered ['Cuba'] 1 0 1.0 NaN NaN
4753626 981 marleys golden mole Chrysochloridae Terrestrial South Africa (KwaZulu-Natal); \r\r\r\r\r\n The single major threat is lik... ['\n Known to occur in only the Pongola Wil... Unknown Endangered 1 ... There are no specific conservation measures in... pet; protected; Endangered ['Turkey', 'Sri Lanka'] 2 1 1.0 4.0 NaN
1136401 983 blue shiner Cyprinidae Freshwater United States; \r\r\r\r\r\n Declines have been caused by w... ['\n Hatchery spawning techniques need to b... Decreasing Endangered 1 ... The future of the blue shiner very much depend... loss;pollution; Endangered ['United Kingdom', 'New Zealand'] 2 2 1.0 NaN NaN
3808519 992 haitian solenodon, hispaniolan solenodon Solenodontidae Terrestrial Dominican Republic; Haiti; \r\r\r\r\r\n The most significant threat to... ['\n It is protected by law in the Dominica... Decreasing Endangered 2 ... There is thought to be little hope for this sp... captive breeding;protected; Endangered [] 0 0 1.0 0.0 NaN
3800604 994 haitian solenodon, hispaniolan solenodon Solenodontidae Terrestrial Dominican Republic; Haiti; \r\r\r\r\r\n The most significant threat to... ['\n It is protected by law in the Dominica... Decreasing Endangered 2 ... There is thought to be little hope for this sp... captive breeding;protected; Endangered ['Czech Republic', 'Spain', 'Ecuador'] 3 0 1.0 0.0 NaN

148 rows × 30 columns


In [4]:
for c in df.columns:
    print(c)
    
len(df.columns)


Unnamed: 0
ltable_name
ltable_family
ltable_ecology
ltable_countries
ltable_threat_paragraph
ltable_conservation_paragraph
ltable_pop_trend
ltable_status
ltable_country_count
scientific_name
rtable_name
rtable_kingdom
rtable_phylum
rtable_class
rtable_order
rtable_family
genus
rtable_size
rtable_threats
rtable_conservation
rtable_threat_keywords
rtable_conservation_keywords
rtable_status
rtable_countries
rtable_country_count
rtable_tCount
label
weight
length
Out[4]:
30

In [5]:
df.drop('Unnamed: 0', axis=1, inplace=True)

In [6]:
for c in df.columns:
    cu = c
    if 'rtable' in c:
        print("original:", c)
        cu = c.replace('rtable', 'arkive')
        print("updated:",cu)
    if 'ltable' in c:
        print("original:", c)
        cu = c.replace('ltable', 'redlist')
        print("updated:",cu)
    df.rename(columns={c:cu}, inplace=True)


original: ltable_name
updated: redlist_name
original: ltable_family
updated: redlist_family
original: ltable_ecology
updated: redlist_ecology
original: ltable_countries
updated: redlist_countries
original: ltable_threat_paragraph
updated: redlist_threat_paragraph
original: ltable_conservation_paragraph
updated: redlist_conservation_paragraph
original: ltable_pop_trend
updated: redlist_pop_trend
original: ltable_status
updated: redlist_status
original: ltable_country_count
updated: redlist_country_count
original: rtable_name
updated: arkive_name
original: rtable_kingdom
updated: arkive_kingdom
original: rtable_phylum
updated: arkive_phylum
original: rtable_class
updated: arkive_class
original: rtable_order
updated: arkive_order
original: rtable_family
updated: arkive_family
original: rtable_size
updated: arkive_size
original: rtable_threats
updated: arkive_threats
original: rtable_conservation
updated: arkive_conservation
original: rtable_threat_keywords
updated: arkive_threat_keywords
original: rtable_conservation_keywords
updated: arkive_conservation_keywords
original: rtable_status
updated: arkive_status
original: rtable_countries
updated: arkive_countries
original: rtable_country_count
updated: arkive_country_count
original: rtable_tCount
updated: arkive_tCount

In [7]:
df.drop('arkive_family', axis=1, inplace=True)
df.drop('arkive_status', axis=1, inplace=True)
df.drop('label', axis=1, inplace=True)


arkive_only = ['arkive_kingdom',
    'arkive_phylum',
    'arkive_class',
    'arkive_order',
    'arkive_size',
    'arkive_tCount',
    'arkive_threats',
    'arkive_threat_keywords',
    'arkive_conservation_keywords'
    ]

for c in arkive_only:
    cu = c.replace('arkive_', '')
    df.rename(columns={c:cu}, inplace=True)
    
redlist_only = ['redlist_ecology',
                'redlist_pop_trend',
                'redlist_status',
                'redlist_family']
for c in redlist_only:
    cu = c.replace('redlist_', '')
    df.rename(columns={c:cu}, inplace=True)

df.rename(columns={'tCount':'threat_count'}, inplace=True)
df.rename(columns={'arkive_conservation':'arkive_conservation_paragraph'}, inplace=True)

In [8]:
for c in df.columns:
    print(c)
    
len(df.columns)


redlist_name
family
ecology
redlist_countries
redlist_threat_paragraph
redlist_conservation_paragraph
pop_trend
status
redlist_country_count
scientific_name
arkive_name
kingdom
phylum
class
order
genus
size
threats
arkive_conservation_paragraph
threat_keywords
conservation_keywords
arkive_countries
arkive_country_count
threat_count
weight
length
Out[8]:
26

In [9]:
#combine country columns
# author: @andrewedstrom

import operator, re, string

country_column = []
country_count = []

#create delimiter tokenizer using semicolon as delimiter
semi_tok = sm.DelimiterTokenizer(delim_set=['; '], return_set=True)
comma_tok = sm.DelimiterTokenizer(delim_set=[', '], return_set=True)

def clean_tokens(tok_list):
    new_list = []
    for s in tok_list:
        s = s.lower()
        
        #parentheticals
        if '(' in s:
            pstart = s.find('(')
            pend = s.find(')')
            if pend < len(s) - 1 and pend > 0:
                s = s[0:pstart] + s[pend+1:]
            else:
                s = s[0:pstart]
                
        #leading/trailing whitespace
        s = s.strip()
        
        #leading/trailing punctuation
        s = s.strip(string.punctuation)
        s = re.sub(r'[^a-zA-Z0-9 ]',r'',s)

        new_list.append(s)
    return new_list

for index, row in df.iterrows():
    lc = row['redlist_countries']
    rc = row['arkive_countries']
    
    ltok = semi_tok.tokenize(lc)
    rtok = comma_tok.tokenize(rc)
    ltok = clean_tokens(ltok)
    rtok = clean_tokens(rtok)
    
    d = {}
    
    for t in ltok:
        d[t] = True
    for t in rtok:
        if not d.get(t):
            d[t] = True
    keys = [k for k in d.keys()]
    
    
    country_list = ""
    for k in keys: 
        country_list += k + "; "
    country_list = country_list.strip().strip(string.punctuation)
    print(country_list)
    print()
    
    count = len(d)
    country_column.append(country_list)
    country_count.append(count)

df['countries'] = country_column
df['country_count'] = country_count
df.head()


russia; south africa; indonesia; malaysia; china; india

russia; morocco; ukraine; hungary; united states

australia; madagascar

china; vietnam; taiwan; madagascar

canada; madagascar

south africa; brazil; australia

turkey; madagascar

mexico; vietnam; cambodia

china; indonesia

montenegro; algeria; spain; morocco

sri lanka; india

bermuda; guatemala; el salvador

brazil; malta

south africa; united states

cameroon; angola; gabon; central african republic; equatorial guinea; united states

seychelles; indonesia

turkey; russia; georgia; australia

bolivia plurinational states of; taiwan; brazil; philippines; peru; china

kenya; tanzania; madagascar

united states; australia; madagascar

 papua new guinea

slovenia; montenegro; serbia; austria; bosnia and herzegovina; czech republic; hungary; poland; romania; slovakia; ukraine; germany; croatia; united states

sri lanka; india

viet nam; ecuador

bonaire sint eustatius and saba; italy; mexico; saint kitts and nevis

montenegro; albania

united states; australia; united kingdom

haiti; dominican republic; indonesia

cambodia; bhutan; pakistan; philippines; thailand; india; singapore; nepal; laos; madagascar; vietnam; china; bangladesh; myanmar

 mexico

vietnam; papua new guinea

philippines; paraguay; bolivia; brazil

paraguay; bolivia; brazil; madagascar

new caledonia; new zealand

turkey; 

south africa; indonesia

south africa; spain

denmark; russian federation; south africa; united states; netherlands; atlantic  northwestdiv; canada; sweden; namibia; faroe islands; germany; divatlantic  northeast; greenland; united kingdom; norway; iceland; france

jamaica; indonesia

turkey; mexico; armenia

philippines; china

thailand; cambodia; greece 

mexico; bermuda; china; bahamas; united states

tanzania; united states

south africa; japan

namibia; united states

ethiopia; seychelles

thailand; cambodia; sri lanka; china; laos

bahamas; mauritius

philippines; mauritius; madagascar

united kingdom; united states; cameroon; ghana; gabon; sierra leone; liberia; nigeria; barbados; cte divoire

bermuda; morocco

mexico

haiti; virgin islands us; dominican republic; virgin islands british

bermuda; morocco

philippines; indonesia

denmark; russian federation; united states; netherlands; indonesia; atlantic  northwestdiv; canada; sweden; faroe islands; germany; divatlantic  northeast; greenland; united kingdom; norway; iceland; france

vietnam; china; united kingdom

thailand; cambodia; sri lanka; vietnam; laos

panama; costa rica; vietnam; china

argentina; new zealand

russia; cambodia; sri lanka; taiwan; indonesia; philippines; china; hong kong; singapore; india; mexico; thailand; japan; belize; south korea; north korea; vietnam; guatemala; bangladesh; myanmar

malaysia; thailand; india; singapore; indonesia

mauritius; madagascar

sri lanka; vietnam

turkey; falkland islands

haiti; seychelles; dominican republic

venezuela; falkland islands

panama; colombia; kazakhstan; china; ecuador

venezuela; mexico; divpacific  eastern centraldiv; united states

malaysia; mexico

philippines; brazil; new zealand

south africa; united kingdom

russia; bhutan; taiwan; pakistan; thailand; india; mongolia; hong kong; mauritius; japan; philippines; south korea; north korea; vietnam; china; bangladesh; nepal; myanmar

viet nam; uruguay; china; united states

somalia; virgin islands us; kenya; virgin islands british

bahamas; mauritius

 spain

vietnam; cuba; china

south africa; indonesia; thailand; malaysia; vietnam; cambodia; singapore; myanmar

mexico; madagascar

united kingdom; united states

 madagascar

australia; united states

cape verde; madagascar

guinea; gabon; myanmar

 australia

philippines; south africa; canada; united states

india; laos; cambodia; malaysia; thailand; nepal; bangladesh; united states

bhutan; china; india; nepal; indonesia

united kingdom; andorra; algeria; morocco; philippines; gibraltar; spain; france

russia; south africa; china; india; iran

viet nam; uruguay; bolivia

china; united states

portugal; ethiopia; spain

cameroon; angola; gabon; central african republic; equatorial guinea; united states

bahamas; mexico

egypt; haiti

philippines; viet nam

south africa; cameroon; ghana; gabon; sierra leone; liberia; nigeria; cte divoire

algeria; tunisia; brazil; morocco

algeria; tunisia; morocco; indonesia

namibia; ; south africa

mexico; united states; madagascar

french polynesia; united states

panama; costa rica; vietnam; china

colombia; mexico; mauritius; czech republic

sweden; uruguay; canada; peru; norway; bolivia

new caledonia; zambia

peru; myanmar

reunion; mauritius; madagascar

ethiopia; sri lanka

south africa

cambodia; lao peoples democratic republic; greece; thailand; malaysia; viet nam; myanmar; bangladesh; nepal; india

kenya; puerto rico

united states; indonesia

panama; costa rica; taiwan province of china

mexico; south africa

malaysia; cuba

malaysia; china

turkey; greece; puerto rico; mauritania

brazil; united states

montenegro; albania

malaysia; thailand; france; spain; india; bangladesh

belize; mexico; guatemala; new zealand

 madagascar

oman; mexico; united arab emirates

philippines; china

new caledonia; philippines

philippines; mexico

costa rica; south africa; nicaragua

reunion; mauritius; madagascar

turkey; malaysia; thailand; vietnam; indonesia

 china

greece; china

italy; spain

cambodia; lao peoples democratic republic; brazil; thailand; viet nam; myanmar

south africa; bermuda; guatemala; el salvador; united states

mexico; sri lanka

 puerto rico

india; algeria; tunisia; morocco

south africa; spain

algeria; tunisia; brazil; morocco

cuba; brazil

turkey; south africa; sri lanka

new zealand; united kingdom; united states

 haiti; dominican republic

ecuador; haiti; spain; czech republic; dominican republic

Out[9]:
redlist_name family ecology redlist_countries redlist_threat_paragraph redlist_conservation_paragraph pop_trend status redlist_country_count scientific_name ... arkive_conservation_paragraph threat_keywords conservation_keywords arkive_countries arkive_country_count threat_count weight length countries country_count
_id
1522478 caterpillar slug Veronicellidae NaN South Africa (KwaZulu-Natal); NaN NaN Unknown Endangered 1 Laevicaulis haroldi ... Although there are currently no conservation m... loss;environment; ['India', 'Russia', 'Malaysia', 'China', 'Indo... 5 2 NaN 0.09 russia; south africa; indonesia; malaysia; chi... 6
8689373 catalina mahogany Rosaceae NaN United States (California); NaN NaN NaN Critically Endangered 1 Cercocarpus traskiae ... Conservation efforts began in the 1970s with a... loss;invasive; ['Ukraine', 'Morocco', 'Russia', 'Hungary'] 4 2 NaN NaN russia; morocco; ukraine; hungary; united states 5
7512846 lorenz von liburnaus woolly lemur, western ava... Indriidae Terrestrial Madagascar; \r\r\r\r\r\n The major threat is forest des... ['\n This species is listed on Appendix I o... Decreasing Endangered 1 Avahi occidentalis ... The western woolly lemur is confirmed in only ... hunting; protected; ['Australia'] 1 1 0.0 NaN australia; madagascar 2
1191527 bluelegged mantella, tular golden frog, tular ... Mantellidae Terrestrial; Freshwater Madagascar; \r\r\r\r\r\n The main threat to this specie... ['\n It occurs in Parque Nacional de Isalo.... Decreasing Endangered 1 Mantella expectata ... Listing on Appendix II of the Convention on In... loss; ['Taiwan', 'China', 'Vietnam'] 3 1 3.0 NaN china; vietnam; taiwan; madagascar 4
4646125 malagasy giant jumping rat, malagasy giant rat Nesomyidae Terrestrial Madagascar; \r\r\r\r\r\n The historical decline of this... ['\n The new Menabe-Antimena protected area... Decreasing Endangered 1 Hypogeomys antimena ... This large rodent is in urgent need of conserv... loss;pet; captive breeding;protected; ['Canada'] 1 2 5000.0 NaN canada; madagascar 2

5 rows × 28 columns


In [10]:
#drop  arkive and redlist specific country and country count columns

df.drop('redlist_country_count', axis=1, inplace=True)
df.drop('redlist_countries', axis=1, inplace=True)
df.drop('arkive_country_count', axis=1, inplace=True)
df.drop('arkive_countries', axis=1, inplace=True)

In [11]:
for c in df.columns:
    print(c)


redlist_name
family
ecology
redlist_threat_paragraph
redlist_conservation_paragraph
pop_trend
status
scientific_name
arkive_name
kingdom
phylum
class
order
genus
size
threats
arkive_conservation_paragraph
threat_keywords
conservation_keywords
threat_count
weight
length
countries
country_count

In [12]:
#combine name columns
# author: @andrewedstrom

import operator, re, string

name_column = []
comma_tok = sm.DelimiterTokenizer(delim_set=[', '], return_set=True)

for index, row in df.iterrows():
    lc = row['redlist_name']
    rc = row['arkive_name']
    if not (type(lc) is str or type(rc) is str):
        name_column.append(None)
        continue
    
    ltok = None
    rtok = None
    if type(lc) is str:
        ltok = comma_tok.tokenize(lc)
        ltok = clean_tokens(ltok)

    if type(rc) is str:
        rtok = comma_tok.tokenize(rc)
        rtok = clean_tokens(rtok)
    
    d = {}
    
    if ltok:
        for t in ltok:
            d[t] = True
    if rtok:
        for t in rtok:
            if not d.get(t):
                d[t] = True
    keys = [k for k in d.keys()]
    
    
    name_list = ""
    for k in keys: 
        name_list += k + ", "
    name_list = name_list.strip().strip(string.punctuation)
    print(name_list)
    
    name_column.append(name_list)

df['names'] = name_column
df.head()


caterpillar slug
catalina mahogany
lorenz von liburnaus woolly lemur, western avahi, western woolly lemur
tular golden frog, tular mantella, bluelegged mantella, tulear golden frog
malagasy giant rat, malagasy giant jumping rat
lydenburg cycad, cycad
tular golden frog, tular mantella, bluelegged mantella, tulear golden frog
jeweled toad
mitred leaf monkey, sumatran surili
twofingered skink
nilgiri longtailed tree mouse, longtailed climbing mouse
salvins mushroomtongue salamander
whitenosed bearded saki, rednosed saki, rednosed bearded saki, whitenosed saki
club naiad, clubshell pearly mussel, clubshell
delta green ground beetle
dark red meranti
blue mountains water skink, blue mountain water skink
peruvian spider monkey, chamek spider monkey, blackfaced black spider monkey, peruvian black spider monkey
malagasy giant rat, malagasy giant jumping rat
golden lemur, golden bamboo lemur
queen alexandras birdwing
danube salmon, huchen
nilgiri longtailed tree mouse, longtailed climbing mouse
delacours langur
orangebellied racer, redbellied racer, saba racer
albanian water frog
cornish path moss, cornish pathmoss
forstens tortoise, travancore tortoise, celebes tortoise
blackeared golden mantella, blackeared mantella
tropical hare, tehuantepec jack rabbit, tehuantepec jackrabbit, tehuantepec hare
queen alexandras birdwing
palawan horned frog
malagasy rainbow frog, red rain frog, painted burrowing frog, gottlebes narrowmouthed frog
parrotsbill, kakabeak, lobster claw, new zealand parrotsbill
mountain viper
clanwilliam cypress, clanwilliam cedar, cape cedar
spanish algyroides
halibut, atlantic halibut
wallaces golden birdwing, wallaces golden birdwing butterfly
darevskys viper
maidenhair tree, ginkgo
greek goldenring
chinese giant salamander
san joaquin antelope ground squirrel, nelsons antelope squirrel, san joaquin antelope squirrel
dune cycad, alexandria cycad
cave catfish
mountain nyala
leafnosed lizard, tennents leafnosed lizard
round island boa, round island ground boa, round island keelscaled boa
russet batomys, dinagat hairytailed rat
cherry mahogany, baku
smallfingered psammodromus, green psammodromus
mexican water mouse
virgin islands coqui
smallfingered psammodromus, green psammodromus
russet batomys, dinagat hairytailed rat
halibut, atlantic halibut
cornish path moss, cornish pathmoss
leafnosed lizard, tennents leafnosed lizard
costa rica brook frog
southern tucotuco
guatemalan black howler monkey, lawrences howler monkey, black howling monkey, guatemalan black howler, guatemalan howling monkey, mexican black howler monkey, guatemalan howler, yucatn black howler monkey
meranti, light red meranti
lime mantella, green golden frog, green mantella
spineless forest lizard
central anatolian spined loach, cobitis
hispanolan hutia, cuviers hutia, hispaniolan hutia
falkland rockcress, falklands rock cress
semirechensk salamander
giant sea bass, black sea bass
axolotl
giant bushytailed cloud rat, luzon bushytailed cloud rat, luzon crateromys
dlinza pinwheel, dlinza forest pinwheel
gnthers gecko, round island day gecko
golden vietnamese cypress
virgin islands coqui
round island boa, round island ground boa, round island keelscaled boa
spanish algyroides
cuban crocodile
clanwilliam cypress, clanwilliam cedar, cape cedar
lime mantella, green golden frog, green mantella
delta green ground beetle
lorenz von liburnaus woolly lemur, western avahi, western woolly lemur
bluntnosed leopard lizard, san joaquin leopard lizard
blackandwhite ruffed lemur, ruffed lemur
flatback tortoise, burmese starred tortoise
murray hardyhead
panay monitor lizard
catalina mahogany
forstens tortoise, travancore tortoise, celebes tortoise
aurelios rock lizard
cape stag beetle
delacours langur
china alligator, chinese alligator
northern iberian spinedloach
delta green ground beetle
central bahamian rock iguana, san salvador iguana, acklins ground iguana, watling island iguana, san salvador ground iguana, white cay ground iguana
carossier palm
delacours langur
cherry mahogany, baku
cactus
dark red meranti
bastard quiver tree
malagasy giant rat, malagasy giant jumping rat
san joaquin antelope ground squirrel, nelsons antelope squirrel, san joaquin antelope squirrel
costa rica brook frog
caf marron
boreal felt lichen
rule araucaria
flatback tortoise, burmese starred tortoise
greater bigfooted mouse, longtailed bigfooted mouse
mountain nyala
venda cycad, cycad
elongated tortoise, yellowheaded tortoise, pineapple tortoise, yellow tortoise, rednosed tortoise
cooks holly
pitcher plant
brown frog
baja california legless lizard
pitcher plant
pitcher plant
melodius coqui, wightmans robber frog
carvalhos tree toad
albanian water frog
aran rock lizard
guatemalan black howler monkey, lawrences howler monkey, black howling monkey, guatemalan black howler, guatemalan howling monkey, mexican black howler monkey, guatemalan howler, yucatn black howler monkey
blackeared golden mantella, blackeared mantella
anguila ciega, blind swamp eel
maidenhair tree, ginkgo
giant bushytailed cloud rat, luzon bushytailed cloud rat, luzon crateromys
cycad
oaxacan spinytail iguana, oaxacan spinytailed iguana, fivekeeled spinytailed iguana
greater bigfooted mouse, longtailed bigfooted mouse
central anatolian spined loach, cobitis
china alligator, chinese alligator
european dace
narcissus
indochinese lutung, germains langur, germains silver langur, indochinese silvered langur
salvins mushroomtongue salamander
mexican water mouse
cooks holly
glittering demoiselle
narcissus
cactus
cactus
marleys golden mole
blue shiner
hispaniolan solenodon, haitian solenodon
hispaniolan solenodon, haitian solenodon
Out[12]:
redlist_name family ecology redlist_threat_paragraph redlist_conservation_paragraph pop_trend status scientific_name arkive_name kingdom ... threats arkive_conservation_paragraph threat_keywords conservation_keywords threat_count weight length countries country_count names
_id
1522478 caterpillar slug Veronicellidae NaN NaN NaN Unknown Endangered Laevicaulis haroldi caterpillar slug Animalia ... The caterpillar slug is threatened by habitat ... Although there are currently no conservation m... loss;environment; 2 NaN 0.09 russia; south africa; indonesia; malaysia; chi... 6 caterpillar slug
8689373 catalina mahogany Rosaceae NaN NaN NaN NaN Critically Endangered Cercocarpus traskiae catalina mahogany Plantae ... Historically a major threat to the Catalina ma... Conservation efforts began in the 1970s with a... loss;invasive; 2 NaN NaN russia; morocco; ukraine; hungary; united states 5 catalina mahogany
7512846 lorenz von liburnaus woolly lemur, western ava... Indriidae Terrestrial \r\r\r\r\r\n The major threat is forest des... ['\n This species is listed on Appendix I o... Decreasing Endangered Avahi occidentalis western woolly lemur Animalia ... 15 species of lemur have become extinct since ... The western woolly lemur is confirmed in only ... hunting; protected; 1 0.0 NaN australia; madagascar 2 lorenz von liburnaus woolly lemur, western ava...
1191527 bluelegged mantella, tular golden frog, tular ... Mantellidae Terrestrial; Freshwater \r\r\r\r\r\n The main threat to this specie... ['\n It occurs in Parque Nacional de Isalo.... Decreasing Endangered Mantella expectata bluelegged mantella Animalia ... Several thousand blue-legged mantellas are tho... Listing on Appendix II of the Convention on In... loss; 1 3.0 NaN china; vietnam; taiwan; madagascar 4 tular golden frog, tular mantella, bluelegged ...
4646125 malagasy giant jumping rat, malagasy giant rat Nesomyidae Terrestrial \r\r\r\r\r\n The historical decline of this... ['\n The new Menabe-Antimena protected area... Decreasing Endangered Hypogeomys antimena malagasy giant rat Animalia ... Like many of Madagascarâ??s unique species ... This large rodent is in urgent need of conserv... loss;pet; captive breeding;protected; 2 5000.0 NaN canada; madagascar 2 malagasy giant rat, malagasy giant jumping rat

5 rows × 25 columns


In [13]:
df.drop('redlist_name', axis=1, inplace=True)
df.drop('arkive_name', axis=1, inplace=True)

In [14]:
print(len(df.columns))
for c in df.columns:
    print(c)


23
family
ecology
redlist_threat_paragraph
redlist_conservation_paragraph
pop_trend
status
scientific_name
kingdom
phylum
class
order
genus
size
threats
arkive_conservation_paragraph
threat_keywords
conservation_keywords
threat_count
weight
length
countries
country_count
names

In [26]:
df.head(5)


Out[26]:
family ecology redlist_threat_paragraph redlist_conservation_paragraph pop_trend status scientific_name kingdom phylum class ... threats arkive_conservation_paragraph threat_keywords conservation_keywords threat_count weight length countries country_count names
_id
1522478 Veronicellidae NaN NaN NaN Unknown Endangered Laevicaulis haroldi Animalia Mollusca Gastropoda ... The caterpillar slug is threatened by habitat ... Although there are currently no conservation m... loss;environment; 2 NaN 0.09 russia; south africa; indonesia; malaysia; chi... 6 caterpillar slug
8689373 Rosaceae NaN NaN NaN NaN Critically Endangered Cercocarpus traskiae Plantae Tracheophyta Magnoliopsida ... Historically a major threat to the Catalina ma... Conservation efforts began in the 1970s with a... loss;invasive; 2 NaN NaN russia; morocco; ukraine; hungary; united states 5 catalina mahogany
7512846 Indriidae Terrestrial \r\r\r\r\r\n The major threat is forest des... ['\n This species is listed on Appendix I o... Decreasing Endangered Avahi occidentalis Animalia Chordata Mammalia ... 15 species of lemur have become extinct since ... The western woolly lemur is confirmed in only ... hunting; protected; 1 0.0 NaN australia; madagascar 2 lorenz von liburnaus woolly lemur, western ava...
1191527 Mantellidae Terrestrial; Freshwater \r\r\r\r\r\n The main threat to this specie... ['\n It occurs in Parque Nacional de Isalo.... Decreasing Endangered Mantella expectata Animalia Chordata Amphibia ... Several thousand blue-legged mantellas are tho... Listing on Appendix II of the Convention on In... loss; 1 3.0 NaN china; vietnam; taiwan; madagascar 4 tular golden frog, tular mantella, bluelegged ...
4646125 Nesomyidae Terrestrial \r\r\r\r\r\n The historical decline of this... ['\n The new Menabe-Antimena protected area... Decreasing Endangered Hypogeomys antimena Animalia Chordata Mammalia ... Like many of Madagascarâ??s unique species ... This large rodent is in urgent need of conserv... loss;pet; captive breeding;protected; 2 5000.0 NaN canada; madagascar 2 malagasy giant rat, malagasy giant jumping rat

5 rows × 23 columns


In [15]:
df.to_csv('final_table.csv')

In [30]:
cols = df.columns
i = 1
for index, row in df.head(4).iterrows():
    print("Tuple",i)
    for col in cols:
        s = row[col]
        if type(s) is str:
            s = s.replace('\n', ' ').replace('\r', '')
        print("-" + col + ": " + str(s))
    i += 1
    print()


Tuple 1
-family: Veronicellidae
-ecology: nan
-redlist_threat_paragraph: nan
-redlist_conservation_paragraph: nan
-pop_trend: Unknown
-status: Endangered
-scientific_name: Laevicaulis haroldi
-kingdom: Animalia
-phylum: Mollusca
-class: Gastropoda
-order: Stylommatophora
-genus: Laevicaulis 
-size: Extended length: up to 90 mm (2)
-threats: The caterpillar slug is threatened by habitat loss and degradation as a result of ongoing urbanisation and development within its range. The original site of collection in a marsh near Durban has since been destroyed to make way for a road. These threats are exacerbated by the slugâ??s already restricted range which makes it especially vulnerable to the effects of its changing environment (2).
-arkive_conservation_paragraph: Although there are currently no conservation measures directly targeting the caterpillar slug individuals have been observed in Hluhluwe Game Reserve where its habitat may receive some protection. Furthermore its appearance in suburban gardens in the Pietermaritzburg area suggests that this slug may be adaptable to a certain degree of habitat modification flexibility that would undoubtedly help its prospects of survival (2). 
-threat_keywords: loss;environment; 
-conservation_keywords:  
-threat_count: 2
-weight: nan
-length: 0.09
-countries: russia; south africa; indonesia; malaysia; china; india
-country_count: 6
-names: caterpillar slug

Tuple 2
-family: Rosaceae
-ecology: nan
-redlist_threat_paragraph: nan
-redlist_conservation_paragraph: nan
-pop_trend: nan
-status: Critically Endangered
-scientific_name: Cercocarpus traskiae
-kingdom: Plantae
-phylum: Tracheophyta
-class: Magnoliopsida
-order: Rosales
-genus: Cercocarpus 
-size: Height: 3 - 7 m (2)Trunk diameter: c. 20 cm (2)
-threats: Historically a major threat to the Catalina mahogany was the introduction of <strong>herbivores</strong> such as goats deer and pigs to Santa Catalina Island. Goats and deer ate the seedling shoots and the leaves of the tree while pigs rooting through the ground destroyed seedlings and the roots (6).
-arkive_conservation_paragraph: Conservation efforts began in the 1970s with a detailed inventory of the remaining Catalina mahogany plants (8). In 1999 the entire Wild Boar Gully area was fenced off enclosing 45 hectares (4). This action was successful and resulted in the numbers of seedlings and saplings increasing year after year reaching a peak of 113 individuals in 2002. However it is not known what portion of these seedlings and saplings are the Catalina mahogany and which are <strong>hybrids</strong> (6). 
-threat_keywords: loss;invasive; 
-conservation_keywords:  
-threat_count: 2
-weight: nan
-length: nan
-countries: russia; morocco; ukraine; hungary; united states
-country_count: 5
-names: catalina mahogany

Tuple 3
-family: Indriidae
-ecology: Terrestrial
-redlist_threat_paragraph:      The major threat is forest destruction due to annual burning that creates new cattle pasture. There may be some localized hunting, but this is probably not a major threat.         
-redlist_conservation_paragraph: ['\n    This species is listed on Appendix I of CITES. ', <span lang="EN-CA">This species is known to occur in Ankarafantsika National Park, the Bora Special Reserve, and in the Mariarano Classified Forest. It may perhaps be the species found in the Ankarana Special Reserve, though this has yet to be confirmed. Further research on population numbers and distribution is required. Consideration should be given to improving the protected areas status of Mariarano Classified Forest, which is already very well protected by the local people.<span lang="EN-CA"> Field surveys and genetic studies of <em>Avahi </em>populations at Ankarana are also needed to determine the taxonomic and conservation status of woolly lemurs in that area.</span> </span>]
-pop_trend: Decreasing
-status: Endangered
-scientific_name: Avahi occidentalis
-kingdom: Animalia
-phylum: Chordata
-class: Mammalia
-order: Primates
-genus: Avahi 
-size: 700 â?? 900 g (2)
-threats: 15 species of lemur have become extinct since sea-faring humans arrived on Madagascarâ??s shores around 2000 years ago and humanity is still wreaking ecological destruction on the island (7). Habitat destruction through forest felling and burning poses the principle threat to the biodiversity on Madagascar including the western woolly lemur (2). Small-scale but widespread clearing of forests is conducted for firewood cattle grazing charcoal production and construction materials. In the dry season people often set brush fires to clear pasture for cattle but the fires frequently burn out of control and threaten protected areas (8). Hunting also occurs in some regions. These factors coupled with the speciesâ?? restricted range give cause for concern (2).
-arkive_conservation_paragraph: The western woolly lemur is confirmed in only two protected areas Ankarafantsika Nature Reserve and Manongarivo Special Reserve although this species has also been reported in Ankarana Special Reserve (2) (4). It has so far been impossible to keep western woolly monkeys in captivity probably because of their highly selective <strong>folivorous</strong> diet. It appears therefore that conservation of forests in situ where this species occurs is the best viable option of protecting the western woolly lemur (6). 
-threat_keywords: hunting; 
-conservation_keywords: protected; 
-threat_count: 1
-weight: 0.0
-length: nan
-countries: australia; madagascar
-country_count: 2
-names: lorenz von liburnaus woolly lemur, western avahi, western woolly lemur

Tuple 4
-family: Mantellidae
-ecology: Terrestrial; Freshwater
-redlist_threat_paragraph:      The main threat to this species is habitat loss due to grazing and fire, and in some localized regions due to mining for sapphires. It is actively sought after for the pet trade, and during the rainy season up to several thousand specimens can be collected. Such collecting might pose a major threat to the species, but this has not, as yet, been demonstrated.         
-redlist_conservation_paragraph: ['\n    It occurs in Parque Nacional de Isalo. Trade in this species needs to be very carefully regulated, and the populations require close monitoring (Andreone ', <span style="font-style: italic;">et al</span>, '. 2006). It is listed on CITES Appendix II.\n\n    \n  ']
-pop_trend: Decreasing
-status: Endangered
-scientific_name: Mantella expectata
-kingdom: Animalia
-phylum: Chordata
-class: Amphibia
-order: Anura
-genus: Mantella 
-size: 1 â?? 3 g (3)
-threats: Several thousand blue-legged mantellas are thought to be collected every year from some regions in the Isalo Massif(3). Aside from over-collection the extremely small range of these critically endangered frogs is threatened with habitat loss as a result of grazing fires and sapphire mining operations (1).
-arkive_conservation_paragraph: Listing on Appendix II of the Convention on International Trade in Endangered Species provides the blue-legged mantella with some protection. It requires that an export licence is obtained for any trade in this species. A trade quota to prevent over-exploitation of this frog is crucial to its survival as even the protection offered by the Isalo National Park has not prevented the capture of the blue-legged mantella (1). Anyhow recent research showed that the species is still locally abundant (5). 
-threat_keywords: loss; 
-conservation_keywords:  
-threat_count: 1
-weight: 3.0
-length: nan
-countries: china; vietnam; taiwan; madagascar
-country_count: 4
-names: tular golden frog, tular mantella, bluelegged mantella, tulear golden frog


In [ ]: