Updated EDA
#1
by
egrace479 - opened
- .gitattributes +1 -0
- README.md +9 -0
- data/missing_taxa_output.txt +44 -0
- data/statistics.csv +3 -0
- data/stats_avg_std_byClass.csv +9 -0
- notebooks/ToL_EDA.ipynb +1739 -319
- notebooks/ToL_stats_EDA.ipynb +0 -0
- notebooks/ToL_stats_EDA.py +534 -0
.gitattributes
CHANGED
|
@@ -55,3 +55,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
data/v1-dev-names.csv filter=lfs diff=lfs merge=lfs -text
|
| 57 |
notebooks/BioCLIP_taxa_viz_bySource.ipynb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
data/v1-dev-names.csv filter=lfs diff=lfs merge=lfs -text
|
| 57 |
notebooks/BioCLIP_taxa_viz_bySource.ipynb filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
statistics.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -10,6 +10,11 @@ This repo contains the analysis of the TreeOfLife10M dataset as it's being craft
|
|
| 10 |
### Data
|
| 11 |
|
| 12 |
The `data` folder contains
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
- `v1-dev-names.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the
|
| 14 |
associated taxa information for the image.
|
| 15 |
- `taxa_counts.csv`: count of distinct lower taxa within each higher taxon from `kingdom` down to
|
|
@@ -19,9 +24,13 @@ images, and images that have labels. Note that kingdoms have not been merged and
|
|
| 19 |
been performed on the taxonomic hierarchy prior to creation of this file.
|
| 20 |
- `tol_hierarchy_test.csv`: Subset of `v1-dev-names.csv` for testing the [`check_taxa` script](https://github.com/Imageomics/open_clip/tree/main/scripts/evobio10m) to ensure the hierarchy is properly filled in after data generation.
|
| 21 |
|
|
|
|
| 22 |
### Notebooks
|
| 23 |
|
| 24 |
The `notebooks` folder contains
|
|
|
|
|
|
|
|
|
|
| 25 |
- `BioCLIP_data_viz.ipynb`: notebook with quick basic stats for `v1-dev-names.csv`, generates
|
| 26 |
`taxa_counts.csv`.
|
| 27 |
- `BioCLIP_taxa_viz_bySource.ipynb`: generates data visualizations, in particular, the generation of
|
|
|
|
| 10 |
### Data
|
| 11 |
|
| 12 |
The `data` folder contains
|
| 13 |
+
- `statistics.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the
|
| 14 |
+
associated taxa information for the image. This is the file that will be updated, while preserving the `v1-dev-names.csv` file for ease of comparison.
|
| 15 |
+
- `stats_avg_std_byClass.csv`: average and standard distribution of images given by class in `statistics.csv`. This is for both all
|
| 16 |
+
images, and images that have labels.
|
| 17 |
+
|
| 18 |
- `v1-dev-names.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the
|
| 19 |
associated taxa information for the image.
|
| 20 |
- `taxa_counts.csv`: count of distinct lower taxa within each higher taxon from `kingdom` down to
|
|
|
|
| 24 |
been performed on the taxonomic hierarchy prior to creation of this file.
|
| 25 |
- `tol_hierarchy_test.csv`: Subset of `v1-dev-names.csv` for testing the [`check_taxa` script](https://github.com/Imageomics/open_clip/tree/main/scripts/evobio10m) to ensure the hierarchy is properly filled in after data generation.
|
| 26 |
|
| 27 |
+
|
| 28 |
### Notebooks
|
| 29 |
|
| 30 |
The `notebooks` folder contains
|
| 31 |
+
- `ToL_stats_EDA.ipynb`: more full EDA of TreeOfLife10M dataset using `statistics.csv`.
|
| 32 |
+
- `ToL_stats_EDA.py`: py file paired to `ToL_stats_EDA.ipynb` to facilitate diff checking in case of cell text changes in notebook.
|
| 33 |
+
|
| 34 |
- `BioCLIP_data_viz.ipynb`: notebook with quick basic stats for `v1-dev-names.csv`, generates
|
| 35 |
`taxa_counts.csv`.
|
| 36 |
- `BioCLIP_taxa_viz_bySource.ipynb`: generates data visualizations, in particular, the generation of
|
data/missing_taxa_output.txt
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Output of Data Check for First Full Version of BioCLIP training data (initial submission):
|
| 2 |
+
|
| 3 |
+
[2023-10-25 10:20:12,498] [WARNING] [root] There are 5 kingdoms instead of 3.
|
| 4 |
+
[2023-10-25 10:20:13,673] [WARNING] [root] 1300744 entries are missing rank kingdom, but have genus label.
|
| 5 |
+
[2023-10-25 10:20:13,918] [WARNING] [root] 1302578 entries are missing rank phylum, but have genus label.
|
| 6 |
+
[2023-10-25 10:20:14,168] [WARNING] [root] 2368981 entries are missing rank class, but have genus label.
|
| 7 |
+
[2023-10-25 10:20:14,402] [WARNING] [root] 1344781 entries are missing rank order, but have genus label.
|
| 8 |
+
[2023-10-25 10:20:14,637] [WARNING] [root] 1310177 entries are missing rank family, but have genus label.
|
| 9 |
+
[2023-10-25 10:20:15,065] [WARNING] [root] 24 entries are missing rank phylum, but have family label.
|
| 10 |
+
[2023-10-25 10:20:15,094] [WARNING] [root] 8759 entries are missing rank class, but have family label.
|
| 11 |
+
[2023-10-25 10:20:15,123] [WARNING] [root] 111 entries are missing rank order, but have family label.
|
| 12 |
+
[2023-10-25 10:20:15,233] [WARNING] [root] 67 entries are missing rank class, but have order label.
|
| 13 |
+
[2023-10-25 10:20:15,254] [WARNING] [root] 253 entries have kingdom and species labels but no genus.
|
| 14 |
+
[2023-10-25 10:20:15,254] [WARNING] [root] 253 entries have phylum and species labels but no genus.
|
| 15 |
+
[2023-10-25 10:20:15,255] [WARNING] [root] 173 entries have class and species labels but no genus.
|
| 16 |
+
[2023-10-25 10:20:15,255] [WARNING] [root] 253 entries have order and species labels but no genus.
|
| 17 |
+
[2023-10-25 10:20:15,255] [WARNING] [root] 253 entries have family and species labels but no genus.
|
| 18 |
+
[2023-10-25 10:20:16,644] [WARNING] [root] There are 755133 samples for which the species column may have genus and species.
|
| 19 |
+
[2023-10-25 10:20:17,199] [WARNING] [root] 2470 species are labeled as '(unidentified)'.
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
Output of Data Check for next iteration where taxon matching was performed (statistics.csv):
|
| 23 |
+
|
| 24 |
+
[2023-10-25 10:25:28,242] [WARNING] [root] There are 7 kingdoms instead of 3.
|
| 25 |
+
[2023-10-25 10:25:29,234] [WARNING] [root] 14795 entries are missing rank kingdom, but have genus label.
|
| 26 |
+
[2023-10-25 10:25:29,477] [WARNING] [root] 5824 entries are missing rank phylum, but have genus label.
|
| 27 |
+
[2023-10-25 10:25:29,719] [WARNING] [root] 15763 entries are missing rank class, but have genus label.
|
| 28 |
+
[2023-10-25 10:25:29,958] [WARNING] [root] 10550 entries are missing rank order, but have genus label.
|
| 29 |
+
[2023-10-25 10:25:30,203] [WARNING] [root] 7539 entries are missing rank family, but have genus label.
|
| 30 |
+
[2023-10-25 10:25:30,470] [WARNING] [root] 296 entries are missing rank kingdom, but have family label.
|
| 31 |
+
[2023-10-25 10:25:30,495] [WARNING] [root] 272 entries are missing rank phylum, but have family label.
|
| 32 |
+
[2023-10-25 10:25:30,520] [WARNING] [root] 753 entries are missing rank class, but have family label.
|
| 33 |
+
[2023-10-25 10:25:30,545] [WARNING] [root] 395 entries are missing rank order, but have family label.
|
| 34 |
+
[2023-10-25 10:25:30,590] [WARNING] [root] 156 entries are missing rank kingdom, but have order label.
|
| 35 |
+
[2023-10-25 10:25:30,591] [WARNING] [root] 100 entries are missing rank phylum, but have order label.
|
| 36 |
+
[2023-10-25 10:25:30,592] [WARNING] [root] 1187 entries are missing rank class, but have order label.
|
| 37 |
+
[2023-10-25 10:25:30,637] [WARNING] [root] 74 entries have kingdom and species labels but no genus.
|
| 38 |
+
[2023-10-25 10:25:30,644] [WARNING] [root] 74 entries have phylum and species labels but no genus.
|
| 39 |
+
[2023-10-25 10:25:30,650] [WARNING] [root] 74 entries have class and species labels but no genus.
|
| 40 |
+
[2023-10-25 10:25:30,656] [WARNING] [root] 74 entries have order and species labels but no genus.
|
| 41 |
+
[2023-10-25 10:25:30,662] [WARNING] [root] 74 entries have family and species labels but no genus.
|
| 42 |
+
[2023-10-25 10:25:31,992] [WARNING] [root] There are 158279 samples for which the species column may have genus and species.
|
| 43 |
+
Added check for nulls in common column (wasn't an issue in the first iteration):
|
| 44 |
+
[2023-10-25 11:39:11,384] [WARNING] [root] 915509 entries have null common. They are from ['EOL' 'BIOSCAN'].
|
data/statistics.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:995cfb557048441d0426da39c0eece02493208ed92bb615d6a50d683dca9616b
|
| 3 |
+
size 1646503457
|
data/stats_avg_std_byClass.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class,average_all_imgs,standard_deviation,avg_labeled,std_dev_labeled
|
| 2 |
+
kingdom,1490931.5714285714,1221.0370884737988,1313721.0,1146.1766879499862
|
| 3 |
+
phylum,115961.34444444445,340.53097428052627,102281.77777777778,319.8152244308857
|
| 4 |
+
class,37008.93971631206,192.3770768992815,32562.521276595744,180.45088328017613
|
| 5 |
+
order,7858.826054216867,88.65002004634216,6912.875753012048,83.14370543229384
|
| 6 |
+
family,1344.5659623808297,36.66832369199374,1178.8904921412006,34.33497476540795
|
| 7 |
+
genus,146.0490770931583,12.085076627525302,116.09587315803468,10.77477949463629
|
| 8 |
+
species,62.11105754924716,7.881056880218995,49.31926441706838,7.0227675753272925
|
| 9 |
+
common,23.720875419344868,4.8704081368346195,19.653807515023683,4.4332614986061545
|
notebooks/ToL_EDA.ipynb
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"name": "stderr",
|
| 23 |
"output_type": "stream",
|
| 24 |
"text": [
|
| 25 |
-
"/
|
| 26 |
" df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
|
| 27 |
]
|
| 28 |
}
|
|
@@ -176,22 +176,22 @@
|
|
| 176 |
"</div>"
|
| 177 |
],
|
| 178 |
"text/plain": [
|
| 179 |
-
" treeoflife_id eol_content_id eol_page_id
|
| 180 |
-
"0 0824741f-cc1c-4881-b292-15fd3f7964cd 29538374.0 65414274.0
|
| 181 |
"1 5ca08f6b-9396-4cb9-9283-8dee158aac18 27793900.0 888015.0 \n",
|
| 182 |
"2 f8c0f271-d8e5-4299-92d3-920508f74bf0 29121641.0 5618956.0 \n",
|
| 183 |
"3 1f53e9d1-527f-42fd-b813-9f62fa2c2372 27596176.0 607817.0 \n",
|
| 184 |
"4 a05bc2a8-5453-4683-903e-ed44f0fe7245 20300703.0 267922.0 \n",
|
| 185 |
"\n",
|
| 186 |
-
" bioscan_part bioscan_filename inat21_filename inat21_cls_name
|
| 187 |
-
"0 NaN NaN NaN NaN
|
| 188 |
"1 NaN NaN NaN NaN \n",
|
| 189 |
"2 NaN NaN NaN NaN \n",
|
| 190 |
"3 NaN NaN NaN NaN \n",
|
| 191 |
"4 NaN NaN NaN NaN \n",
|
| 192 |
"\n",
|
| 193 |
-
" inat21_cls_num kingdom phylum class order
|
| 194 |
-
"0 NaN NaN NaN NaN NaN
|
| 195 |
"1 NaN Metazoa Arthropoda Pancrustacea Lepidoptera \n",
|
| 196 |
"2 NaN Archaeplastida Tracheophyta NaN Sapindales \n",
|
| 197 |
"3 NaN Metazoa Arthropoda Pancrustacea Trichoptera \n",
|
|
@@ -345,9 +345,328 @@
|
|
| 345 |
"`Metazoa` and `Animalia` overlap, as do `Archaeplastida` and `Plantae`. They are sometimes used interchangably, though the former of each is a newer (more refined?) designation. Later we'll see this distinction cuts is by our data sources."
|
| 346 |
]
|
| 347 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
{
|
| 349 |
"cell_type": "code",
|
| 350 |
-
"execution_count":
|
| 351 |
"metadata": {},
|
| 352 |
"outputs": [
|
| 353 |
{
|
|
@@ -356,7 +675,7 @@
|
|
| 356 |
"['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
|
| 357 |
]
|
| 358 |
},
|
| 359 |
-
"execution_count":
|
| 360 |
"metadata": {},
|
| 361 |
"output_type": "execute_result"
|
| 362 |
}
|
|
@@ -551,7 +870,7 @@
|
|
| 551 |
},
|
| 552 |
{
|
| 553 |
"cell_type": "code",
|
| 554 |
-
"execution_count":
|
| 555 |
"metadata": {},
|
| 556 |
"outputs": [],
|
| 557 |
"source": [
|
|
@@ -637,7 +956,7 @@
|
|
| 637 |
},
|
| 638 |
{
|
| 639 |
"cell_type": "code",
|
| 640 |
-
"execution_count":
|
| 641 |
"metadata": {},
|
| 642 |
"outputs": [],
|
| 643 |
"source": [
|
|
@@ -782,7 +1101,7 @@
|
|
| 782 |
},
|
| 783 |
{
|
| 784 |
"cell_type": "code",
|
| 785 |
-
"execution_count":
|
| 786 |
"metadata": {},
|
| 787 |
"outputs": [],
|
| 788 |
"source": [
|
|
@@ -1778,211 +2097,1249 @@
|
|
| 1778 |
"cell_type": "markdown",
|
| 1779 |
"metadata": {},
|
| 1780 |
"source": [
|
| 1781 |
-
"
|
| 1782 |
]
|
| 1783 |
},
|
| 1784 |
{
|
| 1785 |
"cell_type": "code",
|
| 1786 |
-
"execution_count":
|
| 1787 |
"metadata": {},
|
| 1788 |
-
"outputs": [
|
| 1789 |
-
{
|
| 1790 |
-
"name": "stdout",
|
| 1791 |
-
"output_type": "stream",
|
| 1792 |
-
"text": [
|
| 1793 |
-
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1794 |
-
"Index: 6621365 entries, 0 to 10436520\n",
|
| 1795 |
-
"Data columns (total 9 columns):\n",
|
| 1796 |
-
" # Column Non-Null Count Dtype \n",
|
| 1797 |
-
"--- ------ -------------- ----- \n",
|
| 1798 |
-
" 0 data_source 6621365 non-null object\n",
|
| 1799 |
-
" 1 kingdom 3919403 non-null object\n",
|
| 1800 |
-
" 2 phylum 3917533 non-null object\n",
|
| 1801 |
-
" 3 class 2842328 non-null object\n",
|
| 1802 |
-
" 4 order 3875193 non-null object\n",
|
| 1803 |
-
" 5 family 3906994 non-null object\n",
|
| 1804 |
-
" 6 genus 5119837 non-null object\n",
|
| 1805 |
-
" 7 species 4408570 non-null object\n",
|
| 1806 |
-
" 8 common 6621365 non-null object\n",
|
| 1807 |
-
"dtypes: object(9)\n",
|
| 1808 |
-
"memory usage: 505.2+ MB\n"
|
| 1809 |
-
]
|
| 1810 |
-
}
|
| 1811 |
-
],
|
| 1812 |
"source": [
|
| 1813 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1814 |
]
|
| 1815 |
},
|
| 1816 |
{
|
| 1817 |
"cell_type": "code",
|
| 1818 |
-
"execution_count":
|
| 1819 |
"metadata": {},
|
| 1820 |
"outputs": [
|
| 1821 |
{
|
| 1822 |
-
"
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
|
| 1826 |
-
|
| 1827 |
-
|
| 1828 |
-
|
| 1829 |
-
|
| 1830 |
-
|
| 1831 |
-
|
| 1832 |
-
|
| 1833 |
-
|
| 1834 |
-
|
| 1835 |
-
|
| 1836 |
-
"
|
| 1837 |
-
|
| 1838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1839 |
}
|
| 1840 |
],
|
| 1841 |
"source": [
|
| 1842 |
-
"
|
|
|
|
| 1843 |
]
|
| 1844 |
},
|
| 1845 |
{
|
| 1846 |
"cell_type": "code",
|
| 1847 |
-
"execution_count":
|
| 1848 |
"metadata": {},
|
| 1849 |
"outputs": [
|
| 1850 |
{
|
| 1851 |
-
"
|
| 1852 |
-
|
| 1853 |
-
|
| 1854 |
-
|
| 1855 |
-
|
| 1856 |
-
|
| 1857 |
-
|
| 1858 |
-
|
| 1859 |
-
|
| 1860 |
-
|
| 1861 |
-
|
| 1862 |
-
|
| 1863 |
-
|
| 1864 |
-
|
| 1865 |
-
|
| 1866 |
-
|
| 1867 |
-
|
| 1868 |
-
|
|
|
|
|
|
|
|
|
|
| 1869 |
}
|
| 1870 |
],
|
| 1871 |
"source": [
|
| 1872 |
-
"
|
|
|
|
| 1873 |
]
|
| 1874 |
},
|
| 1875 |
{
|
| 1876 |
"cell_type": "markdown",
|
| 1877 |
"metadata": {},
|
| 1878 |
"source": [
|
| 1879 |
-
"
|
| 1880 |
-
"\n",
|
| 1881 |
-
"Unique species + unique common where species is null does not reach this number."
|
| 1882 |
]
|
| 1883 |
},
|
| 1884 |
{
|
| 1885 |
"cell_type": "code",
|
| 1886 |
-
"execution_count":
|
| 1887 |
"metadata": {},
|
| 1888 |
"outputs": [
|
| 1889 |
{
|
| 1890 |
"data": {
|
| 1891 |
"text/plain": [
|
| 1892 |
-
"
|
| 1893 |
-
"
|
| 1894 |
-
"
|
| 1895 |
-
"
|
|
|
|
| 1896 |
"Name: count, dtype: int64"
|
| 1897 |
]
|
| 1898 |
},
|
| 1899 |
-
"execution_count":
|
| 1900 |
"metadata": {},
|
| 1901 |
"output_type": "execute_result"
|
| 1902 |
}
|
| 1903 |
],
|
| 1904 |
"source": [
|
| 1905 |
-
"
|
| 1906 |
]
|
| 1907 |
},
|
| 1908 |
{
|
| 1909 |
"cell_type": "markdown",
|
| 1910 |
"metadata": {},
|
| 1911 |
"source": [
|
| 1912 |
-
"
|
| 1913 |
-
"\n",
|
| 1914 |
-
"We have already observed that not all ranks are filled in at the higher levels, sometimes having just one gap. It seems this is particularly common for `class` (it has the least non-null values of any taxa by far)."
|
| 1915 |
]
|
| 1916 |
},
|
| 1917 |
{
|
| 1918 |
"cell_type": "code",
|
| 1919 |
-
"execution_count":
|
| 1920 |
"metadata": {},
|
| 1921 |
"outputs": [
|
| 1922 |
{
|
| 1923 |
-
"
|
| 1924 |
-
|
| 1925 |
-
|
| 1926 |
-
|
| 1927 |
-
|
| 1928 |
-
|
| 1929 |
-
|
| 1930 |
-
|
| 1931 |
-
|
| 1932 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1933 |
}
|
| 1934 |
],
|
| 1935 |
"source": [
|
| 1936 |
-
"
|
| 1937 |
-
"eol_df['duplicate'] = eol_df.duplicated(subset = taxa, keep = 'first')\n",
|
| 1938 |
-
"eol_df_unique_taxa = eol_df.loc[~eol_df['duplicate']]"
|
| 1939 |
]
|
| 1940 |
},
|
| 1941 |
{
|
| 1942 |
"cell_type": "code",
|
| 1943 |
-
"execution_count":
|
| 1944 |
"metadata": {},
|
| 1945 |
"outputs": [
|
| 1946 |
{
|
| 1947 |
-
"
|
| 1948 |
-
|
| 1949 |
-
|
| 1950 |
-
|
| 1951 |
-
|
| 1952 |
-
|
| 1953 |
-
|
| 1954 |
-
|
| 1955 |
-
|
| 1956 |
-
|
| 1957 |
-
|
| 1958 |
-
|
| 1959 |
-
|
| 1960 |
-
|
| 1961 |
-
|
| 1962 |
-
|
| 1963 |
-
|
| 1964 |
-
|
| 1965 |
-
|
| 1966 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1967 |
]
|
| 1968 |
}
|
| 1969 |
],
|
| 1970 |
"source": [
|
| 1971 |
-
"
|
| 1972 |
-
|
| 1973 |
-
},
|
| 1974 |
-
{
|
| 1975 |
-
"cell_type": "markdown",
|
| 1976 |
-
"metadata": {},
|
| 1977 |
-
"source": [
|
| 1978 |
-
"The actual number of distinct creatures is likely higher, as evidenced below where we have unique common names listed in `common` but all taxa are null.\n",
|
| 1979 |
-
"\n",
|
| 1980 |
-
"We should be able to fill all in for all values of `species` that also have `genus` indicated. Is `genus` labeled for all entries with `species` labeled? "
|
| 1981 |
]
|
| 1982 |
},
|
| 1983 |
{
|
| 1984 |
"cell_type": "code",
|
| 1985 |
-
"execution_count":
|
| 1986 |
"metadata": {},
|
| 1987 |
"outputs": [
|
| 1988 |
{
|
|
@@ -1990,46 +3347,84 @@
|
|
| 1990 |
"output_type": "stream",
|
| 1991 |
"text": [
|
| 1992 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1993 |
-
"Index:
|
| 1994 |
"Data columns (total 10 columns):\n",
|
| 1995 |
-
" # Column Non-Null Count
|
| 1996 |
-
"--- ------ --------------
|
| 1997 |
-
" 0 data_source
|
| 1998 |
-
" 1 kingdom
|
| 1999 |
-
" 2 phylum
|
| 2000 |
-
" 3 class
|
| 2001 |
-
" 4 order
|
| 2002 |
-
" 5 family
|
| 2003 |
-
" 6 genus
|
| 2004 |
-
" 7 species
|
| 2005 |
-
" 8 common
|
| 2006 |
-
" 9
|
| 2007 |
-
"dtypes:
|
| 2008 |
-
"memory usage:
|
| 2009 |
]
|
| 2010 |
}
|
| 2011 |
],
|
| 2012 |
"source": [
|
| 2013 |
-
"
|
|
|
|
| 2014 |
]
|
| 2015 |
},
|
| 2016 |
{
|
| 2017 |
-
"cell_type": "
|
|
|
|
| 2018 |
"metadata": {},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2019 |
"source": [
|
| 2020 |
-
"
|
| 2021 |
]
|
| 2022 |
},
|
| 2023 |
{
|
| 2024 |
"cell_type": "markdown",
|
| 2025 |
"metadata": {},
|
| 2026 |
"source": [
|
| 2027 |
-
"
|
| 2028 |
]
|
| 2029 |
},
|
| 2030 |
{
|
| 2031 |
"cell_type": "code",
|
| 2032 |
-
"execution_count":
|
| 2033 |
"metadata": {},
|
| 2034 |
"outputs": [
|
| 2035 |
{
|
|
@@ -2062,154 +3457,176 @@
|
|
| 2062 |
" <th>genus</th>\n",
|
| 2063 |
" <th>species</th>\n",
|
| 2064 |
" <th>common</th>\n",
|
| 2065 |
-
" <th>
|
| 2066 |
" </tr>\n",
|
| 2067 |
" </thead>\n",
|
| 2068 |
" <tbody>\n",
|
| 2069 |
" <tr>\n",
|
| 2070 |
-
" <th>
|
| 2071 |
" <td>EOL</td>\n",
|
| 2072 |
-
" <td>Archaeplastida</td>\n",
|
| 2073 |
-
" <td>Tracheophyta</td>\n",
|
| 2074 |
" <td>NaN</td>\n",
|
| 2075 |
-
" <td>
|
| 2076 |
-
" <td>
|
| 2077 |
-
" <td>
|
| 2078 |
-
" <td>
|
| 2079 |
-
" <td>
|
| 2080 |
-
" <td>
|
|
|
|
|
|
|
| 2081 |
" </tr>\n",
|
| 2082 |
" <tr>\n",
|
| 2083 |
-
" <th>
|
| 2084 |
" <td>EOL</td>\n",
|
| 2085 |
-
" <td>
|
| 2086 |
-
" <td>
|
| 2087 |
-
" <td>
|
| 2088 |
-
" <td>
|
| 2089 |
-
" <td>
|
| 2090 |
-
" <td>
|
| 2091 |
-
" <td>
|
| 2092 |
-
" <td>
|
| 2093 |
-
" <td>
|
| 2094 |
" </tr>\n",
|
| 2095 |
" <tr>\n",
|
| 2096 |
-
" <th>
|
| 2097 |
" <td>EOL</td>\n",
|
| 2098 |
-
" <td>Archaeplastida</td>\n",
|
| 2099 |
-
" <td>Tracheophyta</td>\n",
|
| 2100 |
" <td>NaN</td>\n",
|
| 2101 |
-
" <td>
|
| 2102 |
-
" <td>
|
| 2103 |
-
" <td>
|
| 2104 |
-
" <td>
|
| 2105 |
-
" <td>
|
| 2106 |
-
" <td>
|
|
|
|
|
|
|
| 2107 |
" </tr>\n",
|
| 2108 |
" <tr>\n",
|
| 2109 |
-
" <th>
|
| 2110 |
" <td>EOL</td>\n",
|
| 2111 |
" <td>NaN</td>\n",
|
| 2112 |
" <td>NaN</td>\n",
|
| 2113 |
" <td>NaN</td>\n",
|
| 2114 |
" <td>NaN</td>\n",
|
| 2115 |
" <td>NaN</td>\n",
|
| 2116 |
-
" <td>
|
| 2117 |
-
" <td>
|
| 2118 |
-
" <td>
|
| 2119 |
-
" <td>
|
| 2120 |
" </tr>\n",
|
| 2121 |
" <tr>\n",
|
| 2122 |
-
" <th>
|
| 2123 |
" <td>EOL</td>\n",
|
| 2124 |
" <td>NaN</td>\n",
|
| 2125 |
" <td>NaN</td>\n",
|
| 2126 |
" <td>NaN</td>\n",
|
| 2127 |
" <td>NaN</td>\n",
|
| 2128 |
" <td>NaN</td>\n",
|
| 2129 |
-
" <td>
|
| 2130 |
-
" <td>
|
| 2131 |
-
" <td>
|
| 2132 |
-
" <td>
|
| 2133 |
" </tr>\n",
|
| 2134 |
" <tr>\n",
|
| 2135 |
-
" <th>
|
| 2136 |
" <td>EOL</td>\n",
|
| 2137 |
-
" <td>
|
| 2138 |
-
" <td>
|
| 2139 |
-
" <td>
|
| 2140 |
-
" <td>
|
| 2141 |
-
" <td>
|
| 2142 |
-
" <td>
|
| 2143 |
-
" <td>
|
| 2144 |
-
" <td>
|
| 2145 |
-
" <td>
|
| 2146 |
" </tr>\n",
|
| 2147 |
" <tr>\n",
|
| 2148 |
-
" <th>
|
| 2149 |
" <td>EOL</td>\n",
|
| 2150 |
-
" <td>
|
| 2151 |
-
" <td>
|
| 2152 |
-
" <td>
|
| 2153 |
-
" <td>
|
| 2154 |
-
" <td>
|
| 2155 |
-
" <td>
|
| 2156 |
-
" <td>
|
| 2157 |
-
" <td>
|
| 2158 |
-
" <td>
|
| 2159 |
" </tr>\n",
|
| 2160 |
" </tbody>\n",
|
| 2161 |
"</table>\n",
|
| 2162 |
"</div>"
|
| 2163 |
],
|
| 2164 |
"text/plain": [
|
| 2165 |
-
" data_source
|
| 2166 |
-
"
|
| 2167 |
-
"
|
| 2168 |
-
"
|
| 2169 |
-
"
|
| 2170 |
-
"
|
| 2171 |
-
"
|
| 2172 |
-
"
|
| 2173 |
"\n",
|
| 2174 |
-
"
|
| 2175 |
-
"
|
| 2176 |
-
"
|
| 2177 |
-
"
|
| 2178 |
-
"
|
| 2179 |
-
"
|
| 2180 |
-
"
|
| 2181 |
-
"
|
| 2182 |
"\n",
|
| 2183 |
-
"
|
| 2184 |
-
"
|
| 2185 |
-
"
|
| 2186 |
-
"
|
| 2187 |
-
"
|
| 2188 |
-
"
|
| 2189 |
-
"
|
| 2190 |
-
"
|
| 2191 |
]
|
| 2192 |
},
|
| 2193 |
-
"execution_count":
|
| 2194 |
"metadata": {},
|
| 2195 |
"output_type": "execute_result"
|
| 2196 |
}
|
| 2197 |
],
|
| 2198 |
"source": [
|
| 2199 |
-
"
|
| 2200 |
-
"eol_df.loc[eol_df.species.notna()].sample(7)"
|
| 2201 |
]
|
| 2202 |
},
|
| 2203 |
{
|
| 2204 |
-
"cell_type": "
|
|
|
|
| 2205 |
"metadata": {},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2206 |
"source": [
|
| 2207 |
-
"
|
| 2208 |
]
|
| 2209 |
},
|
| 2210 |
{
|
| 2211 |
"cell_type": "code",
|
| 2212 |
-
"execution_count":
|
| 2213 |
"metadata": {},
|
| 2214 |
"outputs": [
|
| 2215 |
{
|
|
@@ -2242,144 +3659,148 @@
|
|
| 2242 |
" <th>genus</th>\n",
|
| 2243 |
" <th>species</th>\n",
|
| 2244 |
" <th>common</th>\n",
|
| 2245 |
-
" <th>
|
| 2246 |
" </tr>\n",
|
| 2247 |
" </thead>\n",
|
| 2248 |
" <tbody>\n",
|
| 2249 |
" <tr>\n",
|
| 2250 |
-
" <th>
|
| 2251 |
" <td>EOL</td>\n",
|
| 2252 |
" <td>NaN</td>\n",
|
| 2253 |
" <td>NaN</td>\n",
|
| 2254 |
" <td>NaN</td>\n",
|
| 2255 |
" <td>NaN</td>\n",
|
| 2256 |
" <td>NaN</td>\n",
|
| 2257 |
-
" <td>
|
| 2258 |
-
" <td>
|
| 2259 |
-
" <td>
|
| 2260 |
-
" <td>
|
| 2261 |
" </tr>\n",
|
| 2262 |
" <tr>\n",
|
| 2263 |
-
" <th>
|
| 2264 |
" <td>EOL</td>\n",
|
| 2265 |
" <td>NaN</td>\n",
|
| 2266 |
" <td>NaN</td>\n",
|
| 2267 |
" <td>NaN</td>\n",
|
| 2268 |
" <td>NaN</td>\n",
|
| 2269 |
" <td>NaN</td>\n",
|
| 2270 |
-
" <td>
|
| 2271 |
-
" <td>
|
| 2272 |
-
" <td>
|
| 2273 |
-
" <td>
|
| 2274 |
" </tr>\n",
|
| 2275 |
" <tr>\n",
|
| 2276 |
-
" <th>
|
| 2277 |
" <td>EOL</td>\n",
|
| 2278 |
" <td>NaN</td>\n",
|
| 2279 |
" <td>NaN</td>\n",
|
| 2280 |
" <td>NaN</td>\n",
|
| 2281 |
" <td>NaN</td>\n",
|
| 2282 |
" <td>NaN</td>\n",
|
| 2283 |
-
" <td>
|
| 2284 |
-
" <td>
|
| 2285 |
-
" <td>
|
| 2286 |
-
" <td>
|
| 2287 |
" </tr>\n",
|
| 2288 |
" <tr>\n",
|
| 2289 |
-
" <th>
|
| 2290 |
" <td>EOL</td>\n",
|
| 2291 |
" <td>NaN</td>\n",
|
| 2292 |
" <td>NaN</td>\n",
|
| 2293 |
" <td>NaN</td>\n",
|
| 2294 |
" <td>NaN</td>\n",
|
| 2295 |
" <td>NaN</td>\n",
|
| 2296 |
-
" <td>
|
| 2297 |
-
" <td>
|
| 2298 |
-
" <td>
|
| 2299 |
-
" <td>
|
| 2300 |
" </tr>\n",
|
| 2301 |
" <tr>\n",
|
| 2302 |
-
" <th>
|
| 2303 |
" <td>EOL</td>\n",
|
| 2304 |
" <td>NaN</td>\n",
|
| 2305 |
" <td>NaN</td>\n",
|
| 2306 |
" <td>NaN</td>\n",
|
| 2307 |
" <td>NaN</td>\n",
|
| 2308 |
" <td>NaN</td>\n",
|
| 2309 |
-
" <td>
|
| 2310 |
-
" <td>
|
| 2311 |
-
" <td>
|
| 2312 |
-
" <td>
|
| 2313 |
" </tr>\n",
|
| 2314 |
" <tr>\n",
|
| 2315 |
-
" <th>
|
| 2316 |
" <td>EOL</td>\n",
|
|
|
|
|
|
|
| 2317 |
" <td>NaN</td>\n",
|
| 2318 |
-
" <td>
|
| 2319 |
-
" <td>
|
| 2320 |
-
" <td>
|
| 2321 |
-
" <td>
|
| 2322 |
-
" <td>
|
| 2323 |
-
" <td>
|
| 2324 |
-
" <td>Rock ptarmigan</td>\n",
|
| 2325 |
-
" <td>True</td>\n",
|
| 2326 |
" </tr>\n",
|
| 2327 |
" <tr>\n",
|
| 2328 |
-
" <th>
|
| 2329 |
" <td>EOL</td>\n",
|
| 2330 |
-
" <td>
|
| 2331 |
-
" <td>
|
| 2332 |
-
" <td>
|
| 2333 |
-
" <td>
|
| 2334 |
-
" <td>
|
| 2335 |
-
" <td>
|
| 2336 |
-
" <td>
|
| 2337 |
-
" <td>
|
| 2338 |
-
" <td>
|
| 2339 |
" </tr>\n",
|
| 2340 |
" </tbody>\n",
|
| 2341 |
"</table>\n",
|
| 2342 |
"</div>"
|
| 2343 |
],
|
| 2344 |
"text/plain": [
|
| 2345 |
-
"
|
| 2346 |
-
"
|
| 2347 |
-
"
|
| 2348 |
-
"
|
| 2349 |
-
"
|
| 2350 |
-
"
|
| 2351 |
-
"
|
| 2352 |
-
"
|
| 2353 |
"\n",
|
| 2354 |
-
"
|
| 2355 |
-
"
|
| 2356 |
-
"
|
| 2357 |
-
"
|
| 2358 |
-
"
|
| 2359 |
-
"
|
| 2360 |
-
"
|
| 2361 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2362 |
]
|
| 2363 |
},
|
| 2364 |
-
"execution_count":
|
| 2365 |
"metadata": {},
|
| 2366 |
"output_type": "execute_result"
|
| 2367 |
}
|
| 2368 |
],
|
| 2369 |
"source": [
|
| 2370 |
-
"
|
| 2371 |
-
"eol_df.loc[eol_df.species.isna()].sample(7)"
|
| 2372 |
]
|
| 2373 |
},
|
| 2374 |
{
|
| 2375 |
"cell_type": "markdown",
|
| 2376 |
"metadata": {},
|
| 2377 |
"source": [
|
| 2378 |
-
"
|
| 2379 |
-
"\n",
|
| 2380 |
-
"Good example of strange inconsistency: the `American red raspberry` is `Rubus strigosus`, and a quick Google search easily provides the entire taxonomy.\n",
|
| 2381 |
-
"\n",
|
| 2382 |
-
"`Cremastobaeus` seems to be a genus of wasp."
|
| 2383 |
]
|
| 2384 |
},
|
| 2385 |
{
|
|
@@ -2690,7 +4111,7 @@
|
|
| 2690 |
],
|
| 2691 |
"metadata": {
|
| 2692 |
"kernelspec": {
|
| 2693 |
-
"display_name": "
|
| 2694 |
"language": "python",
|
| 2695 |
"name": "python3"
|
| 2696 |
},
|
|
@@ -2704,9 +4125,8 @@
|
|
| 2704 |
"name": "python",
|
| 2705 |
"nbconvert_exporter": "python",
|
| 2706 |
"pygments_lexer": "ipython3",
|
| 2707 |
-
"version": "3.
|
| 2708 |
-
}
|
| 2709 |
-
"orig_nbformat": 4
|
| 2710 |
},
|
| 2711 |
"nbformat": 4,
|
| 2712 |
"nbformat_minor": 2
|
|
|
|
| 22 |
"name": "stderr",
|
| 23 |
"output_type": "stream",
|
| 24 |
"text": [
|
| 25 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_88978/3694103411.py:1: DtypeWarning: Columns (4,5,6) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
| 26 |
" df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
|
| 27 |
]
|
| 28 |
}
|
|
|
|
| 176 |
"</div>"
|
| 177 |
],
|
| 178 |
"text/plain": [
|
| 179 |
+
" treeoflife_id eol_content_id eol_page_id \n",
|
| 180 |
+
"0 0824741f-cc1c-4881-b292-15fd3f7964cd 29538374.0 65414274.0 \\\n",
|
| 181 |
"1 5ca08f6b-9396-4cb9-9283-8dee158aac18 27793900.0 888015.0 \n",
|
| 182 |
"2 f8c0f271-d8e5-4299-92d3-920508f74bf0 29121641.0 5618956.0 \n",
|
| 183 |
"3 1f53e9d1-527f-42fd-b813-9f62fa2c2372 27596176.0 607817.0 \n",
|
| 184 |
"4 a05bc2a8-5453-4683-903e-ed44f0fe7245 20300703.0 267922.0 \n",
|
| 185 |
"\n",
|
| 186 |
+
" bioscan_part bioscan_filename inat21_filename inat21_cls_name \n",
|
| 187 |
+
"0 NaN NaN NaN NaN \\\n",
|
| 188 |
"1 NaN NaN NaN NaN \n",
|
| 189 |
"2 NaN NaN NaN NaN \n",
|
| 190 |
"3 NaN NaN NaN NaN \n",
|
| 191 |
"4 NaN NaN NaN NaN \n",
|
| 192 |
"\n",
|
| 193 |
+
" inat21_cls_num kingdom phylum class order \n",
|
| 194 |
+
"0 NaN NaN NaN NaN NaN \\\n",
|
| 195 |
"1 NaN Metazoa Arthropoda Pancrustacea Lepidoptera \n",
|
| 196 |
"2 NaN Archaeplastida Tracheophyta NaN Sapindales \n",
|
| 197 |
"3 NaN Metazoa Arthropoda Pancrustacea Trichoptera \n",
|
|
|
|
| 345 |
"`Metazoa` and `Animalia` overlap, as do `Archaeplastida` and `Plantae`. They are sometimes used interchangably, though the former of each is a newer (more refined?) designation. Later we'll see this distinction cuts is by our data sources."
|
| 346 |
]
|
| 347 |
},
|
| 348 |
+
{
|
| 349 |
+
"cell_type": "markdown",
|
| 350 |
+
"metadata": {},
|
| 351 |
+
"source": [
|
| 352 |
+
"One more oddity to note: we have about 84K images with genus labeled \"UNKNOWN\"."
|
| 353 |
+
]
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"cell_type": "code",
|
| 357 |
+
"execution_count": 3,
|
| 358 |
+
"metadata": {},
|
| 359 |
+
"outputs": [
|
| 360 |
+
{
|
| 361 |
+
"name": "stdout",
|
| 362 |
+
"output_type": "stream",
|
| 363 |
+
"text": [
|
| 364 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 365 |
+
"Index: 84025 entries, 30 to 10436423\n",
|
| 366 |
+
"Data columns (total 16 columns):\n",
|
| 367 |
+
" # Column Non-Null Count Dtype \n",
|
| 368 |
+
"--- ------ -------------- ----- \n",
|
| 369 |
+
" 0 treeoflife_id 84025 non-null object \n",
|
| 370 |
+
" 1 eol_content_id 84025 non-null float64\n",
|
| 371 |
+
" 2 eol_page_id 84025 non-null float64\n",
|
| 372 |
+
" 3 bioscan_part 0 non-null float64\n",
|
| 373 |
+
" 4 bioscan_filename 0 non-null object \n",
|
| 374 |
+
" 5 inat21_filename 0 non-null object \n",
|
| 375 |
+
" 6 inat21_cls_name 0 non-null object \n",
|
| 376 |
+
" 7 inat21_cls_num 0 non-null float64\n",
|
| 377 |
+
" 8 kingdom 0 non-null object \n",
|
| 378 |
+
" 9 phylum 0 non-null object \n",
|
| 379 |
+
" 10 class 0 non-null object \n",
|
| 380 |
+
" 11 order 0 non-null object \n",
|
| 381 |
+
" 12 family 0 non-null object \n",
|
| 382 |
+
" 13 genus 84025 non-null object \n",
|
| 383 |
+
" 14 species 7 non-null object \n",
|
| 384 |
+
" 15 common 84025 non-null object \n",
|
| 385 |
+
"dtypes: float64(4), object(12)\n",
|
| 386 |
+
"memory usage: 10.9+ MB\n"
|
| 387 |
+
]
|
| 388 |
+
}
|
| 389 |
+
],
|
| 390 |
+
"source": [
|
| 391 |
+
"df.loc[df.genus.str.lower() == \"unknown\"].info(show_counts = True)"
|
| 392 |
+
]
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"cell_type": "markdown",
|
| 396 |
+
"metadata": {},
|
| 397 |
+
"source": [
|
| 398 |
+
"Check in on the few non-null species values."
|
| 399 |
+
]
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"cell_type": "code",
|
| 403 |
+
"execution_count": 4,
|
| 404 |
+
"metadata": {
|
| 405 |
+
"scrolled": true
|
| 406 |
+
},
|
| 407 |
+
"outputs": [
|
| 408 |
+
{
|
| 409 |
+
"data": {
|
| 410 |
+
"text/html": [
|
| 411 |
+
"<div>\n",
|
| 412 |
+
"<style scoped>\n",
|
| 413 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 414 |
+
" vertical-align: middle;\n",
|
| 415 |
+
" }\n",
|
| 416 |
+
"\n",
|
| 417 |
+
" .dataframe tbody tr th {\n",
|
| 418 |
+
" vertical-align: top;\n",
|
| 419 |
+
" }\n",
|
| 420 |
+
"\n",
|
| 421 |
+
" .dataframe thead th {\n",
|
| 422 |
+
" text-align: right;\n",
|
| 423 |
+
" }\n",
|
| 424 |
+
"</style>\n",
|
| 425 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 426 |
+
" <thead>\n",
|
| 427 |
+
" <tr style=\"text-align: right;\">\n",
|
| 428 |
+
" <th></th>\n",
|
| 429 |
+
" <th>treeoflife_id</th>\n",
|
| 430 |
+
" <th>eol_content_id</th>\n",
|
| 431 |
+
" <th>eol_page_id</th>\n",
|
| 432 |
+
" <th>bioscan_part</th>\n",
|
| 433 |
+
" <th>bioscan_filename</th>\n",
|
| 434 |
+
" <th>inat21_filename</th>\n",
|
| 435 |
+
" <th>inat21_cls_name</th>\n",
|
| 436 |
+
" <th>inat21_cls_num</th>\n",
|
| 437 |
+
" <th>kingdom</th>\n",
|
| 438 |
+
" <th>phylum</th>\n",
|
| 439 |
+
" <th>class</th>\n",
|
| 440 |
+
" <th>order</th>\n",
|
| 441 |
+
" <th>family</th>\n",
|
| 442 |
+
" <th>genus</th>\n",
|
| 443 |
+
" <th>species</th>\n",
|
| 444 |
+
" <th>common</th>\n",
|
| 445 |
+
" </tr>\n",
|
| 446 |
+
" </thead>\n",
|
| 447 |
+
" <tbody>\n",
|
| 448 |
+
" <tr>\n",
|
| 449 |
+
" <th>302277</th>\n",
|
| 450 |
+
" <td>1295e061-064b-4616-a10f-4a546489eb1a</td>\n",
|
| 451 |
+
" <td>14046024.0</td>\n",
|
| 452 |
+
" <td>62660090.0</td>\n",
|
| 453 |
+
" <td>NaN</td>\n",
|
| 454 |
+
" <td>NaN</td>\n",
|
| 455 |
+
" <td>NaN</td>\n",
|
| 456 |
+
" <td>NaN</td>\n",
|
| 457 |
+
" <td>NaN</td>\n",
|
| 458 |
+
" <td>NaN</td>\n",
|
| 459 |
+
" <td>NaN</td>\n",
|
| 460 |
+
" <td>NaN</td>\n",
|
| 461 |
+
" <td>NaN</td>\n",
|
| 462 |
+
" <td>NaN</td>\n",
|
| 463 |
+
" <td>Unknown</td>\n",
|
| 464 |
+
" <td>pleasehelp</td>\n",
|
| 465 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 466 |
+
" </tr>\n",
|
| 467 |
+
" <tr>\n",
|
| 468 |
+
" <th>662535</th>\n",
|
| 469 |
+
" <td>79159008-2108-4690-a9b2-9812e0247ea5</td>\n",
|
| 470 |
+
" <td>14046023.0</td>\n",
|
| 471 |
+
" <td>62660090.0</td>\n",
|
| 472 |
+
" <td>NaN</td>\n",
|
| 473 |
+
" <td>NaN</td>\n",
|
| 474 |
+
" <td>NaN</td>\n",
|
| 475 |
+
" <td>NaN</td>\n",
|
| 476 |
+
" <td>NaN</td>\n",
|
| 477 |
+
" <td>NaN</td>\n",
|
| 478 |
+
" <td>NaN</td>\n",
|
| 479 |
+
" <td>NaN</td>\n",
|
| 480 |
+
" <td>NaN</td>\n",
|
| 481 |
+
" <td>NaN</td>\n",
|
| 482 |
+
" <td>Unknown</td>\n",
|
| 483 |
+
" <td>pleasehelp</td>\n",
|
| 484 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 485 |
+
" </tr>\n",
|
| 486 |
+
" <tr>\n",
|
| 487 |
+
" <th>1133612</th>\n",
|
| 488 |
+
" <td>08614858-7836-4543-a33c-0432b85d8455</td>\n",
|
| 489 |
+
" <td>14046025.0</td>\n",
|
| 490 |
+
" <td>62660090.0</td>\n",
|
| 491 |
+
" <td>NaN</td>\n",
|
| 492 |
+
" <td>NaN</td>\n",
|
| 493 |
+
" <td>NaN</td>\n",
|
| 494 |
+
" <td>NaN</td>\n",
|
| 495 |
+
" <td>NaN</td>\n",
|
| 496 |
+
" <td>NaN</td>\n",
|
| 497 |
+
" <td>NaN</td>\n",
|
| 498 |
+
" <td>NaN</td>\n",
|
| 499 |
+
" <td>NaN</td>\n",
|
| 500 |
+
" <td>NaN</td>\n",
|
| 501 |
+
" <td>Unknown</td>\n",
|
| 502 |
+
" <td>pleasehelp</td>\n",
|
| 503 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 504 |
+
" </tr>\n",
|
| 505 |
+
" <tr>\n",
|
| 506 |
+
" <th>1490749</th>\n",
|
| 507 |
+
" <td>73076cbf-3e79-427b-b0cb-5ba45386bb60</td>\n",
|
| 508 |
+
" <td>14046026.0</td>\n",
|
| 509 |
+
" <td>62660090.0</td>\n",
|
| 510 |
+
" <td>NaN</td>\n",
|
| 511 |
+
" <td>NaN</td>\n",
|
| 512 |
+
" <td>NaN</td>\n",
|
| 513 |
+
" <td>NaN</td>\n",
|
| 514 |
+
" <td>NaN</td>\n",
|
| 515 |
+
" <td>NaN</td>\n",
|
| 516 |
+
" <td>NaN</td>\n",
|
| 517 |
+
" <td>NaN</td>\n",
|
| 518 |
+
" <td>NaN</td>\n",
|
| 519 |
+
" <td>NaN</td>\n",
|
| 520 |
+
" <td>Unknown</td>\n",
|
| 521 |
+
" <td>pleasehelp</td>\n",
|
| 522 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 523 |
+
" </tr>\n",
|
| 524 |
+
" <tr>\n",
|
| 525 |
+
" <th>3686711</th>\n",
|
| 526 |
+
" <td>79212ef1-bf62-4e1f-b983-4fb6d4bd6523</td>\n",
|
| 527 |
+
" <td>14046028.0</td>\n",
|
| 528 |
+
" <td>62660090.0</td>\n",
|
| 529 |
+
" <td>NaN</td>\n",
|
| 530 |
+
" <td>NaN</td>\n",
|
| 531 |
+
" <td>NaN</td>\n",
|
| 532 |
+
" <td>NaN</td>\n",
|
| 533 |
+
" <td>NaN</td>\n",
|
| 534 |
+
" <td>NaN</td>\n",
|
| 535 |
+
" <td>NaN</td>\n",
|
| 536 |
+
" <td>NaN</td>\n",
|
| 537 |
+
" <td>NaN</td>\n",
|
| 538 |
+
" <td>NaN</td>\n",
|
| 539 |
+
" <td>Unknown</td>\n",
|
| 540 |
+
" <td>pleasehelp</td>\n",
|
| 541 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 542 |
+
" </tr>\n",
|
| 543 |
+
" <tr>\n",
|
| 544 |
+
" <th>4036030</th>\n",
|
| 545 |
+
" <td>1aeaf888-130b-4606-b9c6-f16bbcbbb68f</td>\n",
|
| 546 |
+
" <td>14046027.0</td>\n",
|
| 547 |
+
" <td>62660090.0</td>\n",
|
| 548 |
+
" <td>NaN</td>\n",
|
| 549 |
+
" <td>NaN</td>\n",
|
| 550 |
+
" <td>NaN</td>\n",
|
| 551 |
+
" <td>NaN</td>\n",
|
| 552 |
+
" <td>NaN</td>\n",
|
| 553 |
+
" <td>NaN</td>\n",
|
| 554 |
+
" <td>NaN</td>\n",
|
| 555 |
+
" <td>NaN</td>\n",
|
| 556 |
+
" <td>NaN</td>\n",
|
| 557 |
+
" <td>NaN</td>\n",
|
| 558 |
+
" <td>Unknown</td>\n",
|
| 559 |
+
" <td>pleasehelp</td>\n",
|
| 560 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 561 |
+
" </tr>\n",
|
| 562 |
+
" <tr>\n",
|
| 563 |
+
" <th>4526299</th>\n",
|
| 564 |
+
" <td>be856027-d6c7-4321-b0d3-a155ad5b49ba</td>\n",
|
| 565 |
+
" <td>14046029.0</td>\n",
|
| 566 |
+
" <td>62660090.0</td>\n",
|
| 567 |
+
" <td>NaN</td>\n",
|
| 568 |
+
" <td>NaN</td>\n",
|
| 569 |
+
" <td>NaN</td>\n",
|
| 570 |
+
" <td>NaN</td>\n",
|
| 571 |
+
" <td>NaN</td>\n",
|
| 572 |
+
" <td>NaN</td>\n",
|
| 573 |
+
" <td>NaN</td>\n",
|
| 574 |
+
" <td>NaN</td>\n",
|
| 575 |
+
" <td>NaN</td>\n",
|
| 576 |
+
" <td>NaN</td>\n",
|
| 577 |
+
" <td>Unknown</td>\n",
|
| 578 |
+
" <td>pleasehelp</td>\n",
|
| 579 |
+
" <td>Unknown pleasehelp</td>\n",
|
| 580 |
+
" </tr>\n",
|
| 581 |
+
" </tbody>\n",
|
| 582 |
+
"</table>\n",
|
| 583 |
+
"</div>"
|
| 584 |
+
],
|
| 585 |
+
"text/plain": [
|
| 586 |
+
" treeoflife_id eol_content_id eol_page_id \n",
|
| 587 |
+
"302277 1295e061-064b-4616-a10f-4a546489eb1a 14046024.0 62660090.0 \\\n",
|
| 588 |
+
"662535 79159008-2108-4690-a9b2-9812e0247ea5 14046023.0 62660090.0 \n",
|
| 589 |
+
"1133612 08614858-7836-4543-a33c-0432b85d8455 14046025.0 62660090.0 \n",
|
| 590 |
+
"1490749 73076cbf-3e79-427b-b0cb-5ba45386bb60 14046026.0 62660090.0 \n",
|
| 591 |
+
"3686711 79212ef1-bf62-4e1f-b983-4fb6d4bd6523 14046028.0 62660090.0 \n",
|
| 592 |
+
"4036030 1aeaf888-130b-4606-b9c6-f16bbcbbb68f 14046027.0 62660090.0 \n",
|
| 593 |
+
"4526299 be856027-d6c7-4321-b0d3-a155ad5b49ba 14046029.0 62660090.0 \n",
|
| 594 |
+
"\n",
|
| 595 |
+
" bioscan_part bioscan_filename inat21_filename inat21_cls_name \n",
|
| 596 |
+
"302277 NaN NaN NaN NaN \\\n",
|
| 597 |
+
"662535 NaN NaN NaN NaN \n",
|
| 598 |
+
"1133612 NaN NaN NaN NaN \n",
|
| 599 |
+
"1490749 NaN NaN NaN NaN \n",
|
| 600 |
+
"3686711 NaN NaN NaN NaN \n",
|
| 601 |
+
"4036030 NaN NaN NaN NaN \n",
|
| 602 |
+
"4526299 NaN NaN NaN NaN \n",
|
| 603 |
+
"\n",
|
| 604 |
+
" inat21_cls_num kingdom phylum class order family genus \n",
|
| 605 |
+
"302277 NaN NaN NaN NaN NaN NaN Unknown \\\n",
|
| 606 |
+
"662535 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 607 |
+
"1133612 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 608 |
+
"1490749 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 609 |
+
"3686711 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 610 |
+
"4036030 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 611 |
+
"4526299 NaN NaN NaN NaN NaN NaN Unknown \n",
|
| 612 |
+
"\n",
|
| 613 |
+
" species common \n",
|
| 614 |
+
"302277 pleasehelp Unknown pleasehelp \n",
|
| 615 |
+
"662535 pleasehelp Unknown pleasehelp \n",
|
| 616 |
+
"1133612 pleasehelp Unknown pleasehelp \n",
|
| 617 |
+
"1490749 pleasehelp Unknown pleasehelp \n",
|
| 618 |
+
"3686711 pleasehelp Unknown pleasehelp \n",
|
| 619 |
+
"4036030 pleasehelp Unknown pleasehelp \n",
|
| 620 |
+
"4526299 pleasehelp Unknown pleasehelp "
|
| 621 |
+
]
|
| 622 |
+
},
|
| 623 |
+
"execution_count": 4,
|
| 624 |
+
"metadata": {},
|
| 625 |
+
"output_type": "execute_result"
|
| 626 |
+
}
|
| 627 |
+
],
|
| 628 |
+
"source": [
|
| 629 |
+
"df_unknown_genus = df.loc[df.genus.str.lower() == \"unknown\"]\n",
|
| 630 |
+
"df_unknown_genus.loc[df_unknown_genus.species.notna()]"
|
| 631 |
+
]
|
| 632 |
+
},
|
| 633 |
+
{
|
| 634 |
+
"cell_type": "markdown",
|
| 635 |
+
"metadata": {},
|
| 636 |
+
"source": [
|
| 637 |
+
"Would be interesting to see what the model thinks of these once we re-train. They're all some kind of blue dragonfly-like bug ([eol page](https://eol.org/pages/62660090/media))."
|
| 638 |
+
]
|
| 639 |
+
},
|
| 640 |
+
{
|
| 641 |
+
"cell_type": "code",
|
| 642 |
+
"execution_count": 5,
|
| 643 |
+
"metadata": {},
|
| 644 |
+
"outputs": [
|
| 645 |
+
{
|
| 646 |
+
"data": {
|
| 647 |
+
"text/plain": [
|
| 648 |
+
"7"
|
| 649 |
+
]
|
| 650 |
+
},
|
| 651 |
+
"execution_count": 5,
|
| 652 |
+
"metadata": {},
|
| 653 |
+
"output_type": "execute_result"
|
| 654 |
+
}
|
| 655 |
+
],
|
| 656 |
+
"source": [
|
| 657 |
+
"len(df.loc[df.species.str.lower() == \"pleasehelp\"])"
|
| 658 |
+
]
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"cell_type": "markdown",
|
| 662 |
+
"metadata": {},
|
| 663 |
+
"source": [
|
| 664 |
+
"Good only these 7."
|
| 665 |
+
]
|
| 666 |
+
},
|
| 667 |
{
|
| 668 |
"cell_type": "code",
|
| 669 |
+
"execution_count": 4,
|
| 670 |
"metadata": {},
|
| 671 |
"outputs": [
|
| 672 |
{
|
|
|
|
| 675 |
"['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
|
| 676 |
]
|
| 677 |
},
|
| 678 |
+
"execution_count": 4,
|
| 679 |
"metadata": {},
|
| 680 |
"output_type": "execute_result"
|
| 681 |
}
|
|
|
|
| 870 |
},
|
| 871 |
{
|
| 872 |
"cell_type": "code",
|
| 873 |
+
"execution_count": 5,
|
| 874 |
"metadata": {},
|
| 875 |
"outputs": [],
|
| 876 |
"source": [
|
|
|
|
| 956 |
},
|
| 957 |
{
|
| 958 |
"cell_type": "code",
|
| 959 |
+
"execution_count": 8,
|
| 960 |
"metadata": {},
|
| 961 |
"outputs": [],
|
| 962 |
"source": [
|
|
|
|
| 1101 |
},
|
| 1102 |
{
|
| 1103 |
"cell_type": "code",
|
| 1104 |
+
"execution_count": 9,
|
| 1105 |
"metadata": {},
|
| 1106 |
"outputs": [],
|
| 1107 |
"source": [
|
|
|
|
| 2097 |
"cell_type": "markdown",
|
| 2098 |
"metadata": {},
|
| 2099 |
"source": [
|
| 2100 |
+
"Let's check this to be sure."
|
| 2101 |
]
|
| 2102 |
},
|
| 2103 |
{
|
| 2104 |
"cell_type": "code",
|
| 2105 |
+
"execution_count": 17,
|
| 2106 |
"metadata": {},
|
| 2107 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2108 |
"source": [
|
| 2109 |
+
"def check_sci_name(df):\n",
|
| 2110 |
+
" \"\"\"\n",
|
| 2111 |
+
" This function checks the number of words in the species column for each sample.\n",
|
| 2112 |
+
" Logs a warning with the number that have more than one word indicating the potential for both genus and species to be recorded.\n",
|
| 2113 |
+
" Warning is printed to terminal, not saved to file.\n",
|
| 2114 |
+
"\n",
|
| 2115 |
+
" Parameters:\n",
|
| 2116 |
+
" -----------\n",
|
| 2117 |
+
" df - DataFrame with taxonomic hierarchy as columns.\n",
|
| 2118 |
+
"\n",
|
| 2119 |
+
" Returns:\n",
|
| 2120 |
+
" --------\n",
|
| 2121 |
+
" df - DataFrame with taxonomic hierarchy and length of species entry as columns.\n",
|
| 2122 |
+
" \"\"\"\n",
|
| 2123 |
+
" # Set length of species column with default = 1\n",
|
| 2124 |
+
" df[\"len_species\"] = 1\n",
|
| 2125 |
+
"\n",
|
| 2126 |
+
" # Check for scientific name in species column (i.e., genus speices in species column, may correspond to missing genus)\n",
|
| 2127 |
+
" for species in list(df.loc[df[\"species\"].notna(), \"species\"].unique()):\n",
|
| 2128 |
+
" len_species = len(species.split(\" \"))\n",
|
| 2129 |
+
" if len_species > 1:\n",
|
| 2130 |
+
" df.loc[df[\"species\"] == species, \"len_species\"] = len_species\n",
|
| 2131 |
+
" \n",
|
| 2132 |
+
" return df\n"
|
| 2133 |
]
|
| 2134 |
},
|
| 2135 |
{
|
| 2136 |
"cell_type": "code",
|
| 2137 |
+
"execution_count": 10,
|
| 2138 |
"metadata": {},
|
| 2139 |
"outputs": [
|
| 2140 |
{
|
| 2141 |
+
"name": "stderr",
|
| 2142 |
+
"output_type": "stream",
|
| 2143 |
+
"text": [
|
| 2144 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_65691/1898242669.py:16: SettingWithCopyWarning: \n",
|
| 2145 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 2146 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 2147 |
+
"\n",
|
| 2148 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 2149 |
+
" df[\"len_species\"] = 1\n"
|
| 2150 |
+
]
|
| 2151 |
+
},
|
| 2152 |
+
{
|
| 2153 |
+
"name": "stdout",
|
| 2154 |
+
"output_type": "stream",
|
| 2155 |
+
"text": [
|
| 2156 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 2157 |
+
"Index: 1128313 entries, 4319650 to 8403834\n",
|
| 2158 |
+
"Data columns (total 10 columns):\n",
|
| 2159 |
+
" # Column Non-Null Count Dtype \n",
|
| 2160 |
+
"--- ------ -------------- ----- \n",
|
| 2161 |
+
" 0 data_source 1128313 non-null object\n",
|
| 2162 |
+
" 1 kingdom 1128313 non-null object\n",
|
| 2163 |
+
" 2 phylum 1128313 non-null object\n",
|
| 2164 |
+
" 3 class 1128313 non-null object\n",
|
| 2165 |
+
" 4 order 1128313 non-null object\n",
|
| 2166 |
+
" 5 family 1112922 non-null object\n",
|
| 2167 |
+
" 6 genus 254149 non-null object\n",
|
| 2168 |
+
" 7 species 84450 non-null object\n",
|
| 2169 |
+
" 8 common 1128313 non-null object\n",
|
| 2170 |
+
" 9 len_species 1128313 non-null int64 \n",
|
| 2171 |
+
"dtypes: int64(1), object(9)\n",
|
| 2172 |
+
"memory usage: 94.7+ MB\n"
|
| 2173 |
+
]
|
| 2174 |
}
|
| 2175 |
],
|
| 2176 |
"source": [
|
| 2177 |
+
"bioscan_species_len_df = check_sci_name(bioscan_df)\n",
|
| 2178 |
+
"bioscan_species_len_df.info(show_counts = True)"
|
| 2179 |
]
|
| 2180 |
},
|
| 2181 |
{
|
| 2182 |
"cell_type": "code",
|
| 2183 |
+
"execution_count": 11,
|
| 2184 |
"metadata": {},
|
| 2185 |
"outputs": [
|
| 2186 |
{
|
| 2187 |
+
"name": "stdout",
|
| 2188 |
+
"output_type": "stream",
|
| 2189 |
+
"text": [
|
| 2190 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 2191 |
+
"Index: 84450 entries, 4401381 to 8403808\n",
|
| 2192 |
+
"Data columns (total 10 columns):\n",
|
| 2193 |
+
" # Column Non-Null Count Dtype \n",
|
| 2194 |
+
"--- ------ -------------- ----- \n",
|
| 2195 |
+
" 0 data_source 84450 non-null object\n",
|
| 2196 |
+
" 1 kingdom 84450 non-null object\n",
|
| 2197 |
+
" 2 phylum 84450 non-null object\n",
|
| 2198 |
+
" 3 class 84450 non-null object\n",
|
| 2199 |
+
" 4 order 84450 non-null object\n",
|
| 2200 |
+
" 5 family 84450 non-null object\n",
|
| 2201 |
+
" 6 genus 84441 non-null object\n",
|
| 2202 |
+
" 7 species 84450 non-null object\n",
|
| 2203 |
+
" 8 common 84450 non-null object\n",
|
| 2204 |
+
" 9 len_species 84450 non-null int64 \n",
|
| 2205 |
+
"dtypes: int64(1), object(9)\n",
|
| 2206 |
+
"memory usage: 7.1+ MB\n"
|
| 2207 |
+
]
|
| 2208 |
}
|
| 2209 |
],
|
| 2210 |
"source": [
|
| 2211 |
+
"bioscan_long_species = bioscan_species_len_df.loc[bioscan_species_len_df[\"len_species\"] > 1]\n",
|
| 2212 |
+
"bioscan_long_species.info(show_counts = True)"
|
| 2213 |
]
|
| 2214 |
},
|
| 2215 |
{
|
| 2216 |
"cell_type": "markdown",
|
| 2217 |
"metadata": {},
|
| 2218 |
"source": [
|
| 2219 |
+
"Yes, all species indicated are of length greater than 1 (indicating they may be genus-species)."
|
|
|
|
|
|
|
| 2220 |
]
|
| 2221 |
},
|
| 2222 |
{
|
| 2223 |
"cell_type": "code",
|
| 2224 |
+
"execution_count": 12,
|
| 2225 |
"metadata": {},
|
| 2226 |
"outputs": [
|
| 2227 |
{
|
| 2228 |
"data": {
|
| 2229 |
"text/plain": [
|
| 2230 |
+
"len_species\n",
|
| 2231 |
+
"2 81156\n",
|
| 2232 |
+
"3 2679\n",
|
| 2233 |
+
"4 598\n",
|
| 2234 |
+
"5 17\n",
|
| 2235 |
"Name: count, dtype: int64"
|
| 2236 |
]
|
| 2237 |
},
|
| 2238 |
+
"execution_count": 12,
|
| 2239 |
"metadata": {},
|
| 2240 |
"output_type": "execute_result"
|
| 2241 |
}
|
| 2242 |
],
|
| 2243 |
"source": [
|
| 2244 |
+
"bioscan_long_species.len_species.value_counts()"
|
| 2245 |
]
|
| 2246 |
},
|
| 2247 |
{
|
| 2248 |
"cell_type": "markdown",
|
| 2249 |
"metadata": {},
|
| 2250 |
"source": [
|
| 2251 |
+
"Note that some are as long as 5 words, so this may require some more caution."
|
|
|
|
|
|
|
| 2252 |
]
|
| 2253 |
},
|
| 2254 |
{
|
| 2255 |
"cell_type": "code",
|
| 2256 |
+
"execution_count": 13,
|
| 2257 |
"metadata": {},
|
| 2258 |
"outputs": [
|
| 2259 |
{
|
| 2260 |
+
"data": {
|
| 2261 |
+
"text/html": [
|
| 2262 |
+
"<div>\n",
|
| 2263 |
+
"<style scoped>\n",
|
| 2264 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 2265 |
+
" vertical-align: middle;\n",
|
| 2266 |
+
" }\n",
|
| 2267 |
+
"\n",
|
| 2268 |
+
" .dataframe tbody tr th {\n",
|
| 2269 |
+
" vertical-align: top;\n",
|
| 2270 |
+
" }\n",
|
| 2271 |
+
"\n",
|
| 2272 |
+
" .dataframe thead th {\n",
|
| 2273 |
+
" text-align: right;\n",
|
| 2274 |
+
" }\n",
|
| 2275 |
+
"</style>\n",
|
| 2276 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 2277 |
+
" <thead>\n",
|
| 2278 |
+
" <tr style=\"text-align: right;\">\n",
|
| 2279 |
+
" <th></th>\n",
|
| 2280 |
+
" <th>data_source</th>\n",
|
| 2281 |
+
" <th>kingdom</th>\n",
|
| 2282 |
+
" <th>phylum</th>\n",
|
| 2283 |
+
" <th>class</th>\n",
|
| 2284 |
+
" <th>order</th>\n",
|
| 2285 |
+
" <th>family</th>\n",
|
| 2286 |
+
" <th>genus</th>\n",
|
| 2287 |
+
" <th>species</th>\n",
|
| 2288 |
+
" <th>common</th>\n",
|
| 2289 |
+
" <th>len_species</th>\n",
|
| 2290 |
+
" </tr>\n",
|
| 2291 |
+
" </thead>\n",
|
| 2292 |
+
" <tbody>\n",
|
| 2293 |
+
" <tr>\n",
|
| 2294 |
+
" <th>7249466</th>\n",
|
| 2295 |
+
" <td>BIOSCAN</td>\n",
|
| 2296 |
+
" <td>Animalia</td>\n",
|
| 2297 |
+
" <td>Arthropoda</td>\n",
|
| 2298 |
+
" <td>Insecta</td>\n",
|
| 2299 |
+
" <td>Lepidoptera</td>\n",
|
| 2300 |
+
" <td>Nepticulidae</td>\n",
|
| 2301 |
+
" <td>Stigmella</td>\n",
|
| 2302 |
+
" <td>stigmella pruinosa</td>\n",
|
| 2303 |
+
" <td>Stigmella stigmella pruinosa</td>\n",
|
| 2304 |
+
" <td>2</td>\n",
|
| 2305 |
+
" </tr>\n",
|
| 2306 |
+
" <tr>\n",
|
| 2307 |
+
" <th>5561508</th>\n",
|
| 2308 |
+
" <td>BIOSCAN</td>\n",
|
| 2309 |
+
" <td>Animalia</td>\n",
|
| 2310 |
+
" <td>Arthropoda</td>\n",
|
| 2311 |
+
" <td>Insecta</td>\n",
|
| 2312 |
+
" <td>Diptera</td>\n",
|
| 2313 |
+
" <td>Chironomidae</td>\n",
|
| 2314 |
+
" <td>Tanytarsus</td>\n",
|
| 2315 |
+
" <td>tanytarsus hastatus</td>\n",
|
| 2316 |
+
" <td>Tanytarsus tanytarsus hastatus</td>\n",
|
| 2317 |
+
" <td>2</td>\n",
|
| 2318 |
+
" </tr>\n",
|
| 2319 |
+
" <tr>\n",
|
| 2320 |
+
" <th>5590255</th>\n",
|
| 2321 |
+
" <td>BIOSCAN</td>\n",
|
| 2322 |
+
" <td>Animalia</td>\n",
|
| 2323 |
+
" <td>Arthropoda</td>\n",
|
| 2324 |
+
" <td>Insecta</td>\n",
|
| 2325 |
+
" <td>Diptera</td>\n",
|
| 2326 |
+
" <td>Psychodidae</td>\n",
|
| 2327 |
+
" <td>Pneumia</td>\n",
|
| 2328 |
+
" <td>pneumia mutua</td>\n",
|
| 2329 |
+
" <td>Pneumia pneumia mutua</td>\n",
|
| 2330 |
+
" <td>2</td>\n",
|
| 2331 |
+
" </tr>\n",
|
| 2332 |
+
" <tr>\n",
|
| 2333 |
+
" <th>7204744</th>\n",
|
| 2334 |
+
" <td>BIOSCAN</td>\n",
|
| 2335 |
+
" <td>Animalia</td>\n",
|
| 2336 |
+
" <td>Arthropoda</td>\n",
|
| 2337 |
+
" <td>Insecta</td>\n",
|
| 2338 |
+
" <td>Diptera</td>\n",
|
| 2339 |
+
" <td>Sphaeroceridae</td>\n",
|
| 2340 |
+
" <td>Bifronsina</td>\n",
|
| 2341 |
+
" <td>bifronsina bifrons</td>\n",
|
| 2342 |
+
" <td>Bifronsina bifronsina bifrons</td>\n",
|
| 2343 |
+
" <td>2</td>\n",
|
| 2344 |
+
" </tr>\n",
|
| 2345 |
+
" <tr>\n",
|
| 2346 |
+
" <th>6194418</th>\n",
|
| 2347 |
+
" <td>BIOSCAN</td>\n",
|
| 2348 |
+
" <td>Animalia</td>\n",
|
| 2349 |
+
" <td>Arthropoda</td>\n",
|
| 2350 |
+
" <td>Insecta</td>\n",
|
| 2351 |
+
" <td>Diptera</td>\n",
|
| 2352 |
+
" <td>Tachinidae</td>\n",
|
| 2353 |
+
" <td>Paradidyma</td>\n",
|
| 2354 |
+
" <td>paradidyma melania</td>\n",
|
| 2355 |
+
" <td>Paradidyma paradidyma melania</td>\n",
|
| 2356 |
+
" <td>2</td>\n",
|
| 2357 |
+
" </tr>\n",
|
| 2358 |
+
" <tr>\n",
|
| 2359 |
+
" <th>4513431</th>\n",
|
| 2360 |
+
" <td>BIOSCAN</td>\n",
|
| 2361 |
+
" <td>Animalia</td>\n",
|
| 2362 |
+
" <td>Arthropoda</td>\n",
|
| 2363 |
+
" <td>Insecta</td>\n",
|
| 2364 |
+
" <td>Diptera</td>\n",
|
| 2365 |
+
" <td>Ceratopogonidae</td>\n",
|
| 2366 |
+
" <td>Forcipomyia</td>\n",
|
| 2367 |
+
" <td>forcipomyia sp. db 11421</td>\n",
|
| 2368 |
+
" <td>Forcipomyia forcipomyia sp. db 11421</td>\n",
|
| 2369 |
+
" <td>4</td>\n",
|
| 2370 |
+
" </tr>\n",
|
| 2371 |
+
" <tr>\n",
|
| 2372 |
+
" <th>7813982</th>\n",
|
| 2373 |
+
" <td>BIOSCAN</td>\n",
|
| 2374 |
+
" <td>Animalia</td>\n",
|
| 2375 |
+
" <td>Arthropoda</td>\n",
|
| 2376 |
+
" <td>Insecta</td>\n",
|
| 2377 |
+
" <td>Diptera</td>\n",
|
| 2378 |
+
" <td>Sciaridae</td>\n",
|
| 2379 |
+
" <td>Corynoptera</td>\n",
|
| 2380 |
+
" <td>corynoptera breviformis</td>\n",
|
| 2381 |
+
" <td>Corynoptera corynoptera breviformis</td>\n",
|
| 2382 |
+
" <td>2</td>\n",
|
| 2383 |
+
" </tr>\n",
|
| 2384 |
+
" </tbody>\n",
|
| 2385 |
+
"</table>\n",
|
| 2386 |
+
"</div>"
|
| 2387 |
+
],
|
| 2388 |
+
"text/plain": [
|
| 2389 |
+
" data_source kingdom phylum class order \n",
|
| 2390 |
+
"7249466 BIOSCAN Animalia Arthropoda Insecta Lepidoptera \\\n",
|
| 2391 |
+
"5561508 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2392 |
+
"5590255 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2393 |
+
"7204744 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2394 |
+
"6194418 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2395 |
+
"4513431 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2396 |
+
"7813982 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2397 |
+
"\n",
|
| 2398 |
+
" family genus species \n",
|
| 2399 |
+
"7249466 Nepticulidae Stigmella stigmella pruinosa \\\n",
|
| 2400 |
+
"5561508 Chironomidae Tanytarsus tanytarsus hastatus \n",
|
| 2401 |
+
"5590255 Psychodidae Pneumia pneumia mutua \n",
|
| 2402 |
+
"7204744 Sphaeroceridae Bifronsina bifronsina bifrons \n",
|
| 2403 |
+
"6194418 Tachinidae Paradidyma paradidyma melania \n",
|
| 2404 |
+
"4513431 Ceratopogonidae Forcipomyia forcipomyia sp. db 11421 \n",
|
| 2405 |
+
"7813982 Sciaridae Corynoptera corynoptera breviformis \n",
|
| 2406 |
+
"\n",
|
| 2407 |
+
" common len_species \n",
|
| 2408 |
+
"7249466 Stigmella stigmella pruinosa 2 \n",
|
| 2409 |
+
"5561508 Tanytarsus tanytarsus hastatus 2 \n",
|
| 2410 |
+
"5590255 Pneumia pneumia mutua 2 \n",
|
| 2411 |
+
"7204744 Bifronsina bifronsina bifrons 2 \n",
|
| 2412 |
+
"6194418 Paradidyma paradidyma melania 2 \n",
|
| 2413 |
+
"4513431 Forcipomyia forcipomyia sp. db 11421 4 \n",
|
| 2414 |
+
"7813982 Corynoptera corynoptera breviformis 2 "
|
| 2415 |
+
]
|
| 2416 |
+
},
|
| 2417 |
+
"execution_count": 13,
|
| 2418 |
+
"metadata": {},
|
| 2419 |
+
"output_type": "execute_result"
|
| 2420 |
}
|
| 2421 |
],
|
| 2422 |
"source": [
|
| 2423 |
+
"bioscan_long_species.sample(7)"
|
|
|
|
|
|
|
| 2424 |
]
|
| 2425 |
},
|
| 2426 |
{
|
| 2427 |
"cell_type": "code",
|
| 2428 |
+
"execution_count": 14,
|
| 2429 |
"metadata": {},
|
| 2430 |
"outputs": [
|
| 2431 |
{
|
| 2432 |
+
"data": {
|
| 2433 |
+
"text/html": [
|
| 2434 |
+
"<div>\n",
|
| 2435 |
+
"<style scoped>\n",
|
| 2436 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 2437 |
+
" vertical-align: middle;\n",
|
| 2438 |
+
" }\n",
|
| 2439 |
+
"\n",
|
| 2440 |
+
" .dataframe tbody tr th {\n",
|
| 2441 |
+
" vertical-align: top;\n",
|
| 2442 |
+
" }\n",
|
| 2443 |
+
"\n",
|
| 2444 |
+
" .dataframe thead th {\n",
|
| 2445 |
+
" text-align: right;\n",
|
| 2446 |
+
" }\n",
|
| 2447 |
+
"</style>\n",
|
| 2448 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 2449 |
+
" <thead>\n",
|
| 2450 |
+
" <tr style=\"text-align: right;\">\n",
|
| 2451 |
+
" <th></th>\n",
|
| 2452 |
+
" <th>data_source</th>\n",
|
| 2453 |
+
" <th>kingdom</th>\n",
|
| 2454 |
+
" <th>phylum</th>\n",
|
| 2455 |
+
" <th>class</th>\n",
|
| 2456 |
+
" <th>order</th>\n",
|
| 2457 |
+
" <th>family</th>\n",
|
| 2458 |
+
" <th>genus</th>\n",
|
| 2459 |
+
" <th>species</th>\n",
|
| 2460 |
+
" <th>common</th>\n",
|
| 2461 |
+
" <th>len_species</th>\n",
|
| 2462 |
+
" </tr>\n",
|
| 2463 |
+
" </thead>\n",
|
| 2464 |
+
" <tbody>\n",
|
| 2465 |
+
" <tr>\n",
|
| 2466 |
+
" <th>4426608</th>\n",
|
| 2467 |
+
" <td>BIOSCAN</td>\n",
|
| 2468 |
+
" <td>Animalia</td>\n",
|
| 2469 |
+
" <td>Arthropoda</td>\n",
|
| 2470 |
+
" <td>Insecta</td>\n",
|
| 2471 |
+
" <td>Diptera</td>\n",
|
| 2472 |
+
" <td>Psychodidae</td>\n",
|
| 2473 |
+
" <td>Psychoda</td>\n",
|
| 2474 |
+
" <td>psychoda sp. 11gmk</td>\n",
|
| 2475 |
+
" <td>Psychoda psychoda sp. 11gmk</td>\n",
|
| 2476 |
+
" <td>3</td>\n",
|
| 2477 |
+
" </tr>\n",
|
| 2478 |
+
" <tr>\n",
|
| 2479 |
+
" <th>7173904</th>\n",
|
| 2480 |
+
" <td>BIOSCAN</td>\n",
|
| 2481 |
+
" <td>Animalia</td>\n",
|
| 2482 |
+
" <td>Arthropoda</td>\n",
|
| 2483 |
+
" <td>Insecta</td>\n",
|
| 2484 |
+
" <td>Diptera</td>\n",
|
| 2485 |
+
" <td>Sciaridae</td>\n",
|
| 2486 |
+
" <td>Cosmosciara</td>\n",
|
| 2487 |
+
" <td>cosmosciara sp. saevg morph0042</td>\n",
|
| 2488 |
+
" <td>Cosmosciara cosmosciara sp. saevg morph0042</td>\n",
|
| 2489 |
+
" <td>4</td>\n",
|
| 2490 |
+
" </tr>\n",
|
| 2491 |
+
" <tr>\n",
|
| 2492 |
+
" <th>7266486</th>\n",
|
| 2493 |
+
" <td>BIOSCAN</td>\n",
|
| 2494 |
+
" <td>Animalia</td>\n",
|
| 2495 |
+
" <td>Arthropoda</td>\n",
|
| 2496 |
+
" <td>Insecta</td>\n",
|
| 2497 |
+
" <td>Coleoptera</td>\n",
|
| 2498 |
+
" <td>Curculionidae</td>\n",
|
| 2499 |
+
" <td>Hypothenemus</td>\n",
|
| 2500 |
+
" <td>hypothenemus sp. h291</td>\n",
|
| 2501 |
+
" <td>Hypothenemus hypothenemus sp. h291</td>\n",
|
| 2502 |
+
" <td>3</td>\n",
|
| 2503 |
+
" </tr>\n",
|
| 2504 |
+
" <tr>\n",
|
| 2505 |
+
" <th>5594884</th>\n",
|
| 2506 |
+
" <td>BIOSCAN</td>\n",
|
| 2507 |
+
" <td>Animalia</td>\n",
|
| 2508 |
+
" <td>Arthropoda</td>\n",
|
| 2509 |
+
" <td>Insecta</td>\n",
|
| 2510 |
+
" <td>Diptera</td>\n",
|
| 2511 |
+
" <td>Psychodidae</td>\n",
|
| 2512 |
+
" <td>Psychoda</td>\n",
|
| 2513 |
+
" <td>psychoda sp. 11gmk</td>\n",
|
| 2514 |
+
" <td>Psychoda psychoda sp. 11gmk</td>\n",
|
| 2515 |
+
" <td>3</td>\n",
|
| 2516 |
+
" </tr>\n",
|
| 2517 |
+
" <tr>\n",
|
| 2518 |
+
" <th>5716363</th>\n",
|
| 2519 |
+
" <td>BIOSCAN</td>\n",
|
| 2520 |
+
" <td>Animalia</td>\n",
|
| 2521 |
+
" <td>Arthropoda</td>\n",
|
| 2522 |
+
" <td>Insecta</td>\n",
|
| 2523 |
+
" <td>Diptera</td>\n",
|
| 2524 |
+
" <td>Psychodidae</td>\n",
|
| 2525 |
+
" <td>Psychoda</td>\n",
|
| 2526 |
+
" <td>psychoda sp. 11gmk</td>\n",
|
| 2527 |
+
" <td>Psychoda psychoda sp. 11gmk</td>\n",
|
| 2528 |
+
" <td>3</td>\n",
|
| 2529 |
+
" </tr>\n",
|
| 2530 |
+
" <tr>\n",
|
| 2531 |
+
" <th>4949127</th>\n",
|
| 2532 |
+
" <td>BIOSCAN</td>\n",
|
| 2533 |
+
" <td>Animalia</td>\n",
|
| 2534 |
+
" <td>Arthropoda</td>\n",
|
| 2535 |
+
" <td>Insecta</td>\n",
|
| 2536 |
+
" <td>Diptera</td>\n",
|
| 2537 |
+
" <td>Psychodidae</td>\n",
|
| 2538 |
+
" <td>Psychoda</td>\n",
|
| 2539 |
+
" <td>psychoda sp. 11gmk</td>\n",
|
| 2540 |
+
" <td>Psychoda psychoda sp. 11gmk</td>\n",
|
| 2541 |
+
" <td>3</td>\n",
|
| 2542 |
+
" </tr>\n",
|
| 2543 |
+
" <tr>\n",
|
| 2544 |
+
" <th>4434473</th>\n",
|
| 2545 |
+
" <td>BIOSCAN</td>\n",
|
| 2546 |
+
" <td>Animalia</td>\n",
|
| 2547 |
+
" <td>Arthropoda</td>\n",
|
| 2548 |
+
" <td>Insecta</td>\n",
|
| 2549 |
+
" <td>Diptera</td>\n",
|
| 2550 |
+
" <td>Psychodidae</td>\n",
|
| 2551 |
+
" <td>Psychoda</td>\n",
|
| 2552 |
+
" <td>psychoda sp. 11gmk</td>\n",
|
| 2553 |
+
" <td>Psychoda psychoda sp. 11gmk</td>\n",
|
| 2554 |
+
" <td>3</td>\n",
|
| 2555 |
+
" </tr>\n",
|
| 2556 |
+
" <tr>\n",
|
| 2557 |
+
" <th>5541057</th>\n",
|
| 2558 |
+
" <td>BIOSCAN</td>\n",
|
| 2559 |
+
" <td>Animalia</td>\n",
|
| 2560 |
+
" <td>Arthropoda</td>\n",
|
| 2561 |
+
" <td>Insecta</td>\n",
|
| 2562 |
+
" <td>Diptera</td>\n",
|
| 2563 |
+
" <td>Chironomidae</td>\n",
|
| 2564 |
+
" <td>Thienemanniella</td>\n",
|
| 2565 |
+
" <td>thienemanniella sp. 3lm</td>\n",
|
| 2566 |
+
" <td>Thienemanniella thienemanniella sp. 3lm</td>\n",
|
| 2567 |
+
" <td>3</td>\n",
|
| 2568 |
+
" </tr>\n",
|
| 2569 |
+
" <tr>\n",
|
| 2570 |
+
" <th>4459500</th>\n",
|
| 2571 |
+
" <td>BIOSCAN</td>\n",
|
| 2572 |
+
" <td>Animalia</td>\n",
|
| 2573 |
+
" <td>Arthropoda</td>\n",
|
| 2574 |
+
" <td>Insecta</td>\n",
|
| 2575 |
+
" <td>Hymenoptera</td>\n",
|
| 2576 |
+
" <td>Eupelmidae</td>\n",
|
| 2577 |
+
" <td>Brasema</td>\n",
|
| 2578 |
+
" <td>brasema sp. gg14</td>\n",
|
| 2579 |
+
" <td>Brasema brasema sp. gg14</td>\n",
|
| 2580 |
+
" <td>3</td>\n",
|
| 2581 |
+
" </tr>\n",
|
| 2582 |
+
" <tr>\n",
|
| 2583 |
+
" <th>6623861</th>\n",
|
| 2584 |
+
" <td>BIOSCAN</td>\n",
|
| 2585 |
+
" <td>Animalia</td>\n",
|
| 2586 |
+
" <td>Arthropoda</td>\n",
|
| 2587 |
+
" <td>Insecta</td>\n",
|
| 2588 |
+
" <td>Diptera</td>\n",
|
| 2589 |
+
" <td>Chironomidae</td>\n",
|
| 2590 |
+
" <td>Tanytarsus</td>\n",
|
| 2591 |
+
" <td>tanytarsus sp. 3te</td>\n",
|
| 2592 |
+
" <td>Tanytarsus tanytarsus sp. 3te</td>\n",
|
| 2593 |
+
" <td>3</td>\n",
|
| 2594 |
+
" </tr>\n",
|
| 2595 |
+
" </tbody>\n",
|
| 2596 |
+
"</table>\n",
|
| 2597 |
+
"</div>"
|
| 2598 |
+
],
|
| 2599 |
+
"text/plain": [
|
| 2600 |
+
" data_source kingdom phylum class order \n",
|
| 2601 |
+
"4426608 BIOSCAN Animalia Arthropoda Insecta Diptera \\\n",
|
| 2602 |
+
"7173904 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2603 |
+
"7266486 BIOSCAN Animalia Arthropoda Insecta Coleoptera \n",
|
| 2604 |
+
"5594884 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2605 |
+
"5716363 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2606 |
+
"4949127 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2607 |
+
"4434473 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2608 |
+
"5541057 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2609 |
+
"4459500 BIOSCAN Animalia Arthropoda Insecta Hymenoptera \n",
|
| 2610 |
+
"6623861 BIOSCAN Animalia Arthropoda Insecta Diptera \n",
|
| 2611 |
+
"\n",
|
| 2612 |
+
" family genus species \n",
|
| 2613 |
+
"4426608 Psychodidae Psychoda psychoda sp. 11gmk \\\n",
|
| 2614 |
+
"7173904 Sciaridae Cosmosciara cosmosciara sp. saevg morph0042 \n",
|
| 2615 |
+
"7266486 Curculionidae Hypothenemus hypothenemus sp. h291 \n",
|
| 2616 |
+
"5594884 Psychodidae Psychoda psychoda sp. 11gmk \n",
|
| 2617 |
+
"5716363 Psychodidae Psychoda psychoda sp. 11gmk \n",
|
| 2618 |
+
"4949127 Psychodidae Psychoda psychoda sp. 11gmk \n",
|
| 2619 |
+
"4434473 Psychodidae Psychoda psychoda sp. 11gmk \n",
|
| 2620 |
+
"5541057 Chironomidae Thienemanniella thienemanniella sp. 3lm \n",
|
| 2621 |
+
"4459500 Eupelmidae Brasema brasema sp. gg14 \n",
|
| 2622 |
+
"6623861 Chironomidae Tanytarsus tanytarsus sp. 3te \n",
|
| 2623 |
+
"\n",
|
| 2624 |
+
" common len_species \n",
|
| 2625 |
+
"4426608 Psychoda psychoda sp. 11gmk 3 \n",
|
| 2626 |
+
"7173904 Cosmosciara cosmosciara sp. saevg morph0042 4 \n",
|
| 2627 |
+
"7266486 Hypothenemus hypothenemus sp. h291 3 \n",
|
| 2628 |
+
"5594884 Psychoda psychoda sp. 11gmk 3 \n",
|
| 2629 |
+
"5716363 Psychoda psychoda sp. 11gmk 3 \n",
|
| 2630 |
+
"4949127 Psychoda psychoda sp. 11gmk 3 \n",
|
| 2631 |
+
"4434473 Psychoda psychoda sp. 11gmk 3 \n",
|
| 2632 |
+
"5541057 Thienemanniella thienemanniella sp. 3lm 3 \n",
|
| 2633 |
+
"4459500 Brasema brasema sp. gg14 3 \n",
|
| 2634 |
+
"6623861 Tanytarsus tanytarsus sp. 3te 3 "
|
| 2635 |
+
]
|
| 2636 |
+
},
|
| 2637 |
+
"execution_count": 14,
|
| 2638 |
+
"metadata": {},
|
| 2639 |
+
"output_type": "execute_result"
|
| 2640 |
+
}
|
| 2641 |
+
],
|
| 2642 |
+
"source": [
|
| 2643 |
+
"bioscan_long_species.loc[bioscan_long_species['len_species'] > 2].sample(10)"
|
| 2644 |
+
]
|
| 2645 |
+
},
|
| 2646 |
+
{
|
| 2647 |
+
"cell_type": "code",
|
| 2648 |
+
"execution_count": 15,
|
| 2649 |
+
"metadata": {},
|
| 2650 |
+
"outputs": [
|
| 2651 |
+
{
|
| 2652 |
+
"data": {
|
| 2653 |
+
"text/plain": [
|
| 2654 |
+
"array([nan, 'psychoda albipennis', 'psychoda trinodulosa',\n",
|
| 2655 |
+
" 'psychoda sp. 11gmk', 'psychoda satchelli', 'psychoda alternata',\n",
|
| 2656 |
+
" 'psychoda phalaenoides', 'psychoda sigma', 'psychoda grisescens',\n",
|
| 2657 |
+
" 'psychoda minuta', 'psychoda uncinula', 'psychoda divaricata',\n",
|
| 2658 |
+
" 'psychoda erminea', 'psychoda mycophila', 'psychoda uniformata',\n",
|
| 2659 |
+
" 'psychoda setigera', 'psychoda lativentris', 'psychoda lobata',\n",
|
| 2660 |
+
" 'psychoda gemina', 'psychoda cinerea'], dtype=object)"
|
| 2661 |
+
]
|
| 2662 |
+
},
|
| 2663 |
+
"execution_count": 15,
|
| 2664 |
+
"metadata": {},
|
| 2665 |
+
"output_type": "execute_result"
|
| 2666 |
+
}
|
| 2667 |
+
],
|
| 2668 |
+
"source": [
|
| 2669 |
+
"bioscan_df.loc[bioscan_df[\"genus\"] == \"Psychoda\", \"species\"].unique()"
|
| 2670 |
+
]
|
| 2671 |
+
},
|
| 2672 |
+
{
|
| 2673 |
+
"cell_type": "markdown",
|
| 2674 |
+
"metadata": {},
|
| 2675 |
+
"source": [
|
| 2676 |
+
"It would seem the \"sp. ...\" is used to indicate they are likely the same species, though the actual species is not designated (either unnamed or undetermined). This is information we should retain, but the duplicated genus can be removed."
|
| 2677 |
+
]
|
| 2678 |
+
},
|
| 2679 |
+
{
|
| 2680 |
+
"cell_type": "markdown",
|
| 2681 |
+
"metadata": {},
|
| 2682 |
+
"source": [
|
| 2683 |
+
"### EOL"
|
| 2684 |
+
]
|
| 2685 |
+
},
|
| 2686 |
+
{
|
| 2687 |
+
"cell_type": "code",
|
| 2688 |
+
"execution_count": 35,
|
| 2689 |
+
"metadata": {},
|
| 2690 |
+
"outputs": [
|
| 2691 |
+
{
|
| 2692 |
+
"name": "stdout",
|
| 2693 |
+
"output_type": "stream",
|
| 2694 |
+
"text": [
|
| 2695 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 2696 |
+
"Index: 6621365 entries, 0 to 10436520\n",
|
| 2697 |
+
"Data columns (total 9 columns):\n",
|
| 2698 |
+
" # Column Non-Null Count Dtype \n",
|
| 2699 |
+
"--- ------ -------------- ----- \n",
|
| 2700 |
+
" 0 data_source 6621365 non-null object\n",
|
| 2701 |
+
" 1 kingdom 3919403 non-null object\n",
|
| 2702 |
+
" 2 phylum 3917533 non-null object\n",
|
| 2703 |
+
" 3 class 2842328 non-null object\n",
|
| 2704 |
+
" 4 order 3875193 non-null object\n",
|
| 2705 |
+
" 5 family 3906994 non-null object\n",
|
| 2706 |
+
" 6 genus 5119837 non-null object\n",
|
| 2707 |
+
" 7 species 4408570 non-null object\n",
|
| 2708 |
+
" 8 common 6621365 non-null object\n",
|
| 2709 |
+
"dtypes: object(9)\n",
|
| 2710 |
+
"memory usage: 505.2+ MB\n"
|
| 2711 |
+
]
|
| 2712 |
+
}
|
| 2713 |
+
],
|
| 2714 |
+
"source": [
|
| 2715 |
+
"eol_df.info(show_counts = True)"
|
| 2716 |
+
]
|
| 2717 |
+
},
|
| 2718 |
+
{
|
| 2719 |
+
"cell_type": "code",
|
| 2720 |
+
"execution_count": 36,
|
| 2721 |
+
"metadata": {},
|
| 2722 |
+
"outputs": [
|
| 2723 |
+
{
|
| 2724 |
+
"data": {
|
| 2725 |
+
"text/plain": [
|
| 2726 |
+
"data_source 1\n",
|
| 2727 |
+
"kingdom 3\n",
|
| 2728 |
+
"phylum 49\n",
|
| 2729 |
+
"class 119\n",
|
| 2730 |
+
"order 679\n",
|
| 2731 |
+
"family 5446\n",
|
| 2732 |
+
"genus 89115\n",
|
| 2733 |
+
"species 180738\n",
|
| 2734 |
+
"common 518118\n",
|
| 2735 |
+
"dtype: int64"
|
| 2736 |
+
]
|
| 2737 |
+
},
|
| 2738 |
+
"execution_count": 36,
|
| 2739 |
+
"metadata": {},
|
| 2740 |
+
"output_type": "execute_result"
|
| 2741 |
+
}
|
| 2742 |
+
],
|
| 2743 |
+
"source": [
|
| 2744 |
+
"eol_df.nunique()"
|
| 2745 |
+
]
|
| 2746 |
+
},
|
| 2747 |
+
{
|
| 2748 |
+
"cell_type": "code",
|
| 2749 |
+
"execution_count": 45,
|
| 2750 |
+
"metadata": {},
|
| 2751 |
+
"outputs": [
|
| 2752 |
+
{
|
| 2753 |
+
"data": {
|
| 2754 |
+
"text/plain": [
|
| 2755 |
+
"data_source 1\n",
|
| 2756 |
+
"kingdom 3\n",
|
| 2757 |
+
"phylum 31\n",
|
| 2758 |
+
"class 66\n",
|
| 2759 |
+
"order 284\n",
|
| 2760 |
+
"family 1480\n",
|
| 2761 |
+
"genus 48126\n",
|
| 2762 |
+
"species 0\n",
|
| 2763 |
+
"common 148959\n",
|
| 2764 |
+
"duplicate 2\n",
|
| 2765 |
+
"dtype: int64"
|
| 2766 |
+
]
|
| 2767 |
+
},
|
| 2768 |
+
"execution_count": 45,
|
| 2769 |
+
"metadata": {},
|
| 2770 |
+
"output_type": "execute_result"
|
| 2771 |
+
}
|
| 2772 |
+
],
|
| 2773 |
+
"source": [
|
| 2774 |
+
"eol_df.loc[eol_df.species.isna()].nunique()"
|
| 2775 |
+
]
|
| 2776 |
+
},
|
| 2777 |
+
{
|
| 2778 |
+
"cell_type": "markdown",
|
| 2779 |
+
"metadata": {},
|
| 2780 |
+
"source": [
|
| 2781 |
+
"There are 570,515 unique page IDs from EOL, which clearly represent varying levels of taxa.\n",
|
| 2782 |
+
"\n",
|
| 2783 |
+
"Unique species + unique common where species is null does not reach this number."
|
| 2784 |
+
]
|
| 2785 |
+
},
|
| 2786 |
+
{
|
| 2787 |
+
"cell_type": "code",
|
| 2788 |
+
"execution_count": 37,
|
| 2789 |
+
"metadata": {},
|
| 2790 |
+
"outputs": [
|
| 2791 |
+
{
|
| 2792 |
+
"data": {
|
| 2793 |
+
"text/plain": [
|
| 2794 |
+
"kingdom\n",
|
| 2795 |
+
"Metazoa 2207522\n",
|
| 2796 |
+
"Archaeplastida 1481804\n",
|
| 2797 |
+
"Fungi 230077\n",
|
| 2798 |
+
"Name: count, dtype: int64"
|
| 2799 |
+
]
|
| 2800 |
+
},
|
| 2801 |
+
"execution_count": 37,
|
| 2802 |
+
"metadata": {},
|
| 2803 |
+
"output_type": "execute_result"
|
| 2804 |
+
}
|
| 2805 |
+
],
|
| 2806 |
+
"source": [
|
| 2807 |
+
"eol_df['kingdom'].value_counts()"
|
| 2808 |
+
]
|
| 2809 |
+
},
|
| 2810 |
+
{
|
| 2811 |
+
"cell_type": "markdown",
|
| 2812 |
+
"metadata": {},
|
| 2813 |
+
"source": [
|
| 2814 |
+
"EOL uses `Metazoa` and `Archaeplastida` in place of `Animalia` and `Plantae`, respectively. These designations will need to be merged.\n",
|
| 2815 |
+
"\n",
|
| 2816 |
+
"We have already observed that not all ranks are filled in at the higher levels, sometimes having just one gap. It seems this is particularly common for `class` (it has the least non-null values of any taxa by far)."
|
| 2817 |
+
]
|
| 2818 |
+
},
|
| 2819 |
+
{
|
| 2820 |
+
"cell_type": "code",
|
| 2821 |
+
"execution_count": 38,
|
| 2822 |
+
"metadata": {},
|
| 2823 |
+
"outputs": [
|
| 2824 |
+
{
|
| 2825 |
+
"name": "stderr",
|
| 2826 |
+
"output_type": "stream",
|
| 2827 |
+
"text": [
|
| 2828 |
+
"/tmp/ipykernel_414099/52183210.py:2: SettingWithCopyWarning: \n",
|
| 2829 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 2830 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 2831 |
+
"\n",
|
| 2832 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 2833 |
+
" eol_df['duplicate'] = eol_df.duplicated(subset = taxa, keep = 'first')\n"
|
| 2834 |
+
]
|
| 2835 |
+
}
|
| 2836 |
+
],
|
| 2837 |
+
"source": [
|
| 2838 |
+
"#number of unique 7-tuples in EOL\n",
|
| 2839 |
+
"eol_df['duplicate'] = eol_df.duplicated(subset = taxa, keep = 'first')\n",
|
| 2840 |
+
"eol_df_unique_taxa = eol_df.loc[~eol_df['duplicate']]"
|
| 2841 |
+
]
|
| 2842 |
+
},
|
| 2843 |
+
{
|
| 2844 |
+
"cell_type": "code",
|
| 2845 |
+
"execution_count": 39,
|
| 2846 |
+
"metadata": {},
|
| 2847 |
+
"outputs": [
|
| 2848 |
+
{
|
| 2849 |
+
"name": "stdout",
|
| 2850 |
+
"output_type": "stream",
|
| 2851 |
+
"text": [
|
| 2852 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 2853 |
+
"Index: 422190 entries, 0 to 10436512\n",
|
| 2854 |
+
"Data columns (total 10 columns):\n",
|
| 2855 |
+
" # Column Non-Null Count Dtype \n",
|
| 2856 |
+
"--- ------ -------------- ----- \n",
|
| 2857 |
+
" 0 data_source 422190 non-null object\n",
|
| 2858 |
+
" 1 kingdom 256471 non-null object\n",
|
| 2859 |
+
" 2 phylum 256242 non-null object\n",
|
| 2860 |
+
" 3 class 192666 non-null object\n",
|
| 2861 |
+
" 4 order 253217 non-null object\n",
|
| 2862 |
+
" 5 family 255792 non-null object\n",
|
| 2863 |
+
" 6 genus 421118 non-null object\n",
|
| 2864 |
+
" 7 species 372306 non-null object\n",
|
| 2865 |
+
" 8 common 422190 non-null object\n",
|
| 2866 |
+
" 9 duplicate 422190 non-null bool \n",
|
| 2867 |
+
"dtypes: bool(1), object(9)\n",
|
| 2868 |
+
"memory usage: 32.6+ MB\n"
|
| 2869 |
+
]
|
| 2870 |
+
}
|
| 2871 |
+
],
|
| 2872 |
+
"source": [
|
| 2873 |
+
"eol_df_unique_taxa.info(show_counts = True)"
|
| 2874 |
+
]
|
| 2875 |
+
},
|
| 2876 |
+
{
|
| 2877 |
+
"cell_type": "markdown",
|
| 2878 |
+
"metadata": {},
|
| 2879 |
+
"source": [
|
| 2880 |
+
"The actual number of distinct creatures is likely higher, as evidenced below where we have unique common names listed in `common` but all taxa are null.\n",
|
| 2881 |
+
"\n",
|
| 2882 |
+
"We should be able to fill all in for all values of `species` that also have `genus` indicated. Is `genus` labeled for all entries with `species` labeled? "
|
| 2883 |
+
]
|
| 2884 |
+
},
|
| 2885 |
+
{
|
| 2886 |
+
"cell_type": "code",
|
| 2887 |
+
"execution_count": 40,
|
| 2888 |
+
"metadata": {},
|
| 2889 |
+
"outputs": [
|
| 2890 |
+
{
|
| 2891 |
+
"name": "stdout",
|
| 2892 |
+
"output_type": "stream",
|
| 2893 |
+
"text": [
|
| 2894 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 2895 |
+
"Index: 4408570 entries, 1 to 10436520\n",
|
| 2896 |
+
"Data columns (total 10 columns):\n",
|
| 2897 |
+
" # Column Non-Null Count Dtype \n",
|
| 2898 |
+
"--- ------ -------------- ----- \n",
|
| 2899 |
+
" 0 data_source 4408570 non-null object\n",
|
| 2900 |
+
" 1 kingdom 3562320 non-null object\n",
|
| 2901 |
+
" 2 phylum 3560488 non-null object\n",
|
| 2902 |
+
" 3 class 2496336 non-null object\n",
|
| 2903 |
+
" 4 order 3526489 non-null object\n",
|
| 2904 |
+
" 5 family 3555902 non-null object\n",
|
| 2905 |
+
" 6 genus 4408326 non-null object\n",
|
| 2906 |
+
" 7 species 4408570 non-null object\n",
|
| 2907 |
+
" 8 common 4408570 non-null object\n",
|
| 2908 |
+
" 9 duplicate 4408570 non-null bool \n",
|
| 2909 |
+
"dtypes: bool(1), object(9)\n",
|
| 2910 |
+
"memory usage: 340.6+ MB\n"
|
| 2911 |
+
]
|
| 2912 |
+
}
|
| 2913 |
+
],
|
| 2914 |
+
"source": [
|
| 2915 |
+
"eol_df.loc[eol_df.species.notna()].info(show_counts = True)"
|
| 2916 |
+
]
|
| 2917 |
+
},
|
| 2918 |
+
{
|
| 2919 |
+
"cell_type": "markdown",
|
| 2920 |
+
"metadata": {},
|
| 2921 |
+
"source": [
|
| 2922 |
+
"It looks like we do have just under 250 images for which there's a `species` label, but no `genus` label. This is a sufficiently low number that we could go in to manually check them and hopefully match the the proper higher taxonomic ranks (considering some species names get reused across different genera)."
|
| 2923 |
+
]
|
| 2924 |
+
},
|
| 2925 |
+
{
|
| 2926 |
+
"cell_type": "markdown",
|
| 2927 |
+
"metadata": {},
|
| 2928 |
+
"source": [
|
| 2929 |
+
"Let's get a quick sample of the `common` column for images both with and without `species` labels. "
|
| 2930 |
+
]
|
| 2931 |
+
},
|
| 2932 |
+
{
|
| 2933 |
+
"cell_type": "code",
|
| 2934 |
+
"execution_count": 41,
|
| 2935 |
+
"metadata": {},
|
| 2936 |
+
"outputs": [
|
| 2937 |
+
{
|
| 2938 |
+
"data": {
|
| 2939 |
+
"text/html": [
|
| 2940 |
+
"<div>\n",
|
| 2941 |
+
"<style scoped>\n",
|
| 2942 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 2943 |
+
" vertical-align: middle;\n",
|
| 2944 |
+
" }\n",
|
| 2945 |
+
"\n",
|
| 2946 |
+
" .dataframe tbody tr th {\n",
|
| 2947 |
+
" vertical-align: top;\n",
|
| 2948 |
+
" }\n",
|
| 2949 |
+
"\n",
|
| 2950 |
+
" .dataframe thead th {\n",
|
| 2951 |
+
" text-align: right;\n",
|
| 2952 |
+
" }\n",
|
| 2953 |
+
"</style>\n",
|
| 2954 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 2955 |
+
" <thead>\n",
|
| 2956 |
+
" <tr style=\"text-align: right;\">\n",
|
| 2957 |
+
" <th></th>\n",
|
| 2958 |
+
" <th>data_source</th>\n",
|
| 2959 |
+
" <th>kingdom</th>\n",
|
| 2960 |
+
" <th>phylum</th>\n",
|
| 2961 |
+
" <th>class</th>\n",
|
| 2962 |
+
" <th>order</th>\n",
|
| 2963 |
+
" <th>family</th>\n",
|
| 2964 |
+
" <th>genus</th>\n",
|
| 2965 |
+
" <th>species</th>\n",
|
| 2966 |
+
" <th>common</th>\n",
|
| 2967 |
+
" <th>duplicate</th>\n",
|
| 2968 |
+
" </tr>\n",
|
| 2969 |
+
" </thead>\n",
|
| 2970 |
+
" <tbody>\n",
|
| 2971 |
+
" <tr>\n",
|
| 2972 |
+
" <th>7109927</th>\n",
|
| 2973 |
+
" <td>EOL</td>\n",
|
| 2974 |
+
" <td>Archaeplastida</td>\n",
|
| 2975 |
+
" <td>Tracheophyta</td>\n",
|
| 2976 |
+
" <td>NaN</td>\n",
|
| 2977 |
+
" <td>Fabales</td>\n",
|
| 2978 |
+
" <td>Polygalaceae</td>\n",
|
| 2979 |
+
" <td>Polygala</td>\n",
|
| 2980 |
+
" <td>leendertziae</td>\n",
|
| 2981 |
+
" <td>Polygala leendertziae</td>\n",
|
| 2982 |
+
" <td>True</td>\n",
|
| 2983 |
+
" </tr>\n",
|
| 2984 |
+
" <tr>\n",
|
| 2985 |
+
" <th>1169608</th>\n",
|
| 2986 |
+
" <td>EOL</td>\n",
|
| 2987 |
+
" <td>Fungi</td>\n",
|
| 2988 |
+
" <td>Ascomycota</td>\n",
|
| 2989 |
+
" <td>Eurotiomycetes</td>\n",
|
| 2990 |
+
" <td>Pyrenulales</td>\n",
|
| 2991 |
+
" <td>Pyrenulaceae</td>\n",
|
| 2992 |
+
" <td>Pyrenula</td>\n",
|
| 2993 |
+
" <td>dermatodes</td>\n",
|
| 2994 |
+
" <td>Pyrenula dermatodes</td>\n",
|
| 2995 |
+
" <td>True</td>\n",
|
| 2996 |
+
" </tr>\n",
|
| 2997 |
+
" <tr>\n",
|
| 2998 |
+
" <th>2955438</th>\n",
|
| 2999 |
+
" <td>EOL</td>\n",
|
| 3000 |
+
" <td>Archaeplastida</td>\n",
|
| 3001 |
+
" <td>Tracheophyta</td>\n",
|
| 3002 |
+
" <td>NaN</td>\n",
|
| 3003 |
+
" <td>Magnoliales</td>\n",
|
| 3004 |
+
" <td>Annonaceae</td>\n",
|
| 3005 |
+
" <td>Asimina</td>\n",
|
| 3006 |
+
" <td>obovata</td>\n",
|
| 3007 |
+
" <td>bigflower pawpaw</td>\n",
|
| 3008 |
+
" <td>True</td>\n",
|
| 3009 |
+
" </tr>\n",
|
| 3010 |
+
" <tr>\n",
|
| 3011 |
+
" <th>1551580</th>\n",
|
| 3012 |
+
" <td>EOL</td>\n",
|
| 3013 |
+
" <td>NaN</td>\n",
|
| 3014 |
+
" <td>NaN</td>\n",
|
| 3015 |
+
" <td>NaN</td>\n",
|
| 3016 |
+
" <td>NaN</td>\n",
|
| 3017 |
+
" <td>NaN</td>\n",
|
| 3018 |
+
" <td>Numenius</td>\n",
|
| 3019 |
+
" <td>hudsonicus</td>\n",
|
| 3020 |
+
" <td>Numenius hudsonicus</td>\n",
|
| 3021 |
+
" <td>True</td>\n",
|
| 3022 |
+
" </tr>\n",
|
| 3023 |
+
" <tr>\n",
|
| 3024 |
+
" <th>3845702</th>\n",
|
| 3025 |
+
" <td>EOL</td>\n",
|
| 3026 |
+
" <td>NaN</td>\n",
|
| 3027 |
+
" <td>NaN</td>\n",
|
| 3028 |
+
" <td>NaN</td>\n",
|
| 3029 |
+
" <td>NaN</td>\n",
|
| 3030 |
+
" <td>NaN</td>\n",
|
| 3031 |
+
" <td>Urtica</td>\n",
|
| 3032 |
+
" <td>gracilis holosericea</td>\n",
|
| 3033 |
+
" <td>stinging nettle</td>\n",
|
| 3034 |
+
" <td>True</td>\n",
|
| 3035 |
+
" </tr>\n",
|
| 3036 |
+
" <tr>\n",
|
| 3037 |
+
" <th>3499959</th>\n",
|
| 3038 |
+
" <td>EOL</td>\n",
|
| 3039 |
+
" <td>Metazoa</td>\n",
|
| 3040 |
+
" <td>Chordata</td>\n",
|
| 3041 |
+
" <td>Gnathostomata</td>\n",
|
| 3042 |
+
" <td>Gymnophiona</td>\n",
|
| 3043 |
+
" <td>Ichthyophiidae</td>\n",
|
| 3044 |
+
" <td>Ichthyophis</td>\n",
|
| 3045 |
+
" <td>bombayensis</td>\n",
|
| 3046 |
+
" <td>Bombay Caecilian</td>\n",
|
| 3047 |
+
" <td>True</td>\n",
|
| 3048 |
+
" </tr>\n",
|
| 3049 |
+
" <tr>\n",
|
| 3050 |
+
" <th>4155103</th>\n",
|
| 3051 |
+
" <td>EOL</td>\n",
|
| 3052 |
+
" <td>Fungi</td>\n",
|
| 3053 |
+
" <td>Basidiomycota</td>\n",
|
| 3054 |
+
" <td>Agaricomycetes</td>\n",
|
| 3055 |
+
" <td>Boletales</td>\n",
|
| 3056 |
+
" <td>Suillaceae</td>\n",
|
| 3057 |
+
" <td>Suillus</td>\n",
|
| 3058 |
+
" <td>placidus</td>\n",
|
| 3059 |
+
" <td>Slippery white bolete</td>\n",
|
| 3060 |
+
" <td>True</td>\n",
|
| 3061 |
+
" </tr>\n",
|
| 3062 |
+
" </tbody>\n",
|
| 3063 |
+
"</table>\n",
|
| 3064 |
+
"</div>"
|
| 3065 |
+
],
|
| 3066 |
+
"text/plain": [
|
| 3067 |
+
" data_source kingdom phylum class \\\n",
|
| 3068 |
+
"7109927 EOL Archaeplastida Tracheophyta NaN \n",
|
| 3069 |
+
"1169608 EOL Fungi Ascomycota Eurotiomycetes \n",
|
| 3070 |
+
"2955438 EOL Archaeplastida Tracheophyta NaN \n",
|
| 3071 |
+
"1551580 EOL NaN NaN NaN \n",
|
| 3072 |
+
"3845702 EOL NaN NaN NaN \n",
|
| 3073 |
+
"3499959 EOL Metazoa Chordata Gnathostomata \n",
|
| 3074 |
+
"4155103 EOL Fungi Basidiomycota Agaricomycetes \n",
|
| 3075 |
+
"\n",
|
| 3076 |
+
" order family genus species \\\n",
|
| 3077 |
+
"7109927 Fabales Polygalaceae Polygala leendertziae \n",
|
| 3078 |
+
"1169608 Pyrenulales Pyrenulaceae Pyrenula dermatodes \n",
|
| 3079 |
+
"2955438 Magnoliales Annonaceae Asimina obovata \n",
|
| 3080 |
+
"1551580 NaN NaN Numenius hudsonicus \n",
|
| 3081 |
+
"3845702 NaN NaN Urtica gracilis holosericea \n",
|
| 3082 |
+
"3499959 Gymnophiona Ichthyophiidae Ichthyophis bombayensis \n",
|
| 3083 |
+
"4155103 Boletales Suillaceae Suillus placidus \n",
|
| 3084 |
+
"\n",
|
| 3085 |
+
" common duplicate \n",
|
| 3086 |
+
"7109927 Polygala leendertziae True \n",
|
| 3087 |
+
"1169608 Pyrenula dermatodes True \n",
|
| 3088 |
+
"2955438 bigflower pawpaw True \n",
|
| 3089 |
+
"1551580 Numenius hudsonicus True \n",
|
| 3090 |
+
"3845702 stinging nettle True \n",
|
| 3091 |
+
"3499959 Bombay Caecilian True \n",
|
| 3092 |
+
"4155103 Slippery white bolete True "
|
| 3093 |
+
]
|
| 3094 |
+
},
|
| 3095 |
+
"execution_count": 41,
|
| 3096 |
+
"metadata": {},
|
| 3097 |
+
"output_type": "execute_result"
|
| 3098 |
+
}
|
| 3099 |
+
],
|
| 3100 |
+
"source": [
|
| 3101 |
+
"# existing species label\n",
|
| 3102 |
+
"eol_df.loc[eol_df.species.notna()].sample(7)"
|
| 3103 |
+
]
|
| 3104 |
+
},
|
| 3105 |
+
{
|
| 3106 |
+
"cell_type": "markdown",
|
| 3107 |
+
"metadata": {},
|
| 3108 |
+
"source": [
|
| 3109 |
+
"Good, some of these do have common names. We could check numbers of `common` where it doesn't match the `genus-species` form for a better count, but our random sample is promising."
|
| 3110 |
+
]
|
| 3111 |
+
},
|
| 3112 |
+
{
|
| 3113 |
+
"cell_type": "code",
|
| 3114 |
+
"execution_count": 42,
|
| 3115 |
+
"metadata": {},
|
| 3116 |
+
"outputs": [
|
| 3117 |
+
{
|
| 3118 |
+
"data": {
|
| 3119 |
+
"text/html": [
|
| 3120 |
+
"<div>\n",
|
| 3121 |
+
"<style scoped>\n",
|
| 3122 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 3123 |
+
" vertical-align: middle;\n",
|
| 3124 |
+
" }\n",
|
| 3125 |
+
"\n",
|
| 3126 |
+
" .dataframe tbody tr th {\n",
|
| 3127 |
+
" vertical-align: top;\n",
|
| 3128 |
+
" }\n",
|
| 3129 |
+
"\n",
|
| 3130 |
+
" .dataframe thead th {\n",
|
| 3131 |
+
" text-align: right;\n",
|
| 3132 |
+
" }\n",
|
| 3133 |
+
"</style>\n",
|
| 3134 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 3135 |
+
" <thead>\n",
|
| 3136 |
+
" <tr style=\"text-align: right;\">\n",
|
| 3137 |
+
" <th></th>\n",
|
| 3138 |
+
" <th>data_source</th>\n",
|
| 3139 |
+
" <th>kingdom</th>\n",
|
| 3140 |
+
" <th>phylum</th>\n",
|
| 3141 |
+
" <th>class</th>\n",
|
| 3142 |
+
" <th>order</th>\n",
|
| 3143 |
+
" <th>family</th>\n",
|
| 3144 |
+
" <th>genus</th>\n",
|
| 3145 |
+
" <th>species</th>\n",
|
| 3146 |
+
" <th>common</th>\n",
|
| 3147 |
+
" <th>duplicate</th>\n",
|
| 3148 |
+
" </tr>\n",
|
| 3149 |
+
" </thead>\n",
|
| 3150 |
+
" <tbody>\n",
|
| 3151 |
+
" <tr>\n",
|
| 3152 |
+
" <th>2635269</th>\n",
|
| 3153 |
+
" <td>EOL</td>\n",
|
| 3154 |
+
" <td>NaN</td>\n",
|
| 3155 |
+
" <td>NaN</td>\n",
|
| 3156 |
+
" <td>NaN</td>\n",
|
| 3157 |
+
" <td>NaN</td>\n",
|
| 3158 |
+
" <td>NaN</td>\n",
|
| 3159 |
+
" <td>NaN</td>\n",
|
| 3160 |
+
" <td>NaN</td>\n",
|
| 3161 |
+
" <td>tāranga</td>\n",
|
| 3162 |
+
" <td>True</td>\n",
|
| 3163 |
+
" </tr>\n",
|
| 3164 |
+
" <tr>\n",
|
| 3165 |
+
" <th>4404459</th>\n",
|
| 3166 |
+
" <td>EOL</td>\n",
|
| 3167 |
+
" <td>NaN</td>\n",
|
| 3168 |
+
" <td>NaN</td>\n",
|
| 3169 |
+
" <td>NaN</td>\n",
|
| 3170 |
+
" <td>NaN</td>\n",
|
| 3171 |
+
" <td>NaN</td>\n",
|
| 3172 |
+
" <td>NaN</td>\n",
|
| 3173 |
+
" <td>NaN</td>\n",
|
| 3174 |
+
" <td>Trans-Pecos thimblehead</td>\n",
|
| 3175 |
+
" <td>True</td>\n",
|
| 3176 |
+
" </tr>\n",
|
| 3177 |
+
" <tr>\n",
|
| 3178 |
+
" <th>575560</th>\n",
|
| 3179 |
+
" <td>EOL</td>\n",
|
| 3180 |
+
" <td>NaN</td>\n",
|
| 3181 |
+
" <td>NaN</td>\n",
|
| 3182 |
+
" <td>NaN</td>\n",
|
| 3183 |
+
" <td>NaN</td>\n",
|
| 3184 |
+
" <td>NaN</td>\n",
|
| 3185 |
+
" <td>NaN</td>\n",
|
| 3186 |
+
" <td>NaN</td>\n",
|
| 3187 |
+
" <td>Cremastobaeus</td>\n",
|
| 3188 |
+
" <td>True</td>\n",
|
| 3189 |
+
" </tr>\n",
|
| 3190 |
+
" <tr>\n",
|
| 3191 |
+
" <th>456164</th>\n",
|
| 3192 |
+
" <td>EOL</td>\n",
|
| 3193 |
+
" <td>NaN</td>\n",
|
| 3194 |
+
" <td>NaN</td>\n",
|
| 3195 |
+
" <td>NaN</td>\n",
|
| 3196 |
+
" <td>NaN</td>\n",
|
| 3197 |
+
" <td>NaN</td>\n",
|
| 3198 |
+
" <td>NaN</td>\n",
|
| 3199 |
+
" <td>NaN</td>\n",
|
| 3200 |
+
" <td>American red raspberry</td>\n",
|
| 3201 |
+
" <td>True</td>\n",
|
| 3202 |
+
" </tr>\n",
|
| 3203 |
+
" <tr>\n",
|
| 3204 |
+
" <th>10332391</th>\n",
|
| 3205 |
+
" <td>EOL</td>\n",
|
| 3206 |
+
" <td>NaN</td>\n",
|
| 3207 |
+
" <td>NaN</td>\n",
|
| 3208 |
+
" <td>NaN</td>\n",
|
| 3209 |
+
" <td>NaN</td>\n",
|
| 3210 |
+
" <td>NaN</td>\n",
|
| 3211 |
+
" <td>NaN</td>\n",
|
| 3212 |
+
" <td>NaN</td>\n",
|
| 3213 |
+
" <td>Straight-lined Vaxi Moth</td>\n",
|
| 3214 |
+
" <td>True</td>\n",
|
| 3215 |
+
" </tr>\n",
|
| 3216 |
+
" <tr>\n",
|
| 3217 |
+
" <th>6082438</th>\n",
|
| 3218 |
+
" <td>EOL</td>\n",
|
| 3219 |
+
" <td>NaN</td>\n",
|
| 3220 |
+
" <td>NaN</td>\n",
|
| 3221 |
+
" <td>NaN</td>\n",
|
| 3222 |
+
" <td>NaN</td>\n",
|
| 3223 |
+
" <td>NaN</td>\n",
|
| 3224 |
+
" <td>NaN</td>\n",
|
| 3225 |
+
" <td>NaN</td>\n",
|
| 3226 |
+
" <td>Rock ptarmigan</td>\n",
|
| 3227 |
+
" <td>True</td>\n",
|
| 3228 |
+
" </tr>\n",
|
| 3229 |
+
" <tr>\n",
|
| 3230 |
+
" <th>3443067</th>\n",
|
| 3231 |
+
" <td>EOL</td>\n",
|
| 3232 |
+
" <td>NaN</td>\n",
|
| 3233 |
+
" <td>NaN</td>\n",
|
| 3234 |
+
" <td>NaN</td>\n",
|
| 3235 |
+
" <td>NaN</td>\n",
|
| 3236 |
+
" <td>NaN</td>\n",
|
| 3237 |
+
" <td>NaN</td>\n",
|
| 3238 |
+
" <td>NaN</td>\n",
|
| 3239 |
+
" <td>Catapion meieri</td>\n",
|
| 3240 |
+
" <td>True</td>\n",
|
| 3241 |
+
" </tr>\n",
|
| 3242 |
+
" </tbody>\n",
|
| 3243 |
+
"</table>\n",
|
| 3244 |
+
"</div>"
|
| 3245 |
+
],
|
| 3246 |
+
"text/plain": [
|
| 3247 |
+
" data_source kingdom phylum class order family genus species \\\n",
|
| 3248 |
+
"2635269 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3249 |
+
"4404459 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3250 |
+
"575560 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3251 |
+
"456164 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3252 |
+
"10332391 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3253 |
+
"6082438 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3254 |
+
"3443067 EOL NaN NaN NaN NaN NaN NaN NaN \n",
|
| 3255 |
+
"\n",
|
| 3256 |
+
" common duplicate \n",
|
| 3257 |
+
"2635269 tāranga True \n",
|
| 3258 |
+
"4404459 Trans-Pecos thimblehead True \n",
|
| 3259 |
+
"575560 Cremastobaeus True \n",
|
| 3260 |
+
"456164 American red raspberry True \n",
|
| 3261 |
+
"10332391 Straight-lined Vaxi Moth True \n",
|
| 3262 |
+
"6082438 Rock ptarmigan True \n",
|
| 3263 |
+
"3443067 Catapion meieri True "
|
| 3264 |
+
]
|
| 3265 |
+
},
|
| 3266 |
+
"execution_count": 42,
|
| 3267 |
+
"metadata": {},
|
| 3268 |
+
"output_type": "execute_result"
|
| 3269 |
+
}
|
| 3270 |
+
],
|
| 3271 |
+
"source": [
|
| 3272 |
+
"# No species label\n",
|
| 3273 |
+
"eol_df.loc[eol_df.species.isna()].sample(7)"
|
| 3274 |
+
]
|
| 3275 |
+
},
|
| 3276 |
+
{
|
| 3277 |
+
"cell_type": "markdown",
|
| 3278 |
+
"metadata": {},
|
| 3279 |
+
"source": [
|
| 3280 |
+
"All `common` values are filled in with predominently common names. It seems we could map these back to some level of taxa with the taxon-common matching? Though why would these EOL images have common without any other designation?\n",
|
| 3281 |
+
"\n",
|
| 3282 |
+
"Good example of strange inconsistency: the `American red raspberry` is `Rubus strigosus`, and a quick Google search easily provides the entire taxonomy.\n",
|
| 3283 |
+
"\n",
|
| 3284 |
+
"`Cremastobaeus` seems to be a genus of wasp."
|
| 3285 |
+
]
|
| 3286 |
+
},
|
| 3287 |
+
{
|
| 3288 |
+
"cell_type": "markdown",
|
| 3289 |
+
"metadata": {},
|
| 3290 |
+
"source": [
|
| 3291 |
+
"Let's check the `species` length in EOL as well, we know there are some that have genus-species."
|
| 3292 |
+
]
|
| 3293 |
+
},
|
| 3294 |
+
{
|
| 3295 |
+
"cell_type": "code",
|
| 3296 |
+
"execution_count": 18,
|
| 3297 |
+
"metadata": {},
|
| 3298 |
+
"outputs": [
|
| 3299 |
+
{
|
| 3300 |
+
"name": "stderr",
|
| 3301 |
+
"output_type": "stream",
|
| 3302 |
+
"text": [
|
| 3303 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_65691/1392676569.py:16: SettingWithCopyWarning: \n",
|
| 3304 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 3305 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 3306 |
+
"\n",
|
| 3307 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 3308 |
+
" df[\"len_species\"] = 1\n"
|
| 3309 |
+
]
|
| 3310 |
+
},
|
| 3311 |
+
{
|
| 3312 |
+
"name": "stdout",
|
| 3313 |
+
"output_type": "stream",
|
| 3314 |
+
"text": [
|
| 3315 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 3316 |
+
"Index: 6621365 entries, 0 to 10436520\n",
|
| 3317 |
+
"Data columns (total 10 columns):\n",
|
| 3318 |
+
" # Column Non-Null Count Dtype \n",
|
| 3319 |
+
"--- ------ -------------- ----- \n",
|
| 3320 |
+
" 0 data_source 6621365 non-null object\n",
|
| 3321 |
+
" 1 kingdom 3919403 non-null object\n",
|
| 3322 |
+
" 2 phylum 3917533 non-null object\n",
|
| 3323 |
+
" 3 class 2842328 non-null object\n",
|
| 3324 |
+
" 4 order 3875193 non-null object\n",
|
| 3325 |
+
" 5 family 3906994 non-null object\n",
|
| 3326 |
+
" 6 genus 5119837 non-null object\n",
|
| 3327 |
+
" 7 species 4408570 non-null object\n",
|
| 3328 |
+
" 8 common 6621365 non-null object\n",
|
| 3329 |
+
" 9 len_species 6621365 non-null int64 \n",
|
| 3330 |
+
"dtypes: int64(1), object(9)\n",
|
| 3331 |
+
"memory usage: 555.7+ MB\n"
|
| 3332 |
]
|
| 3333 |
}
|
| 3334 |
],
|
| 3335 |
"source": [
|
| 3336 |
+
"eol_species_len = check_sci_name(eol_df)\n",
|
| 3337 |
+
"eol_species_len.info(show_counts = True)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3338 |
]
|
| 3339 |
},
|
| 3340 |
{
|
| 3341 |
"cell_type": "code",
|
| 3342 |
+
"execution_count": 19,
|
| 3343 |
"metadata": {},
|
| 3344 |
"outputs": [
|
| 3345 |
{
|
|
|
|
| 3347 |
"output_type": "stream",
|
| 3348 |
"text": [
|
| 3349 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 3350 |
+
"Index: 670683 entries, 13 to 10436519\n",
|
| 3351 |
"Data columns (total 10 columns):\n",
|
| 3352 |
+
" # Column Non-Null Count Dtype \n",
|
| 3353 |
+
"--- ------ -------------- ----- \n",
|
| 3354 |
+
" 0 data_source 670683 non-null object\n",
|
| 3355 |
+
" 1 kingdom 129237 non-null object\n",
|
| 3356 |
+
" 2 phylum 129231 non-null object\n",
|
| 3357 |
+
" 3 class 101987 non-null object\n",
|
| 3358 |
+
" 4 order 129237 non-null object\n",
|
| 3359 |
+
" 5 family 129114 non-null object\n",
|
| 3360 |
+
" 6 genus 670439 non-null object\n",
|
| 3361 |
+
" 7 species 670683 non-null object\n",
|
| 3362 |
+
" 8 common 670683 non-null object\n",
|
| 3363 |
+
" 9 len_species 670683 non-null int64 \n",
|
| 3364 |
+
"dtypes: int64(1), object(9)\n",
|
| 3365 |
+
"memory usage: 56.3+ MB\n"
|
| 3366 |
]
|
| 3367 |
}
|
| 3368 |
],
|
| 3369 |
"source": [
|
| 3370 |
+
"eol_long_species = eol_species_len.loc[eol_species_len[\"len_species\"] > 1]\n",
|
| 3371 |
+
"eol_long_species.info(show_counts = True)"
|
| 3372 |
]
|
| 3373 |
},
|
| 3374 |
{
|
| 3375 |
+
"cell_type": "code",
|
| 3376 |
+
"execution_count": 20,
|
| 3377 |
"metadata": {},
|
| 3378 |
+
"outputs": [
|
| 3379 |
+
{
|
| 3380 |
+
"data": {
|
| 3381 |
+
"text/plain": [
|
| 3382 |
+
"len_species\n",
|
| 3383 |
+
"2 534380\n",
|
| 3384 |
+
"3 95127\n",
|
| 3385 |
+
"4 20029\n",
|
| 3386 |
+
"5 13807\n",
|
| 3387 |
+
"7 3820\n",
|
| 3388 |
+
"6 2043\n",
|
| 3389 |
+
"9 583\n",
|
| 3390 |
+
"8 447\n",
|
| 3391 |
+
"10 195\n",
|
| 3392 |
+
"11 95\n",
|
| 3393 |
+
"13 44\n",
|
| 3394 |
+
"15 31\n",
|
| 3395 |
+
"12 28\n",
|
| 3396 |
+
"16 16\n",
|
| 3397 |
+
"14 8\n",
|
| 3398 |
+
"36 7\n",
|
| 3399 |
+
"17 6\n",
|
| 3400 |
+
"21 6\n",
|
| 3401 |
+
"18 5\n",
|
| 3402 |
+
"22 3\n",
|
| 3403 |
+
"50 1\n",
|
| 3404 |
+
"26 1\n",
|
| 3405 |
+
"19 1\n",
|
| 3406 |
+
"Name: count, dtype: int64"
|
| 3407 |
+
]
|
| 3408 |
+
},
|
| 3409 |
+
"execution_count": 20,
|
| 3410 |
+
"metadata": {},
|
| 3411 |
+
"output_type": "execute_result"
|
| 3412 |
+
}
|
| 3413 |
+
],
|
| 3414 |
"source": [
|
| 3415 |
+
"eol_long_species.len_species.value_counts()"
|
| 3416 |
]
|
| 3417 |
},
|
| 3418 |
{
|
| 3419 |
"cell_type": "markdown",
|
| 3420 |
"metadata": {},
|
| 3421 |
"source": [
|
| 3422 |
+
"That's quite a lot, and why are some so long?!"
|
| 3423 |
]
|
| 3424 |
},
|
| 3425 |
{
|
| 3426 |
"cell_type": "code",
|
| 3427 |
+
"execution_count": 21,
|
| 3428 |
"metadata": {},
|
| 3429 |
"outputs": [
|
| 3430 |
{
|
|
|
|
| 3457 |
" <th>genus</th>\n",
|
| 3458 |
" <th>species</th>\n",
|
| 3459 |
" <th>common</th>\n",
|
| 3460 |
+
" <th>len_species</th>\n",
|
| 3461 |
" </tr>\n",
|
| 3462 |
" </thead>\n",
|
| 3463 |
" <tbody>\n",
|
| 3464 |
" <tr>\n",
|
| 3465 |
+
" <th>6442342</th>\n",
|
| 3466 |
" <td>EOL</td>\n",
|
|
|
|
|
|
|
| 3467 |
" <td>NaN</td>\n",
|
| 3468 |
+
" <td>NaN</td>\n",
|
| 3469 |
+
" <td>NaN</td>\n",
|
| 3470 |
+
" <td>NaN</td>\n",
|
| 3471 |
+
" <td>NaN</td>\n",
|
| 3472 |
+
" <td>Echinocereus</td>\n",
|
| 3473 |
+
" <td>engelmannii subsp. fasciculatus (engelm. ex wa...</td>\n",
|
| 3474 |
+
" <td>Echinocereus engelmannii subsp. fasciculatus (...</td>\n",
|
| 3475 |
+
" <td>9</td>\n",
|
| 3476 |
" </tr>\n",
|
| 3477 |
" <tr>\n",
|
| 3478 |
+
" <th>4033534</th>\n",
|
| 3479 |
" <td>EOL</td>\n",
|
| 3480 |
+
" <td>NaN</td>\n",
|
| 3481 |
+
" <td>NaN</td>\n",
|
| 3482 |
+
" <td>NaN</td>\n",
|
| 3483 |
+
" <td>NaN</td>\n",
|
| 3484 |
+
" <td>NaN</td>\n",
|
| 3485 |
+
" <td>Amanita</td>\n",
|
| 3486 |
+
" <td>pseudobreckonii n. siegel & c.f. schwarz nom. ...</td>\n",
|
| 3487 |
+
" <td>Amanita pseudobreckonii N. Siegel & C.F. Schwa...</td>\n",
|
| 3488 |
+
" <td>8</td>\n",
|
| 3489 |
" </tr>\n",
|
| 3490 |
" <tr>\n",
|
| 3491 |
+
" <th>2942755</th>\n",
|
| 3492 |
" <td>EOL</td>\n",
|
|
|
|
|
|
|
| 3493 |
" <td>NaN</td>\n",
|
| 3494 |
+
" <td>NaN</td>\n",
|
| 3495 |
+
" <td>NaN</td>\n",
|
| 3496 |
+
" <td>NaN</td>\n",
|
| 3497 |
+
" <td>NaN</td>\n",
|
| 3498 |
+
" <td>Lotus</td>\n",
|
| 3499 |
+
" <td>unifoliolatus (hook.) benth. var. helleri (bri...</td>\n",
|
| 3500 |
+
" <td>Lotus unifoliolatus (Hook.) Benth. var. heller...</td>\n",
|
| 3501 |
+
" <td>9</td>\n",
|
| 3502 |
" </tr>\n",
|
| 3503 |
" <tr>\n",
|
| 3504 |
+
" <th>4229094</th>\n",
|
| 3505 |
" <td>EOL</td>\n",
|
| 3506 |
" <td>NaN</td>\n",
|
| 3507 |
" <td>NaN</td>\n",
|
| 3508 |
" <td>NaN</td>\n",
|
| 3509 |
" <td>NaN</td>\n",
|
| 3510 |
" <td>NaN</td>\n",
|
| 3511 |
+
" <td>Bulinus</td>\n",
|
| 3512 |
+
" <td>versicolor broderip in broderip and sowerby i ...</td>\n",
|
| 3513 |
+
" <td>Bulinus versicolor Broderip in Broderip and So...</td>\n",
|
| 3514 |
+
" <td>8</td>\n",
|
| 3515 |
" </tr>\n",
|
| 3516 |
" <tr>\n",
|
| 3517 |
+
" <th>7151573</th>\n",
|
| 3518 |
" <td>EOL</td>\n",
|
| 3519 |
" <td>NaN</td>\n",
|
| 3520 |
" <td>NaN</td>\n",
|
| 3521 |
" <td>NaN</td>\n",
|
| 3522 |
" <td>NaN</td>\n",
|
| 3523 |
" <td>NaN</td>\n",
|
| 3524 |
+
" <td>Rubus</td>\n",
|
| 3525 |
+
" <td>revealii a. beek & m. p. widrlechner 2021</td>\n",
|
| 3526 |
+
" <td>Rubus revealii A. Beek & M. P. Widrlechner 2021</td>\n",
|
| 3527 |
+
" <td>8</td>\n",
|
| 3528 |
" </tr>\n",
|
| 3529 |
" <tr>\n",
|
| 3530 |
+
" <th>92767</th>\n",
|
| 3531 |
" <td>EOL</td>\n",
|
| 3532 |
+
" <td>NaN</td>\n",
|
| 3533 |
+
" <td>NaN</td>\n",
|
| 3534 |
+
" <td>NaN</td>\n",
|
| 3535 |
+
" <td>NaN</td>\n",
|
| 3536 |
+
" <td>NaN</td>\n",
|
| 3537 |
+
" <td>Scadoxus</td>\n",
|
| 3538 |
+
" <td>multiflorus (martyn) raf. ssp. katherinae (bak...</td>\n",
|
| 3539 |
+
" <td>Scadoxus multiflorus (Martyn) Raf. ssp. kather...</td>\n",
|
| 3540 |
+
" <td>9</td>\n",
|
| 3541 |
" </tr>\n",
|
| 3542 |
" <tr>\n",
|
| 3543 |
+
" <th>7707570</th>\n",
|
| 3544 |
" <td>EOL</td>\n",
|
| 3545 |
+
" <td>NaN</td>\n",
|
| 3546 |
+
" <td>NaN</td>\n",
|
| 3547 |
+
" <td>NaN</td>\n",
|
| 3548 |
+
" <td>NaN</td>\n",
|
| 3549 |
+
" <td>NaN</td>\n",
|
| 3550 |
+
" <td>Heliotropium</td>\n",
|
| 3551 |
+
" <td>baclei dc. & a. dc.<br > var. rostratum i.m. j...</td>\n",
|
| 3552 |
+
" <td>Heliotropium baclei DC. & A. DC.<br > var. ros...</td>\n",
|
| 3553 |
+
" <td>10</td>\n",
|
| 3554 |
" </tr>\n",
|
| 3555 |
" </tbody>\n",
|
| 3556 |
"</table>\n",
|
| 3557 |
"</div>"
|
| 3558 |
],
|
| 3559 |
"text/plain": [
|
| 3560 |
+
" data_source kingdom phylum class order family genus \n",
|
| 3561 |
+
"6442342 EOL NaN NaN NaN NaN NaN Echinocereus \\\n",
|
| 3562 |
+
"4033534 EOL NaN NaN NaN NaN NaN Amanita \n",
|
| 3563 |
+
"2942755 EOL NaN NaN NaN NaN NaN Lotus \n",
|
| 3564 |
+
"4229094 EOL NaN NaN NaN NaN NaN Bulinus \n",
|
| 3565 |
+
"7151573 EOL NaN NaN NaN NaN NaN Rubus \n",
|
| 3566 |
+
"92767 EOL NaN NaN NaN NaN NaN Scadoxus \n",
|
| 3567 |
+
"7707570 EOL NaN NaN NaN NaN NaN Heliotropium \n",
|
| 3568 |
"\n",
|
| 3569 |
+
" species \n",
|
| 3570 |
+
"6442342 engelmannii subsp. fasciculatus (engelm. ex wa... \\\n",
|
| 3571 |
+
"4033534 pseudobreckonii n. siegel & c.f. schwarz nom. ... \n",
|
| 3572 |
+
"2942755 unifoliolatus (hook.) benth. var. helleri (bri... \n",
|
| 3573 |
+
"4229094 versicolor broderip in broderip and sowerby i ... \n",
|
| 3574 |
+
"7151573 revealii a. beek & m. p. widrlechner 2021 \n",
|
| 3575 |
+
"92767 multiflorus (martyn) raf. ssp. katherinae (bak... \n",
|
| 3576 |
+
"7707570 baclei dc. & a. dc.<br > var. rostratum i.m. j... \n",
|
| 3577 |
"\n",
|
| 3578 |
+
" common len_species \n",
|
| 3579 |
+
"6442342 Echinocereus engelmannii subsp. fasciculatus (... 9 \n",
|
| 3580 |
+
"4033534 Amanita pseudobreckonii N. Siegel & C.F. Schwa... 8 \n",
|
| 3581 |
+
"2942755 Lotus unifoliolatus (Hook.) Benth. var. heller... 9 \n",
|
| 3582 |
+
"4229094 Bulinus versicolor Broderip in Broderip and So... 8 \n",
|
| 3583 |
+
"7151573 Rubus revealii A. Beek & M. P. Widrlechner 2021 8 \n",
|
| 3584 |
+
"92767 Scadoxus multiflorus (Martyn) Raf. ssp. kather... 9 \n",
|
| 3585 |
+
"7707570 Heliotropium baclei DC. & A. DC.<br > var. ros... 10 "
|
| 3586 |
]
|
| 3587 |
},
|
| 3588 |
+
"execution_count": 21,
|
| 3589 |
"metadata": {},
|
| 3590 |
"output_type": "execute_result"
|
| 3591 |
}
|
| 3592 |
],
|
| 3593 |
"source": [
|
| 3594 |
+
"eol_long_species.loc[eol_long_species[\"len_species\"] > 7].sample(7)"
|
|
|
|
| 3595 |
]
|
| 3596 |
},
|
| 3597 |
{
|
| 3598 |
+
"cell_type": "code",
|
| 3599 |
+
"execution_count": 22,
|
| 3600 |
"metadata": {},
|
| 3601 |
+
"outputs": [
|
| 3602 |
+
{
|
| 3603 |
+
"data": {
|
| 3604 |
+
"text/plain": [
|
| 3605 |
+
"data_source 1\n",
|
| 3606 |
+
"kingdom 3\n",
|
| 3607 |
+
"phylum 10\n",
|
| 3608 |
+
"class 14\n",
|
| 3609 |
+
"order 97\n",
|
| 3610 |
+
"family 635\n",
|
| 3611 |
+
"genus 18911\n",
|
| 3612 |
+
"species 68321\n",
|
| 3613 |
+
"common 77520\n",
|
| 3614 |
+
"len_species 23\n",
|
| 3615 |
+
"dtype: int64"
|
| 3616 |
+
]
|
| 3617 |
+
},
|
| 3618 |
+
"execution_count": 22,
|
| 3619 |
+
"metadata": {},
|
| 3620 |
+
"output_type": "execute_result"
|
| 3621 |
+
}
|
| 3622 |
+
],
|
| 3623 |
"source": [
|
| 3624 |
+
"eol_long_species.nunique()"
|
| 3625 |
]
|
| 3626 |
},
|
| 3627 |
{
|
| 3628 |
"cell_type": "code",
|
| 3629 |
+
"execution_count": 23,
|
| 3630 |
"metadata": {},
|
| 3631 |
"outputs": [
|
| 3632 |
{
|
|
|
|
| 3659 |
" <th>genus</th>\n",
|
| 3660 |
" <th>species</th>\n",
|
| 3661 |
" <th>common</th>\n",
|
| 3662 |
+
" <th>len_species</th>\n",
|
| 3663 |
" </tr>\n",
|
| 3664 |
" </thead>\n",
|
| 3665 |
" <tbody>\n",
|
| 3666 |
" <tr>\n",
|
| 3667 |
+
" <th>118415</th>\n",
|
| 3668 |
" <td>EOL</td>\n",
|
| 3669 |
" <td>NaN</td>\n",
|
| 3670 |
" <td>NaN</td>\n",
|
| 3671 |
" <td>NaN</td>\n",
|
| 3672 |
" <td>NaN</td>\n",
|
| 3673 |
" <td>NaN</td>\n",
|
| 3674 |
+
" <td>Amida</td>\n",
|
| 3675 |
+
" <td>tricolor formosana weise</td>\n",
|
| 3676 |
+
" <td>Amida tricolor formosana Weise</td>\n",
|
| 3677 |
+
" <td>3</td>\n",
|
| 3678 |
" </tr>\n",
|
| 3679 |
" <tr>\n",
|
| 3680 |
+
" <th>814971</th>\n",
|
| 3681 |
" <td>EOL</td>\n",
|
| 3682 |
" <td>NaN</td>\n",
|
| 3683 |
" <td>NaN</td>\n",
|
| 3684 |
" <td>NaN</td>\n",
|
| 3685 |
" <td>NaN</td>\n",
|
| 3686 |
" <td>NaN</td>\n",
|
| 3687 |
+
" <td>Retifusus</td>\n",
|
| 3688 |
+
" <td>saginatus (tiba</td>\n",
|
| 3689 |
+
" <td>Retifusus saginatus (Tiba</td>\n",
|
| 3690 |
+
" <td>2</td>\n",
|
| 3691 |
" </tr>\n",
|
| 3692 |
" <tr>\n",
|
| 3693 |
+
" <th>8158583</th>\n",
|
| 3694 |
" <td>EOL</td>\n",
|
| 3695 |
" <td>NaN</td>\n",
|
| 3696 |
" <td>NaN</td>\n",
|
| 3697 |
" <td>NaN</td>\n",
|
| 3698 |
" <td>NaN</td>\n",
|
| 3699 |
" <td>NaN</td>\n",
|
| 3700 |
+
" <td>Olearia</td>\n",
|
| 3701 |
+
" <td>rani var. colorata (colenso) kirk</td>\n",
|
| 3702 |
+
" <td>Olearia rani var. colorata (Colenso) Kirk</td>\n",
|
| 3703 |
+
" <td>5</td>\n",
|
| 3704 |
" </tr>\n",
|
| 3705 |
" <tr>\n",
|
| 3706 |
+
" <th>1663463</th>\n",
|
| 3707 |
" <td>EOL</td>\n",
|
| 3708 |
" <td>NaN</td>\n",
|
| 3709 |
" <td>NaN</td>\n",
|
| 3710 |
" <td>NaN</td>\n",
|
| 3711 |
" <td>NaN</td>\n",
|
| 3712 |
" <td>NaN</td>\n",
|
| 3713 |
+
" <td>Speyeria</td>\n",
|
| 3714 |
+
" <td>zerene zerene</td>\n",
|
| 3715 |
+
" <td>Speyeria zerene zerene</td>\n",
|
| 3716 |
+
" <td>2</td>\n",
|
| 3717 |
" </tr>\n",
|
| 3718 |
" <tr>\n",
|
| 3719 |
+
" <th>1362286</th>\n",
|
| 3720 |
" <td>EOL</td>\n",
|
| 3721 |
" <td>NaN</td>\n",
|
| 3722 |
" <td>NaN</td>\n",
|
| 3723 |
" <td>NaN</td>\n",
|
| 3724 |
" <td>NaN</td>\n",
|
| 3725 |
" <td>NaN</td>\n",
|
| 3726 |
+
" <td>Catharylla</td>\n",
|
| 3727 |
+
" <td>coronata t. léger & b. landry</td>\n",
|
| 3728 |
+
" <td>Catharylla coronata T. Léger & B. Landry</td>\n",
|
| 3729 |
+
" <td>6</td>\n",
|
| 3730 |
" </tr>\n",
|
| 3731 |
" <tr>\n",
|
| 3732 |
+
" <th>6482276</th>\n",
|
| 3733 |
" <td>EOL</td>\n",
|
| 3734 |
+
" <td>Archaeplastida</td>\n",
|
| 3735 |
+
" <td>Tracheophyta</td>\n",
|
| 3736 |
" <td>NaN</td>\n",
|
| 3737 |
+
" <td>Piperales</td>\n",
|
| 3738 |
+
" <td>Aristolochiaceae</td>\n",
|
| 3739 |
+
" <td>Asarum</td>\n",
|
| 3740 |
+
" <td>asarum fauriei</td>\n",
|
| 3741 |
+
" <td>Asarum fauriei takaoi</td>\n",
|
| 3742 |
+
" <td>2</td>\n",
|
|
|
|
|
|
|
| 3743 |
" </tr>\n",
|
| 3744 |
" <tr>\n",
|
| 3745 |
+
" <th>7549534</th>\n",
|
| 3746 |
" <td>EOL</td>\n",
|
| 3747 |
+
" <td>Metazoa</td>\n",
|
| 3748 |
+
" <td>Arthropoda</td>\n",
|
| 3749 |
+
" <td>Pancrustacea</td>\n",
|
| 3750 |
+
" <td>Orthoptera</td>\n",
|
| 3751 |
+
" <td>Pyrgomorphidae</td>\n",
|
| 3752 |
+
" <td>Phymateus</td>\n",
|
| 3753 |
+
" <td>phymateus leprosus</td>\n",
|
| 3754 |
+
" <td>Phymateus leprosus leprosus</td>\n",
|
| 3755 |
+
" <td>2</td>\n",
|
| 3756 |
" </tr>\n",
|
| 3757 |
" </tbody>\n",
|
| 3758 |
"</table>\n",
|
| 3759 |
"</div>"
|
| 3760 |
],
|
| 3761 |
"text/plain": [
|
| 3762 |
+
" data_source kingdom phylum class order \n",
|
| 3763 |
+
"118415 EOL NaN NaN NaN NaN \\\n",
|
| 3764 |
+
"814971 EOL NaN NaN NaN NaN \n",
|
| 3765 |
+
"8158583 EOL NaN NaN NaN NaN \n",
|
| 3766 |
+
"1663463 EOL NaN NaN NaN NaN \n",
|
| 3767 |
+
"1362286 EOL NaN NaN NaN NaN \n",
|
| 3768 |
+
"6482276 EOL Archaeplastida Tracheophyta NaN Piperales \n",
|
| 3769 |
+
"7549534 EOL Metazoa Arthropoda Pancrustacea Orthoptera \n",
|
| 3770 |
"\n",
|
| 3771 |
+
" family genus species \n",
|
| 3772 |
+
"118415 NaN Amida tricolor formosana weise \\\n",
|
| 3773 |
+
"814971 NaN Retifusus saginatus (tiba \n",
|
| 3774 |
+
"8158583 NaN Olearia rani var. colorata (colenso) kirk \n",
|
| 3775 |
+
"1663463 NaN Speyeria zerene zerene \n",
|
| 3776 |
+
"1362286 NaN Catharylla coronata t. léger & b. landry \n",
|
| 3777 |
+
"6482276 Aristolochiaceae Asarum asarum fauriei \n",
|
| 3778 |
+
"7549534 Pyrgomorphidae Phymateus phymateus leprosus \n",
|
| 3779 |
+
"\n",
|
| 3780 |
+
" common len_species \n",
|
| 3781 |
+
"118415 Amida tricolor formosana Weise 3 \n",
|
| 3782 |
+
"814971 Retifusus saginatus (Tiba 2 \n",
|
| 3783 |
+
"8158583 Olearia rani var. colorata (Colenso) Kirk 5 \n",
|
| 3784 |
+
"1663463 Speyeria zerene zerene 2 \n",
|
| 3785 |
+
"1362286 Catharylla coronata T. Léger & B. Landry 6 \n",
|
| 3786 |
+
"6482276 Asarum fauriei takaoi 2 \n",
|
| 3787 |
+
"7549534 Phymateus leprosus leprosus 2 "
|
| 3788 |
]
|
| 3789 |
},
|
| 3790 |
+
"execution_count": 23,
|
| 3791 |
"metadata": {},
|
| 3792 |
"output_type": "execute_result"
|
| 3793 |
}
|
| 3794 |
],
|
| 3795 |
"source": [
|
| 3796 |
+
"eol_long_species.loc[eol_long_species[\"len_species\"] < 7].sample(7)"
|
|
|
|
| 3797 |
]
|
| 3798 |
},
|
| 3799 |
{
|
| 3800 |
"cell_type": "markdown",
|
| 3801 |
"metadata": {},
|
| 3802 |
"source": [
|
| 3803 |
+
"### Label Overlap Check"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3804 |
]
|
| 3805 |
},
|
| 3806 |
{
|
|
|
|
| 4111 |
],
|
| 4112 |
"metadata": {
|
| 4113 |
"kernelspec": {
|
| 4114 |
+
"display_name": "Python 3 (ipykernel)",
|
| 4115 |
"language": "python",
|
| 4116 |
"name": "python3"
|
| 4117 |
},
|
|
|
|
| 4125 |
"name": "python",
|
| 4126 |
"nbconvert_exporter": "python",
|
| 4127 |
"pygments_lexer": "ipython3",
|
| 4128 |
+
"version": "3.11.3"
|
| 4129 |
+
}
|
|
|
|
| 4130 |
},
|
| 4131 |
"nbformat": 4,
|
| 4132 |
"nbformat_minor": 2
|
notebooks/ToL_stats_EDA.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
notebooks/ToL_stats_EDA.py
ADDED
|
@@ -0,0 +1,534 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ---
|
| 2 |
+
# jupyter:
|
| 3 |
+
# jupytext:
|
| 4 |
+
# formats: ipynb,py:percent
|
| 5 |
+
# text_representation:
|
| 6 |
+
# extension: .py
|
| 7 |
+
# format_name: percent
|
| 8 |
+
# format_version: '1.3'
|
| 9 |
+
# jupytext_version: 1.15.2
|
| 10 |
+
# kernelspec:
|
| 11 |
+
# display_name: Python 3 (ipykernel)
|
| 12 |
+
# language: python
|
| 13 |
+
# name: python3
|
| 14 |
+
# ---
|
| 15 |
+
|
| 16 |
+
# %%
|
| 17 |
+
import pandas as pd
|
| 18 |
+
import seaborn as sns
|
| 19 |
+
|
| 20 |
+
sns.set_style("whitegrid")
|
| 21 |
+
sns.set(rc = {'figure.figsize': (10,10)})
|
| 22 |
+
|
| 23 |
+
# %%
|
| 24 |
+
df = pd.read_csv("../data/statistics.csv")
|
| 25 |
+
|
| 26 |
+
# %%
|
| 27 |
+
df.head()
|
| 28 |
+
|
| 29 |
+
# %%
|
| 30 |
+
df.info(show_counts = True)
|
| 31 |
+
|
| 32 |
+
# %% [markdown]
|
| 33 |
+
# Original version had 10,436,521 entries; was the validation set left out (there does seem to be about 5-10% less of each source).
|
| 34 |
+
#
|
| 35 |
+
# Labeling definitely has far better coverage now.
|
| 36 |
+
|
| 37 |
+
# %%
|
| 38 |
+
df.nunique()
|
| 39 |
+
|
| 40 |
+
# %% [markdown]
|
| 41 |
+
# There are 498,053 unique EOL page IDs, suggesting 498,053 unique classes among the 5,938,235 images pulled from EOL (and maintained here). Presumably this would represent the number of species or other lowest rank taxa covered.
|
| 42 |
+
|
| 43 |
+
# %% [markdown]
|
| 44 |
+
# Notice that we have 7 unique kingdoms, when there are only...
|
| 45 |
+
|
| 46 |
+
# %%
|
| 47 |
+
df['kingdom'].value_counts()
|
| 48 |
+
|
| 49 |
+
# %% [markdown]
|
| 50 |
+
# `Metazoa` and `Archaeplastida` have been replaced by `Animalia` and `Plantae`.
|
| 51 |
+
#
|
| 52 |
+
# We now have other single-celled organisms for kingdom
|
| 53 |
+
|
| 54 |
+
# %%
|
| 55 |
+
taxa = list(df.columns[8:15])
|
| 56 |
+
taxa
|
| 57 |
+
|
| 58 |
+
# %% [markdown]
|
| 59 |
+
# Check the number of images with all 7 taxonomic labels.
|
| 60 |
+
|
| 61 |
+
# %%
|
| 62 |
+
df_all_taxa = df.dropna(subset = taxa)
|
| 63 |
+
df_all_taxa[taxa].info(show_counts = True)
|
| 64 |
+
|
| 65 |
+
# %% [markdown]
|
| 66 |
+
# We have 7,901,259 images with full taxonomic labels.
|
| 67 |
+
#
|
| 68 |
+
# Notice that we have gaps in the taxonomic hierarchy (both higher and lower values), as this is less than the number of species labels in the dataset and species had the least non-null values.
|
| 69 |
+
#
|
| 70 |
+
# We did hit the 7M+ entries with full taxonomic labels expectation, so that's good.
|
| 71 |
+
|
| 72 |
+
# %% [markdown]
|
| 73 |
+
# More detail on these missing values from [`check_taxa` script](https://github.com/Imageomics/open_clip/blob/main/scripts/evobio10m/check_taxa.py)
|
| 74 |
+
#
|
| 75 |
+
# ```
|
| 76 |
+
# [2023-10-25 10:25:28,242] [WARNING] [root] There are 7 kingdoms instead of 3.
|
| 77 |
+
# [2023-10-25 10:25:29,234] [WARNING] [root] 14795 entries are missing rank kingdom, but have genus label.
|
| 78 |
+
# [2023-10-25 10:25:29,477] [WARNING] [root] 5824 entries are missing rank phylum, but have genus label.
|
| 79 |
+
# [2023-10-25 10:25:29,719] [WARNING] [root] 15763 entries are missing rank class, but have genus label.
|
| 80 |
+
# [2023-10-25 10:25:29,958] [WARNING] [root] 10550 entries are missing rank order, but have genus label.
|
| 81 |
+
# [2023-10-25 10:25:30,203] [WARNING] [root] 7539 entries are missing rank family, but have genus label.
|
| 82 |
+
# [2023-10-25 10:25:30,470] [WARNING] [root] 296 entries are missing rank kingdom, but have family label.
|
| 83 |
+
# [2023-10-25 10:25:30,495] [WARNING] [root] 272 entries are missing rank phylum, but have family label.
|
| 84 |
+
# [2023-10-25 10:25:30,520] [WARNING] [root] 753 entries are missing rank class, but have family label.
|
| 85 |
+
# [2023-10-25 10:25:30,545] [WARNING] [root] 395 entries are missing rank order, but have family label.
|
| 86 |
+
# [2023-10-25 10:25:30,590] [WARNING] [root] 156 entries are missing rank kingdom, but have order label.
|
| 87 |
+
# [2023-10-25 10:25:30,591] [WARNING] [root] 100 entries are missing rank phylum, but have order label.
|
| 88 |
+
# [2023-10-25 10:25:30,592] [WARNING] [root] 1187 entries are missing rank class, but have order label.
|
| 89 |
+
# [2023-10-25 10:25:30,637] [WARNING] [root] 74 entries have kingdom and species labels but no genus.
|
| 90 |
+
# [2023-10-25 10:25:30,644] [WARNING] [root] 74 entries have phylum and species labels but no genus.
|
| 91 |
+
# [2023-10-25 10:25:30,650] [WARNING] [root] 74 entries have class and species labels but no genus.
|
| 92 |
+
# [2023-10-25 10:25:30,656] [WARNING] [root] 74 entries have order and species labels but no genus.
|
| 93 |
+
# [2023-10-25 10:25:30,662] [WARNING] [root] 74 entries have family and species labels but no genus.
|
| 94 |
+
# [2023-10-25 10:25:31,992] [WARNING] [root] There are 158279 samples for which the species column may have genus and species.
|
| 95 |
+
# ```
|
| 96 |
+
|
| 97 |
+
# %% [markdown]
|
| 98 |
+
# Can we get some more information on those 74 entries that are missing genus?
|
| 99 |
+
|
| 100 |
+
# %%
|
| 101 |
+
missing_genus = df.dropna(subset = ['kingdom', 'phylum', 'class', 'order', 'family', 'species'])
|
| 102 |
+
missing_genus = missing_genus.loc[missing_genus.genus.isna()]
|
| 103 |
+
missing_genus[taxa].nunique()
|
| 104 |
+
|
| 105 |
+
# %% [markdown]
|
| 106 |
+
# So it's a handful of taxa, let's take a look.
|
| 107 |
+
|
| 108 |
+
# %%
|
| 109 |
+
print("The taxa missing genus are: ")
|
| 110 |
+
for taxon in taxa:
|
| 111 |
+
print(taxon, ": ", missing_genus[taxon].unique())
|
| 112 |
+
|
| 113 |
+
# %% [markdown]
|
| 114 |
+
# Let's add a column indicating the original data source so we can also get some stats by datasource.
|
| 115 |
+
|
| 116 |
+
# %%
|
| 117 |
+
# Add data_source column for easier slicing
|
| 118 |
+
df.loc[df['inat21_filename'].notna(), 'data_source'] = 'iNat21'
|
| 119 |
+
df.loc[df['bioscan_filename'].notna(), 'data_source'] = 'BIOSCAN'
|
| 120 |
+
df.loc[df['eol_content_id'].notna(), 'data_source'] = 'EOL'
|
| 121 |
+
|
| 122 |
+
# %%
|
| 123 |
+
df.loc[df['common'].isna(), 'data_source'].unique()
|
| 124 |
+
|
| 125 |
+
# %%
|
| 126 |
+
missing_genus.data_source.unique()
|
| 127 |
+
|
| 128 |
+
# %% [markdown]
|
| 129 |
+
# Missing genus with all other taxa occurs in both BIOSCAN and EOL.
|
| 130 |
+
|
| 131 |
+
# %% [markdown]
|
| 132 |
+
# First, check their unique class values (`common`).
|
| 133 |
+
|
| 134 |
+
# %%
|
| 135 |
+
df.loc[df['data_source'] == 'EOL', 'common'].nunique()
|
| 136 |
+
|
| 137 |
+
# %%
|
| 138 |
+
df.loc[df['data_source'] == 'iNat21', 'common'].nunique()
|
| 139 |
+
|
| 140 |
+
# %%
|
| 141 |
+
df.loc[df['data_source'] == 'BIOSCAN', 'common'].nunique()
|
| 142 |
+
|
| 143 |
+
# %% [markdown]
|
| 144 |
+
# iNat's number of unique values in `common` has gone up by 6...why?
|
| 145 |
+
#
|
| 146 |
+
# BIOSCAN and EOL's counts went down, as expected (this is just training set and the common mapping was not done if scientific name was not provided, so we wouldn't see many for BIOSCAN).
|
| 147 |
+
|
| 148 |
+
# %% [markdown]
|
| 149 |
+
# Make `df_taxa` with just taxa columns (+ `common` & `data_source`) so it's smaller to process faster.
|
| 150 |
+
|
| 151 |
+
# %%
|
| 152 |
+
taxa_com = list(df.columns[8:16]) # taxa + common
|
| 153 |
+
taxa_com.insert(0, 'data_source')
|
| 154 |
+
df_taxa = df[taxa_com]
|
| 155 |
+
|
| 156 |
+
# %%
|
| 157 |
+
df_taxa.head()
|
| 158 |
+
|
| 159 |
+
# %% [markdown]
|
| 160 |
+
# Let's look a little closer at each of our three data sources.
|
| 161 |
+
|
| 162 |
+
# %%
|
| 163 |
+
inat21_df = df_taxa.loc[df_taxa.data_source == 'iNat21']
|
| 164 |
+
bioscan_df = df_taxa.loc[df_taxa.data_source == 'BIOSCAN']
|
| 165 |
+
eol_df = df_taxa.loc[df_taxa.data_source == 'EOL']
|
| 166 |
+
|
| 167 |
+
# %% [markdown]
|
| 168 |
+
# ### iNat21
|
| 169 |
+
|
| 170 |
+
# %%
|
| 171 |
+
inat21_df.info(show_counts = True)
|
| 172 |
+
|
| 173 |
+
# %% [markdown]
|
| 174 |
+
# iNat21 isn't missing anything, as expected, and we have 2,552,501 of 2,686,843 images (training, validation set is separate).
|
| 175 |
+
#
|
| 176 |
+
# Quick view of diversity in iNat21.
|
| 177 |
+
|
| 178 |
+
# %%
|
| 179 |
+
inat21_df.nunique()
|
| 180 |
+
|
| 181 |
+
# %% [markdown]
|
| 182 |
+
# Again, 6 more common values were added, but the diversity has not been altered (same numbers of unique values).
|
| 183 |
+
|
| 184 |
+
# %%
|
| 185 |
+
inat21_df['kingdom'].value_counts()
|
| 186 |
+
|
| 187 |
+
# %% [markdown]
|
| 188 |
+
# iNat21 uses `Animalia` and `Plantae`.
|
| 189 |
+
|
| 190 |
+
# %%
|
| 191 |
+
#number of unique 7-tuples in iNat21
|
| 192 |
+
inat21_df['duplicate'] = inat21_df.duplicated(subset = taxa, keep = 'first')
|
| 193 |
+
inat21_df_unique_taxa = inat21_df.loc[~inat21_df['duplicate']]
|
| 194 |
+
|
| 195 |
+
# %%
|
| 196 |
+
inat21_df_unique_taxa.info(show_counts = True)
|
| 197 |
+
|
| 198 |
+
# %% [markdown]
|
| 199 |
+
# There's the 10K unique `species` that we expect. Let's check the same information across BIOSCAN and EOL.
|
| 200 |
+
|
| 201 |
+
# %% [markdown]
|
| 202 |
+
# ### BIOSCAN
|
| 203 |
+
|
| 204 |
+
# %%
|
| 205 |
+
bioscan_df.info(show_counts = True)
|
| 206 |
+
|
| 207 |
+
# %% [markdown]
|
| 208 |
+
# All images are labeled down to `order`, most (98.6%) are labeled to the `family` level, but we only have 22.5% and 7.5% with `genus` or `species` level designation, respectively. These proportions were maintained when the validation set was removed.
|
| 209 |
+
|
| 210 |
+
# %%
|
| 211 |
+
bioscan_df.nunique()
|
| 212 |
+
|
| 213 |
+
# %% [markdown]
|
| 214 |
+
# We did lose 2 families, 37 genera, and 1,354 species to the validation set. Note, they may be (likely are) represented in EOL and/or iNat.
|
| 215 |
+
|
| 216 |
+
# %%
|
| 217 |
+
bioscan_df['kingdom'].value_counts()
|
| 218 |
+
|
| 219 |
+
# %% [markdown]
|
| 220 |
+
# BIOSCAN is all `Animalia`, as expected.
|
| 221 |
+
|
| 222 |
+
# %% [markdown]
|
| 223 |
+
# Check we're not missing `family` designation when we have `genus`.
|
| 224 |
+
|
| 225 |
+
# %%
|
| 226 |
+
bioscan_df.loc[bioscan_df['genus'].notna()].info()
|
| 227 |
+
|
| 228 |
+
# %%
|
| 229 |
+
bioscan_df.loc[bioscan_df['genus'].notna()].sample(7)
|
| 230 |
+
|
| 231 |
+
# %% [markdown]
|
| 232 |
+
# We should not have instances where `common` is labeled as `Genus genus species` this time.
|
| 233 |
+
|
| 234 |
+
# %%
|
| 235 |
+
bioscan_df.loc[bioscan_df['genus'].isna()].sample(7)
|
| 236 |
+
|
| 237 |
+
# %% [markdown]
|
| 238 |
+
# When the `genus` is null, we no longer get `common` of all higher order taxa available; though we are going to go back to this with the next iteration it seems.
|
| 239 |
+
|
| 240 |
+
# %%
|
| 241 |
+
#number of unique 7-tuples in BIOSCAN
|
| 242 |
+
bioscan_df['duplicate'] = bioscan_df.duplicated(subset = taxa, keep = 'first')
|
| 243 |
+
bioscan_df_unique_taxa = bioscan_df.loc[~bioscan_df['duplicate']]
|
| 244 |
+
|
| 245 |
+
# %%
|
| 246 |
+
bioscan_df_unique_taxa.info(show_counts = True)
|
| 247 |
+
|
| 248 |
+
# %% [markdown]
|
| 249 |
+
# We should be able to fill all in for all values of `species` that also have `genus` indicated since they are all in `Animalia`. Is `genus` labeled for all entries with `species` labeled?
|
| 250 |
+
|
| 251 |
+
# %%
|
| 252 |
+
bioscan_df.loc[bioscan_df.species.notna()].info(show_counts = True)
|
| 253 |
+
|
| 254 |
+
# %% [markdown]
|
| 255 |
+
# There are only 8 images where the `species` is labeled, but the `genus` isn't. There must be 1 in the validation set.
|
| 256 |
+
|
| 257 |
+
# %%
|
| 258 |
+
bioscan_df.loc[(bioscan_df.species.notna()) & (bioscan_df.genus.isna())]
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
# %% [markdown]
|
| 262 |
+
# It seems the `genus` is `tetramalaise01` ([genus page for tetraMalaise01](https://v3.boldsystems.org/index.php/Taxbrowser_Taxonpage?taxid=1074204)).
|
| 263 |
+
|
| 264 |
+
# %% [markdown]
|
| 265 |
+
# In general, when the species is listed in BIOSCAN it is listed as `genus-species`. This is certainly true here and would work to fill the 9 missing genera.
|
| 266 |
+
#
|
| 267 |
+
# Let's check those stats again, we did confirm it earlier, but would also like to check EOL as it had a similar issue for some entries.
|
| 268 |
+
|
| 269 |
+
# %%
|
| 270 |
+
def check_sci_name(df):
|
| 271 |
+
"""
|
| 272 |
+
This function checks the number of words in the species column for each sample.
|
| 273 |
+
Logs a warning with the number that have more than one word indicating the potential for both genus and species to be recorded.
|
| 274 |
+
Warning is printed to terminal, not saved to file.
|
| 275 |
+
|
| 276 |
+
Parameters:
|
| 277 |
+
-----------
|
| 278 |
+
df - DataFrame with taxonomic hierarchy as columns.
|
| 279 |
+
|
| 280 |
+
Returns:
|
| 281 |
+
--------
|
| 282 |
+
df - DataFrame with taxonomic hierarchy and length of species entry as columns.
|
| 283 |
+
"""
|
| 284 |
+
# Set length of species column with default = 1
|
| 285 |
+
df["len_species"] = 1
|
| 286 |
+
|
| 287 |
+
# Check for scientific name in species column (i.e., genus speices in species column, may correspond to missing genus)
|
| 288 |
+
for species in list(df.loc[df["species"].notna(), "species"].unique()):
|
| 289 |
+
len_species = len(species.split(" "))
|
| 290 |
+
if len_species > 1:
|
| 291 |
+
df.loc[df["species"] == species, "len_species"] = len_species
|
| 292 |
+
|
| 293 |
+
return df
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
# %%
|
| 298 |
+
bioscan_species_len_df = check_sci_name(bioscan_df)
|
| 299 |
+
|
| 300 |
+
# %%
|
| 301 |
+
bioscan_species_len_df.info(show_counts = True)
|
| 302 |
+
|
| 303 |
+
# %%
|
| 304 |
+
bioscan_long_species = bioscan_species_len_df.loc[bioscan_species_len_df["len_species"] > 1]
|
| 305 |
+
bioscan_long_species.info(show_counts = True)
|
| 306 |
+
|
| 307 |
+
# %% [markdown]
|
| 308 |
+
# Not all species indicated have length greater than 1 now.
|
| 309 |
+
|
| 310 |
+
# %%
|
| 311 |
+
bioscan_species_len_df.len_species.value_counts()
|
| 312 |
+
|
| 313 |
+
# %% [markdown]
|
| 314 |
+
# It seems the genus may have been removed, but the remaining string retained as they previously ranged from 2 to 5 "words" long.
|
| 315 |
+
|
| 316 |
+
# %%
|
| 317 |
+
bioscan_long_species.sample(7)
|
| 318 |
+
|
| 319 |
+
# %% [markdown]
|
| 320 |
+
# Ah but the whole species indicator was moved into genus for some of these.
|
| 321 |
+
|
| 322 |
+
# %%
|
| 323 |
+
bioscan_long_species.loc[bioscan_long_species['len_species'] > 2].sample(10)
|
| 324 |
+
|
| 325 |
+
# %%
|
| 326 |
+
bioscan_df.loc[bioscan_df["genus"] == "Psychoda", "species"].unique()
|
| 327 |
+
|
| 328 |
+
# %% [markdown]
|
| 329 |
+
# We can see that the case of "Psychoda" was resolved appropriately.
|
| 330 |
+
|
| 331 |
+
# %% [markdown]
|
| 332 |
+
# It would seem the "sp. ..." is used to indicate they are likely the same species, though the actual species is not designated (either unnamed or undetermined). This is information we should retain, but the duplicated genus can be removed.
|
| 333 |
+
|
| 334 |
+
# %% [markdown]
|
| 335 |
+
# ### EOL
|
| 336 |
+
|
| 337 |
+
# %%
|
| 338 |
+
eol_df.info(show_counts = True)
|
| 339 |
+
|
| 340 |
+
# %%
|
| 341 |
+
eol_df.nunique()
|
| 342 |
+
|
| 343 |
+
# %%
|
| 344 |
+
eol_df.loc[eol_df.species.isna()].nunique()
|
| 345 |
+
|
| 346 |
+
# %% [markdown]
|
| 347 |
+
# There are 498,053 (training + val 570,515) unique page IDs from EOL in this training set, which clearly represent varying levels of taxa.
|
| 348 |
+
#
|
| 349 |
+
# Unique species + unique common where species is null (197,301) does not reach this number.
|
| 350 |
+
|
| 351 |
+
# %%
|
| 352 |
+
eol_df['kingdom'].value_counts()
|
| 353 |
+
|
| 354 |
+
# %% [markdown]
|
| 355 |
+
# We have much greater kingdom variety here.
|
| 356 |
+
#
|
| 357 |
+
# We have already observed that not all ranks are filled in at the higher levels, sometimes having just one gap. This has been greatly improved from the first iteration.
|
| 358 |
+
|
| 359 |
+
# %%
|
| 360 |
+
#number of unique 7-tuples in EOL
|
| 361 |
+
eol_df['duplicate'] = eol_df.duplicated(subset = taxa, keep = 'first')
|
| 362 |
+
eol_df_unique_taxa = eol_df.loc[~eol_df['duplicate']]
|
| 363 |
+
|
| 364 |
+
# %%
|
| 365 |
+
eol_df_unique_taxa.info(show_counts = True)
|
| 366 |
+
|
| 367 |
+
# %% [markdown]
|
| 368 |
+
# The actual number of distinct creatures is likely higher, as evidenced below where we have unique common names listed in `common` but all taxa are null.
|
| 369 |
+
#
|
| 370 |
+
# We should be able to fill all in for all values of `species` that also have `genus` indicated. Is `genus` labeled for all entries with `species` labeled?
|
| 371 |
+
|
| 372 |
+
# %%
|
| 373 |
+
eol_df.loc[eol_df.species.notna()].info(show_counts = True)
|
| 374 |
+
|
| 375 |
+
# %% [markdown]
|
| 376 |
+
# Not all labeled species have higher order taxa, but they do all have `common` (likely because if there is no common name, it pulls scientific name (genus-species)).
|
| 377 |
+
|
| 378 |
+
# %% [markdown]
|
| 379 |
+
# Let's get a quick sample of the `common` column for images both with and without `species` labels.
|
| 380 |
+
|
| 381 |
+
# %%
|
| 382 |
+
# existing species label
|
| 383 |
+
eol_df.loc[eol_df.species.notna()].sample(7)
|
| 384 |
+
|
| 385 |
+
# %% [markdown]
|
| 386 |
+
# Good, some of these do have common names. We could check numbers of `common` where it doesn't match the `genus-species` form for a better count, but our random sample is promising.
|
| 387 |
+
|
| 388 |
+
# %%
|
| 389 |
+
# No species label
|
| 390 |
+
eol_df.loc[eol_df.species.isna()].sample(7)
|
| 391 |
+
|
| 392 |
+
# %% [markdown]
|
| 393 |
+
# Here are a lot of higher-order taxa missing species...let's check for the details noted below.
|
| 394 |
+
#
|
| 395 |
+
# From original check:
|
| 396 |
+
# All `common` values are filled in with predominently common names. It seems we could map these back to some level of taxa with the taxon-common matching? Though why would these EOL images have common without any other designation?
|
| 397 |
+
#
|
| 398 |
+
# Good example of strange inconsistency: the `American red raspberry` is `Rubus strigosus`, and a quick Google search easily provides the entire taxonomy.
|
| 399 |
+
#
|
| 400 |
+
# `Cremastobaeus` seems to be a genus of wasp.
|
| 401 |
+
|
| 402 |
+
# %%
|
| 403 |
+
eol_df.loc[eol_df.common == "American red raspberry"]
|
| 404 |
+
|
| 405 |
+
# %%
|
| 406 |
+
eol_df.loc[eol_df.common == "Rubus strigosus"]
|
| 407 |
+
|
| 408 |
+
# %% [markdown]
|
| 409 |
+
# We seem to have lost the raspberry...
|
| 410 |
+
|
| 411 |
+
# %%
|
| 412 |
+
eol_df.loc[eol_df.species == "strigosus"]
|
| 413 |
+
|
| 414 |
+
# %%
|
| 415 |
+
eol_df_unique_taxa.loc[eol_df_unique_taxa.species == "strigosus"]
|
| 416 |
+
|
| 417 |
+
# %% [markdown]
|
| 418 |
+
# It seems likely the row with the null values is our lost raspberry.
|
| 419 |
+
#
|
| 420 |
+
# Also good evidence of the duplication of species names across kingdoms and other taxa.
|
| 421 |
+
|
| 422 |
+
# %% [markdown]
|
| 423 |
+
# Rubus strigosus is apparently a subspecies of "Rubus idaeus", and we are not looking at the subspecies level.
|
| 424 |
+
|
| 425 |
+
# %%
|
| 426 |
+
eol_df_unique_taxa.loc[eol_df_unique_taxa.species == "idaeus"]
|
| 427 |
+
|
| 428 |
+
# %% [markdown]
|
| 429 |
+
# Though the question remains, why did we lose the common name?
|
| 430 |
+
|
| 431 |
+
# %% [markdown]
|
| 432 |
+
# Let's check the `species` length in EOL as well, we know there are some that have genus-species.
|
| 433 |
+
|
| 434 |
+
# %%
|
| 435 |
+
eol_species_len = check_sci_name(eol_df)
|
| 436 |
+
eol_species_len.info(show_counts = True)
|
| 437 |
+
|
| 438 |
+
# %%
|
| 439 |
+
eol_long_species = eol_species_len.loc[eol_species_len["len_species"] > 1]
|
| 440 |
+
eol_long_species.info(show_counts = True)
|
| 441 |
+
|
| 442 |
+
# %% [markdown]
|
| 443 |
+
# That's quite a lot with species name longer than 1 word.
|
| 444 |
+
|
| 445 |
+
# %%
|
| 446 |
+
eol_long_species.len_species.value_counts()
|
| 447 |
+
|
| 448 |
+
# %% [markdown]
|
| 449 |
+
# Observe, we did not wind up with any of length 2, so this issue was partially resolved.
|
| 450 |
+
#
|
| 451 |
+
# Why are some more than 10 words long?
|
| 452 |
+
|
| 453 |
+
# %%
|
| 454 |
+
eol_long_species.loc[eol_long_species["len_species"] > 7].sample(7)
|
| 455 |
+
|
| 456 |
+
# %%
|
| 457 |
+
eol_long_species.nunique()
|
| 458 |
+
|
| 459 |
+
# %%
|
| 460 |
+
eol_long_species.loc[eol_long_species["len_species"] < 7].sample(7)
|
| 461 |
+
|
| 462 |
+
# %% [markdown]
|
| 463 |
+
# Quick search: "Adelpha godmani" is a butterfly with species name given by Fruhstorfer in 1913 ([source](https://butterfliesofamerica.com/L/t/Adelpha_godmani_a.htm)).
|
| 464 |
+
|
| 465 |
+
# %% [markdown]
|
| 466 |
+
# ### Label Overlap Check
|
| 467 |
+
|
| 468 |
+
# %% [markdown]
|
| 469 |
+
# Checking for overlap between the three data sources should give pretty good results, now that most inconsistencies have been addressed.
|
| 470 |
+
#
|
| 471 |
+
# For now, let's just take a quick look at genera across the datasets since they are more standardized (and listed more often in BIOSCAN).
|
| 472 |
+
|
| 473 |
+
# %%
|
| 474 |
+
eol_genera = list(eol_df.loc[eol_df['genus'].notna(), 'genus'].unique())
|
| 475 |
+
inat21_genera = list(inat21_df.loc[inat21_df['genus'].notna(), 'genus'].unique())
|
| 476 |
+
bioscan_genera = list(bioscan_df.loc[bioscan_df['genus'].notna(), 'genus'].unique())
|
| 477 |
+
|
| 478 |
+
print(f"there are {len(eol_genera)} genera in EOL")
|
| 479 |
+
print(f"there are {len(inat21_genera)} genera in inat21")
|
| 480 |
+
print(f"there are {len(bioscan_genera)} genera in bioscan")
|
| 481 |
+
|
| 482 |
+
# %%
|
| 483 |
+
gen_overlap = list(set(eol_genera) & set(inat21_genera))
|
| 484 |
+
print(f"There are {len(gen_overlap)} genera shared between EOL and iNat21.")
|
| 485 |
+
print(f"There are {len(list(set(eol_genera) & set(bioscan_genera)))} genera shared between EOL and BIOSCAN.")
|
| 486 |
+
print(f"There are {len(list(set(inat21_genera) & set(bioscan_genera)))} genera shared between iNat21 and BIOSCAN.")
|
| 487 |
+
print(f"There are {len(list(set(gen_overlap) & set(bioscan_genera)))} genera shared between all three data sources.")
|
| 488 |
+
|
| 489 |
+
# %% [markdown]
|
| 490 |
+
# BIOSCAN and iNat21's overlap of genera is completely contained in EOL.
|
| 491 |
+
|
| 492 |
+
# %% [markdown]
|
| 493 |
+
# ## Overall Stats
|
| 494 |
+
#
|
| 495 |
+
# Keep in mind, this is without fixing remaining inconsistencies observed above.
|
| 496 |
+
|
| 497 |
+
# %%
|
| 498 |
+
import numpy as np
|
| 499 |
+
|
| 500 |
+
# %%
|
| 501 |
+
avgs_all_images = []
|
| 502 |
+
std_all_images = []
|
| 503 |
+
avgs_labeled_images = []
|
| 504 |
+
std_labeled_images = []
|
| 505 |
+
for taxon in taxa_com[1:]: #taxa + common
|
| 506 |
+
num_taxon = df[taxon].nunique()
|
| 507 |
+
num_img_taxon = len(df.loc[df[taxon].notna()])
|
| 508 |
+
avg_all = 10436521/num_taxon
|
| 509 |
+
std_all = np.sqrt(10436521/num_taxon)
|
| 510 |
+
avg_labeled = num_img_taxon/num_taxon
|
| 511 |
+
std_labeled = np.sqrt(num_img_taxon/num_taxon)
|
| 512 |
+
avgs_all_images.append(avg_all)
|
| 513 |
+
std_all_images.append(std_all)
|
| 514 |
+
avgs_labeled_images.append(avg_labeled)
|
| 515 |
+
std_labeled_images.append(std_labeled)
|
| 516 |
+
|
| 517 |
+
# %%
|
| 518 |
+
avg_std = pd.DataFrame(data = {'class': taxa_com[1:], 'average_all_imgs': avgs_all_images, 'standard_deviation': std_all_images,
|
| 519 |
+
'avg_labeled': avgs_labeled_images, 'std_dev_labeled': std_labeled_images })
|
| 520 |
+
avg_std
|
| 521 |
+
|
| 522 |
+
# %%
|
| 523 |
+
avg_std.to_csv("../data/stats_avg_std_byClass.csv", index = False)
|
| 524 |
+
|
| 525 |
+
# %% [markdown]
|
| 526 |
+
# Observe that the Plant and Animal `kingdom`s are actually much more heavily represented than Fungi.
|
| 527 |
+
|
| 528 |
+
# %%
|
| 529 |
+
sns.set(rc = {'figure.figsize': (10,6)})
|
| 530 |
+
|
| 531 |
+
# %%
|
| 532 |
+
sns.histplot(df_taxa, x = 'kingdom')
|
| 533 |
+
|
| 534 |
+
# %%
|