Updated count information to include all values that should show up as warnings when running check_taxa.
Browse files- data/tol_hierarchy_test.csv +0 -0
- notebooks/missing_taxa_testGen.ipynb +302 -244
data/tol_hierarchy_test.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
notebooks/missing_taxa_testGen.ipynb
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
"name": "stderr",
|
| 19 |
"output_type": "stream",
|
| 20 |
"text": [
|
| 21 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/
|
| 22 |
" df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
|
| 23 |
]
|
| 24 |
}
|
|
@@ -56,25 +56,25 @@
|
|
| 56 |
"output_type": "stream",
|
| 57 |
"text": [
|
| 58 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 59 |
-
"Index: 1000 entries,
|
| 60 |
"Data columns (total 17 columns):\n",
|
| 61 |
" # Column Non-Null Count Dtype \n",
|
| 62 |
"--- ------ -------------- ----- \n",
|
| 63 |
" 0 treeoflife_id 1000 non-null object \n",
|
| 64 |
-
" 1 eol_content_id
|
| 65 |
-
" 2 eol_page_id
|
| 66 |
-
" 3 bioscan_part
|
| 67 |
-
" 4 bioscan_filename
|
| 68 |
-
" 5 inat21_filename
|
| 69 |
-
" 6 inat21_cls_name
|
| 70 |
-
" 7 inat21_cls_num
|
| 71 |
-
" 8 kingdom
|
| 72 |
-
" 9 phylum
|
| 73 |
-
" 10 class
|
| 74 |
-
" 11 order
|
| 75 |
-
" 12 family
|
| 76 |
-
" 13 genus
|
| 77 |
-
" 14 species
|
| 78 |
" 15 common 1000 non-null object \n",
|
| 79 |
" 16 data_source 1000 non-null object \n",
|
| 80 |
"dtypes: float64(4), object(13)\n",
|
|
@@ -83,7 +83,7 @@
|
|
| 83 |
}
|
| 84 |
],
|
| 85 |
"source": [
|
| 86 |
-
"df_small = df.loc[df.data_source != '
|
| 87 |
"df_small.info(show_counts = True)"
|
| 88 |
]
|
| 89 |
},
|
|
@@ -97,29 +97,29 @@
|
|
| 97 |
"output_type": "stream",
|
| 98 |
"text": [
|
| 99 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 100 |
-
"Index:
|
| 101 |
"Data columns (total 17 columns):\n",
|
| 102 |
" # Column Non-Null Count Dtype \n",
|
| 103 |
"--- ------ -------------- ----- \n",
|
| 104 |
-
" 0 treeoflife_id
|
| 105 |
-
" 1 eol_content_id
|
| 106 |
-
" 2 eol_page_id
|
| 107 |
-
" 3 bioscan_part
|
| 108 |
-
" 4 bioscan_filename
|
| 109 |
-
" 5 inat21_filename
|
| 110 |
-
" 6 inat21_cls_name
|
| 111 |
-
" 7 inat21_cls_num
|
| 112 |
-
" 8 kingdom
|
| 113 |
-
" 9 phylum
|
| 114 |
-
" 10 class
|
| 115 |
-
" 11 order
|
| 116 |
-
" 12 family
|
| 117 |
-
" 13 genus
|
| 118 |
-
" 14 species
|
| 119 |
-
" 15 common
|
| 120 |
-
" 16 data_source
|
| 121 |
"dtypes: float64(4), object(13)\n",
|
| 122 |
-
"memory usage:
|
| 123 |
]
|
| 124 |
}
|
| 125 |
],
|
|
@@ -171,7 +171,7 @@
|
|
| 171 |
}
|
| 172 |
],
|
| 173 |
"source": [
|
| 174 |
-
"bio_eol = df.loc[df.data_source != '
|
| 175 |
"null_genus = bio_eol.loc[bio_eol.genus.isna()]\n",
|
| 176 |
"null_genus.info(show_counts = True)"
|
| 177 |
]
|
|
@@ -201,26 +201,26 @@
|
|
| 201 |
},
|
| 202 |
{
|
| 203 |
"cell_type": "code",
|
| 204 |
-
"execution_count":
|
| 205 |
"metadata": {},
|
| 206 |
"outputs": [
|
| 207 |
{
|
| 208 |
"data": {
|
| 209 |
"text/plain": [
|
| 210 |
-
"
|
| 211 |
-
"
|
| 212 |
-
"
|
| 213 |
-
"
|
| 214 |
-
"
|
| 215 |
-
"
|
| 216 |
-
"
|
| 217 |
-
"
|
| 218 |
-
"
|
| 219 |
-
"
|
| 220 |
"Name: species, dtype: object"
|
| 221 |
]
|
| 222 |
},
|
| 223 |
-
"execution_count":
|
| 224 |
"metadata": {},
|
| 225 |
"output_type": "execute_result"
|
| 226 |
}
|
|
@@ -231,14 +231,14 @@
|
|
| 231 |
},
|
| 232 |
{
|
| 233 |
"cell_type": "code",
|
| 234 |
-
"execution_count":
|
| 235 |
"metadata": {},
|
| 236 |
"outputs": [
|
| 237 |
{
|
| 238 |
"name": "stdout",
|
| 239 |
"output_type": "stream",
|
| 240 |
"text": [
|
| 241 |
-
"
|
| 242 |
]
|
| 243 |
}
|
| 244 |
],
|
|
@@ -254,28 +254,85 @@
|
|
| 254 |
"cell_type": "markdown",
|
| 255 |
"metadata": {},
|
| 256 |
"source": [
|
| 257 |
-
"
|
| 258 |
]
|
| 259 |
},
|
| 260 |
{
|
| 261 |
"cell_type": "code",
|
| 262 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
"metadata": {},
|
| 264 |
"outputs": [],
|
| 265 |
"source": [
|
| 266 |
-
"df_test.
|
| 267 |
]
|
| 268 |
},
|
| 269 |
{
|
| 270 |
"cell_type": "markdown",
|
| 271 |
"metadata": {},
|
| 272 |
"source": [
|
| 273 |
-
"
|
| 274 |
]
|
| 275 |
},
|
| 276 |
{
|
| 277 |
"cell_type": "code",
|
| 278 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
"metadata": {},
|
| 280 |
"outputs": [
|
| 281 |
{
|
|
@@ -322,7 +379,7 @@
|
|
| 322 |
},
|
| 323 |
{
|
| 324 |
"cell_type": "code",
|
| 325 |
-
"execution_count":
|
| 326 |
"metadata": {},
|
| 327 |
"outputs": [
|
| 328 |
{
|
|
@@ -367,30 +424,10 @@
|
|
| 367 |
" </thead>\n",
|
| 368 |
" <tbody>\n",
|
| 369 |
" <tr>\n",
|
| 370 |
-
" <th>
|
| 371 |
-
" <td>
|
| 372 |
-
" <td>
|
| 373 |
-
" <td>
|
| 374 |
-
" <td>NaN</td>\n",
|
| 375 |
-
" <td>NaN</td>\n",
|
| 376 |
-
" <td>NaN</td>\n",
|
| 377 |
-
" <td>NaN</td>\n",
|
| 378 |
-
" <td>NaN</td>\n",
|
| 379 |
-
" <td>NaN</td>\n",
|
| 380 |
-
" <td>NaN</td>\n",
|
| 381 |
-
" <td>NaN</td>\n",
|
| 382 |
-
" <td>NaN</td>\n",
|
| 383 |
-
" <td>NaN</td>\n",
|
| 384 |
-
" <td>Cis</td>\n",
|
| 385 |
-
" <td>(unidentified)</td>\n",
|
| 386 |
-
" <td>Cis (unidentified)</td>\n",
|
| 387 |
-
" <td>EOL</td>\n",
|
| 388 |
-
" </tr>\n",
|
| 389 |
-
" <tr>\n",
|
| 390 |
-
" <th>7268955</th>\n",
|
| 391 |
-
" <td>228a79c2-a482-4cd4-9a56-a000c4780b68</td>\n",
|
| 392 |
-
" <td>14842294.0</td>\n",
|
| 393 |
-
" <td>64429582.0</td>\n",
|
| 394 |
" <td>NaN</td>\n",
|
| 395 |
" <td>NaN</td>\n",
|
| 396 |
" <td>NaN</td>\n",
|
|
@@ -401,16 +438,16 @@
|
|
| 401 |
" <td>NaN</td>\n",
|
| 402 |
" <td>NaN</td>\n",
|
| 403 |
" <td>NaN</td>\n",
|
| 404 |
-
" <td>
|
| 405 |
" <td>(unidentified)</td>\n",
|
| 406 |
-
" <td>
|
| 407 |
" <td>EOL</td>\n",
|
| 408 |
" </tr>\n",
|
| 409 |
" <tr>\n",
|
| 410 |
-
" <th>
|
| 411 |
-
" <td>
|
| 412 |
-
" <td>
|
| 413 |
-
" <td>
|
| 414 |
" <td>NaN</td>\n",
|
| 415 |
" <td>NaN</td>\n",
|
| 416 |
" <td>NaN</td>\n",
|
|
@@ -421,16 +458,16 @@
|
|
| 421 |
" <td>NaN</td>\n",
|
| 422 |
" <td>NaN</td>\n",
|
| 423 |
" <td>NaN</td>\n",
|
| 424 |
-
" <td>
|
| 425 |
" <td>(unidentified)</td>\n",
|
| 426 |
-
" <td>
|
| 427 |
" <td>EOL</td>\n",
|
| 428 |
" </tr>\n",
|
| 429 |
" <tr>\n",
|
| 430 |
-
" <th>
|
| 431 |
-
" <td>
|
| 432 |
-
" <td>
|
| 433 |
-
" <td>
|
| 434 |
" <td>NaN</td>\n",
|
| 435 |
" <td>NaN</td>\n",
|
| 436 |
" <td>NaN</td>\n",
|
|
@@ -441,16 +478,16 @@
|
|
| 441 |
" <td>NaN</td>\n",
|
| 442 |
" <td>NaN</td>\n",
|
| 443 |
" <td>NaN</td>\n",
|
| 444 |
-
" <td>
|
| 445 |
" <td>(unidentified)</td>\n",
|
| 446 |
-
" <td>
|
| 447 |
" <td>EOL</td>\n",
|
| 448 |
" </tr>\n",
|
| 449 |
" <tr>\n",
|
| 450 |
-
" <th>
|
| 451 |
-
" <td>
|
| 452 |
-
" <td>
|
| 453 |
-
" <td>
|
| 454 |
" <td>NaN</td>\n",
|
| 455 |
" <td>NaN</td>\n",
|
| 456 |
" <td>NaN</td>\n",
|
|
@@ -461,9 +498,9 @@
|
|
| 461 |
" <td>NaN</td>\n",
|
| 462 |
" <td>NaN</td>\n",
|
| 463 |
" <td>NaN</td>\n",
|
| 464 |
-
" <td>
|
| 465 |
" <td>(unidentified)</td>\n",
|
| 466 |
-
" <td>
|
| 467 |
" <td>EOL</td>\n",
|
| 468 |
" </tr>\n",
|
| 469 |
" <tr>\n",
|
|
@@ -487,50 +524,10 @@
|
|
| 487 |
" <td>EOL</td>\n",
|
| 488 |
" </tr>\n",
|
| 489 |
" <tr>\n",
|
| 490 |
-
" <th>
|
| 491 |
-
" <td>
|
| 492 |
-
" <td>
|
| 493 |
-
" <td>
|
| 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>NaN</td>\n",
|
| 502 |
-
" <td>NaN</td>\n",
|
| 503 |
-
" <td>NaN</td>\n",
|
| 504 |
-
" <td>Entoloma</td>\n",
|
| 505 |
-
" <td>(unidentified)</td>\n",
|
| 506 |
-
" <td>Entoloma (unidentified)</td>\n",
|
| 507 |
-
" <td>EOL</td>\n",
|
| 508 |
-
" </tr>\n",
|
| 509 |
-
" <tr>\n",
|
| 510 |
-
" <th>1138925</th>\n",
|
| 511 |
-
" <td>2b4c8067-3595-4d87-897e-9d3600e3a86f</td>\n",
|
| 512 |
-
" <td>14842566.0</td>\n",
|
| 513 |
-
" <td>64430882.0</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>NaN</td>\n",
|
| 521 |
-
" <td>NaN</td>\n",
|
| 522 |
-
" <td>NaN</td>\n",
|
| 523 |
-
" <td>NaN</td>\n",
|
| 524 |
-
" <td>Hydropsyche</td>\n",
|
| 525 |
-
" <td>(unidentified)</td>\n",
|
| 526 |
-
" <td>Hydropsyche (unidentified)</td>\n",
|
| 527 |
-
" <td>EOL</td>\n",
|
| 528 |
-
" </tr>\n",
|
| 529 |
-
" <tr>\n",
|
| 530 |
-
" <th>2018314</th>\n",
|
| 531 |
-
" <td>2726bcc0-5c18-401a-a0a0-ad4a2cb4e302</td>\n",
|
| 532 |
-
" <td>14845986.0</td>\n",
|
| 533 |
-
" <td>64426150.0</td>\n",
|
| 534 |
" <td>NaN</td>\n",
|
| 535 |
" <td>NaN</td>\n",
|
| 536 |
" <td>NaN</td>\n",
|
|
@@ -541,16 +538,16 @@
|
|
| 541 |
" <td>NaN</td>\n",
|
| 542 |
" <td>NaN</td>\n",
|
| 543 |
" <td>NaN</td>\n",
|
| 544 |
-
" <td>
|
| 545 |
" <td>(unidentified)</td>\n",
|
| 546 |
-
" <td>
|
| 547 |
" <td>EOL</td>\n",
|
| 548 |
" </tr>\n",
|
| 549 |
" <tr>\n",
|
| 550 |
-
" <th>
|
| 551 |
-
" <td>
|
| 552 |
-
" <td>
|
| 553 |
-
" <td>
|
| 554 |
" <td>NaN</td>\n",
|
| 555 |
" <td>NaN</td>\n",
|
| 556 |
" <td>NaN</td>\n",
|
|
@@ -561,9 +558,9 @@
|
|
| 561 |
" <td>NaN</td>\n",
|
| 562 |
" <td>NaN</td>\n",
|
| 563 |
" <td>NaN</td>\n",
|
| 564 |
-
" <td>
|
| 565 |
" <td>(unidentified)</td>\n",
|
| 566 |
-
" <td>
|
| 567 |
" <td>EOL</td>\n",
|
| 568 |
" </tr>\n",
|
| 569 |
" </tbody>\n",
|
|
@@ -571,62 +568,50 @@
|
|
| 571 |
"</div>"
|
| 572 |
],
|
| 573 |
"text/plain": [
|
| 574 |
-
"
|
| 575 |
-
"
|
| 576 |
-
"
|
| 577 |
-
"
|
| 578 |
-
"
|
| 579 |
-
"
|
| 580 |
-
"
|
| 581 |
-
"
|
| 582 |
-
"1138925 2b4c8067-3595-4d87-897e-9d3600e3a86f 14842566.0 64430882.0 \n",
|
| 583 |
-
"2018314 2726bcc0-5c18-401a-a0a0-ad4a2cb4e302 14845986.0 64426150.0 \n",
|
| 584 |
-
"1675874 578809ee-126c-468e-a39b-2878e1dafc21 14845571.0 64431544.0 \n",
|
| 585 |
"\n",
|
| 586 |
-
"
|
| 587 |
-
"
|
| 588 |
-
"
|
| 589 |
-
"
|
| 590 |
-
"
|
| 591 |
-
"
|
| 592 |
-
"
|
| 593 |
-
"
|
| 594 |
-
"1138925 NaN NaN NaN NaN \n",
|
| 595 |
-
"2018314 NaN NaN NaN NaN \n",
|
| 596 |
-
"1675874 NaN NaN NaN NaN \n",
|
| 597 |
"\n",
|
| 598 |
-
"
|
| 599 |
-
"
|
| 600 |
-
"
|
| 601 |
-
"
|
| 602 |
-
"
|
| 603 |
-
"
|
| 604 |
-
"
|
| 605 |
-
"
|
| 606 |
-
"1138925 NaN NaN NaN NaN NaN NaN Hydropsyche \n",
|
| 607 |
-
"2018314 NaN NaN NaN NaN NaN NaN Chlorophyta \n",
|
| 608 |
-
"1675874 NaN NaN NaN NaN NaN NaN Porifera \n",
|
| 609 |
"\n",
|
| 610 |
-
"
|
| 611 |
-
"
|
| 612 |
-
"
|
| 613 |
-
"
|
| 614 |
-
"
|
| 615 |
-
"
|
| 616 |
-
"
|
| 617 |
-
"
|
| 618 |
-
"1138925 (unidentified) Hydropsyche (unidentified) EOL \n",
|
| 619 |
-
"2018314 (unidentified) Chlorophyta (unidentified) EOL \n",
|
| 620 |
-
"1675874 (unidentified) Porifera (unidentified) EOL "
|
| 621 |
]
|
| 622 |
},
|
| 623 |
-
"execution_count":
|
| 624 |
"metadata": {},
|
| 625 |
"output_type": "execute_result"
|
| 626 |
}
|
| 627 |
],
|
| 628 |
"source": [
|
| 629 |
-
"df.loc[df.species == \"(unidentified)\"].sample(
|
| 630 |
]
|
| 631 |
},
|
| 632 |
{
|
|
@@ -680,19 +665,19 @@
|
|
| 680 |
"output_type": "stream",
|
| 681 |
"text": [
|
| 682 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 683 |
-
"Index:
|
| 684 |
"Data columns (total 7 columns):\n",
|
| 685 |
" # Column Non-Null Count Dtype \n",
|
| 686 |
"--- ------ -------------- ----- \n",
|
| 687 |
-
" 0 kingdom
|
| 688 |
-
" 1 phylum
|
| 689 |
-
" 2 class
|
| 690 |
-
" 3 order
|
| 691 |
-
" 4 family
|
| 692 |
-
" 5 genus
|
| 693 |
-
" 6 species
|
| 694 |
"dtypes: object(7)\n",
|
| 695 |
-
"memory usage:
|
| 696 |
]
|
| 697 |
}
|
| 698 |
],
|
|
@@ -705,23 +690,23 @@
|
|
| 705 |
"metadata": {},
|
| 706 |
"source": [
|
| 707 |
"We should have\n",
|
| 708 |
-
" -
|
| 709 |
-
" -
|
| 710 |
-
" -
|
| 711 |
]
|
| 712 |
},
|
| 713 |
{
|
| 714 |
"cell_type": "code",
|
| 715 |
-
"execution_count":
|
| 716 |
"metadata": {},
|
| 717 |
"outputs": [
|
| 718 |
{
|
| 719 |
"data": {
|
| 720 |
"text/plain": [
|
| 721 |
-
"
|
| 722 |
]
|
| 723 |
},
|
| 724 |
-
"execution_count":
|
| 725 |
"metadata": {},
|
| 726 |
"output_type": "execute_result"
|
| 727 |
}
|
|
@@ -734,12 +719,12 @@
|
|
| 734 |
"cell_type": "markdown",
|
| 735 |
"metadata": {},
|
| 736 |
"source": [
|
| 737 |
-
"
|
| 738 |
]
|
| 739 |
},
|
| 740 |
{
|
| 741 |
"cell_type": "code",
|
| 742 |
-
"execution_count":
|
| 743 |
"metadata": {},
|
| 744 |
"outputs": [],
|
| 745 |
"source": [
|
|
@@ -748,7 +733,7 @@
|
|
| 748 |
},
|
| 749 |
{
|
| 750 |
"cell_type": "code",
|
| 751 |
-
"execution_count":
|
| 752 |
"metadata": {},
|
| 753 |
"outputs": [
|
| 754 |
{
|
|
@@ -756,19 +741,19 @@
|
|
| 756 |
"output_type": "stream",
|
| 757 |
"text": [
|
| 758 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 759 |
-
"Index:
|
| 760 |
"Data columns (total 7 columns):\n",
|
| 761 |
" # Column Non-Null Count Dtype \n",
|
| 762 |
"--- ------ -------------- ----- \n",
|
| 763 |
-
" 0 kingdom
|
| 764 |
-
" 1 phylum
|
| 765 |
-
" 2 class
|
| 766 |
-
" 3 order
|
| 767 |
" 4 family 0 non-null object\n",
|
| 768 |
" 5 genus 0 non-null object\n",
|
| 769 |
" 6 species 0 non-null object\n",
|
| 770 |
"dtypes: object(7)\n",
|
| 771 |
-
"memory usage:
|
| 772 |
]
|
| 773 |
}
|
| 774 |
],
|
|
@@ -780,12 +765,12 @@
|
|
| 780 |
"cell_type": "markdown",
|
| 781 |
"metadata": {},
|
| 782 |
"source": [
|
| 783 |
-
"Only
|
| 784 |
]
|
| 785 |
},
|
| 786 |
{
|
| 787 |
"cell_type": "code",
|
| 788 |
-
"execution_count":
|
| 789 |
"metadata": {},
|
| 790 |
"outputs": [
|
| 791 |
{
|
|
@@ -793,19 +778,19 @@
|
|
| 793 |
"output_type": "stream",
|
| 794 |
"text": [
|
| 795 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 796 |
-
"Index:
|
| 797 |
"Data columns (total 7 columns):\n",
|
| 798 |
" # Column Non-Null Count Dtype \n",
|
| 799 |
"--- ------ -------------- ----- \n",
|
| 800 |
-
" 0 kingdom
|
| 801 |
-
" 1 phylum
|
| 802 |
-
" 2 class
|
| 803 |
-
" 3 order
|
| 804 |
-
" 4 family
|
| 805 |
" 5 genus 0 non-null object\n",
|
| 806 |
-
" 6 species
|
| 807 |
"dtypes: object(7)\n",
|
| 808 |
-
"memory usage:
|
| 809 |
]
|
| 810 |
}
|
| 811 |
],
|
|
@@ -817,7 +802,7 @@
|
|
| 817 |
"cell_type": "markdown",
|
| 818 |
"metadata": {},
|
| 819 |
"source": [
|
| 820 |
-
"For `family`, there should be a warning that
|
| 821 |
]
|
| 822 |
},
|
| 823 |
{
|
|
@@ -829,7 +814,7 @@
|
|
| 829 |
},
|
| 830 |
{
|
| 831 |
"cell_type": "code",
|
| 832 |
-
"execution_count":
|
| 833 |
"metadata": {},
|
| 834 |
"outputs": [
|
| 835 |
{
|
|
@@ -837,19 +822,19 @@
|
|
| 837 |
"output_type": "stream",
|
| 838 |
"text": [
|
| 839 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 840 |
-
"Index:
|
| 841 |
"Data columns (total 7 columns):\n",
|
| 842 |
" # Column Non-Null Count Dtype \n",
|
| 843 |
"--- ------ -------------- ----- \n",
|
| 844 |
-
" 0 kingdom
|
| 845 |
-
" 1 phylum
|
| 846 |
-
" 2 class
|
| 847 |
-
" 3 order
|
| 848 |
-
" 4 family
|
| 849 |
" 5 genus 0 non-null object\n",
|
| 850 |
-
" 6 species
|
| 851 |
"dtypes: object(7)\n",
|
| 852 |
-
"memory usage: 6.
|
| 853 |
]
|
| 854 |
}
|
| 855 |
],
|
|
@@ -863,12 +848,85 @@
|
|
| 863 |
"source": [
|
| 864 |
"We should have\n",
|
| 865 |
" - no instances of missing `kingdom`, `phylum`, `order`, or `family` \n",
|
| 866 |
-
" -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 867 |
]
|
| 868 |
},
|
| 869 |
{
|
| 870 |
"cell_type": "markdown",
|
| 871 |
"metadata": {},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 872 |
"source": []
|
| 873 |
}
|
| 874 |
],
|
|
|
|
| 18 |
"name": "stderr",
|
| 19 |
"output_type": "stream",
|
| 20 |
"text": [
|
| 21 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_83240/3694103411.py:1: DtypeWarning: Columns (4,5,6) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
| 22 |
" df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
|
| 23 |
]
|
| 24 |
}
|
|
|
|
| 56 |
"output_type": "stream",
|
| 57 |
"text": [
|
| 58 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 59 |
+
"Index: 1000 entries, 1098219 to 6735833\n",
|
| 60 |
"Data columns (total 17 columns):\n",
|
| 61 |
" # Column Non-Null Count Dtype \n",
|
| 62 |
"--- ------ -------------- ----- \n",
|
| 63 |
" 0 treeoflife_id 1000 non-null object \n",
|
| 64 |
+
" 1 eol_content_id 860 non-null float64\n",
|
| 65 |
+
" 2 eol_page_id 860 non-null float64\n",
|
| 66 |
+
" 3 bioscan_part 140 non-null float64\n",
|
| 67 |
+
" 4 bioscan_filename 140 non-null object \n",
|
| 68 |
+
" 5 inat21_filename 0 non-null object \n",
|
| 69 |
+
" 6 inat21_cls_name 0 non-null object \n",
|
| 70 |
+
" 7 inat21_cls_num 0 non-null float64\n",
|
| 71 |
+
" 8 kingdom 633 non-null object \n",
|
| 72 |
+
" 9 phylum 633 non-null object \n",
|
| 73 |
+
" 10 class 499 non-null object \n",
|
| 74 |
+
" 11 order 626 non-null object \n",
|
| 75 |
+
" 12 family 632 non-null object \n",
|
| 76 |
+
" 13 genus 668 non-null object \n",
|
| 77 |
+
" 14 species 544 non-null object \n",
|
| 78 |
" 15 common 1000 non-null object \n",
|
| 79 |
" 16 data_source 1000 non-null object \n",
|
| 80 |
"dtypes: float64(4), object(13)\n",
|
|
|
|
| 83 |
}
|
| 84 |
],
|
| 85 |
"source": [
|
| 86 |
+
"df_small = df.loc[df.data_source != 'iNat21'].sample(1000)\n",
|
| 87 |
"df_small.info(show_counts = True)"
|
| 88 |
]
|
| 89 |
},
|
|
|
|
| 97 |
"output_type": "stream",
|
| 98 |
"text": [
|
| 99 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 100 |
+
"Index: 668 entries, 3494190 to 4498346\n",
|
| 101 |
"Data columns (total 17 columns):\n",
|
| 102 |
" # Column Non-Null Count Dtype \n",
|
| 103 |
"--- ------ -------------- ----- \n",
|
| 104 |
+
" 0 treeoflife_id 668 non-null object \n",
|
| 105 |
+
" 1 eol_content_id 646 non-null float64\n",
|
| 106 |
+
" 2 eol_page_id 646 non-null float64\n",
|
| 107 |
+
" 3 bioscan_part 22 non-null float64\n",
|
| 108 |
+
" 4 bioscan_filename 22 non-null object \n",
|
| 109 |
+
" 5 inat21_filename 0 non-null object \n",
|
| 110 |
+
" 6 inat21_cls_name 0 non-null object \n",
|
| 111 |
+
" 7 inat21_cls_num 0 non-null float64\n",
|
| 112 |
+
" 8 kingdom 498 non-null object \n",
|
| 113 |
+
" 9 phylum 498 non-null object \n",
|
| 114 |
+
" 10 class 365 non-null object \n",
|
| 115 |
+
" 11 order 491 non-null object \n",
|
| 116 |
+
" 12 family 498 non-null object \n",
|
| 117 |
+
" 13 genus 668 non-null object \n",
|
| 118 |
+
" 14 species 544 non-null object \n",
|
| 119 |
+
" 15 common 668 non-null object \n",
|
| 120 |
+
" 16 data_source 668 non-null object \n",
|
| 121 |
"dtypes: float64(4), object(13)\n",
|
| 122 |
+
"memory usage: 93.9+ KB\n"
|
| 123 |
]
|
| 124 |
}
|
| 125 |
],
|
|
|
|
| 171 |
}
|
| 172 |
],
|
| 173 |
"source": [
|
| 174 |
+
"bio_eol = df.loc[df.data_source != 'iNat21']\n",
|
| 175 |
"null_genus = bio_eol.loc[bio_eol.genus.isna()]\n",
|
| 176 |
"null_genus.info(show_counts = True)"
|
| 177 |
]
|
|
|
|
| 201 |
},
|
| 202 |
{
|
| 203 |
"cell_type": "code",
|
| 204 |
+
"execution_count": 8,
|
| 205 |
"metadata": {},
|
| 206 |
"outputs": [
|
| 207 |
{
|
| 208 |
"data": {
|
| 209 |
"text/plain": [
|
| 210 |
+
"5862285 cochleariifolia\n",
|
| 211 |
+
"3874515 oligosperma\n",
|
| 212 |
+
"4210027 polioptila caerulea\n",
|
| 213 |
+
"1482223 stigmaticus stigmaticus\n",
|
| 214 |
+
"2165326 umbellatum\n",
|
| 215 |
+
"6966418 contractus\n",
|
| 216 |
+
"4224046 marginatus\n",
|
| 217 |
+
"10349676 salpinctes obsoletus\n",
|
| 218 |
+
"6994793 bimaculata\n",
|
| 219 |
+
"4775194 olivaris\n",
|
| 220 |
"Name: species, dtype: object"
|
| 221 |
]
|
| 222 |
},
|
| 223 |
+
"execution_count": 8,
|
| 224 |
"metadata": {},
|
| 225 |
"output_type": "execute_result"
|
| 226 |
}
|
|
|
|
| 231 |
},
|
| 232 |
{
|
| 233 |
"cell_type": "code",
|
| 234 |
+
"execution_count": 9,
|
| 235 |
"metadata": {},
|
| 236 |
"outputs": [
|
| 237 |
{
|
| 238 |
"name": "stdout",
|
| 239 |
"output_type": "stream",
|
| 240 |
"text": [
|
| 241 |
+
"180\n"
|
| 242 |
]
|
| 243 |
}
|
| 244 |
],
|
|
|
|
| 254 |
"cell_type": "markdown",
|
| 255 |
"metadata": {},
|
| 256 |
"source": [
|
| 257 |
+
"Check `(unidentified)` is represented in our sample (see note below)."
|
| 258 |
]
|
| 259 |
},
|
| 260 |
{
|
| 261 |
"cell_type": "code",
|
| 262 |
+
"execution_count": 10,
|
| 263 |
+
"metadata": {},
|
| 264 |
+
"outputs": [
|
| 265 |
+
{
|
| 266 |
+
"name": "stdout",
|
| 267 |
+
"output_type": "stream",
|
| 268 |
+
"text": [
|
| 269 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 270 |
+
"Index: 0 entries\n",
|
| 271 |
+
"Data columns (total 17 columns):\n",
|
| 272 |
+
" # Column Non-Null Count Dtype \n",
|
| 273 |
+
"--- ------ -------------- ----- \n",
|
| 274 |
+
" 0 treeoflife_id 0 non-null object \n",
|
| 275 |
+
" 1 eol_content_id 0 non-null float64\n",
|
| 276 |
+
" 2 eol_page_id 0 non-null float64\n",
|
| 277 |
+
" 3 bioscan_part 0 non-null float64\n",
|
| 278 |
+
" 4 bioscan_filename 0 non-null object \n",
|
| 279 |
+
" 5 inat21_filename 0 non-null object \n",
|
| 280 |
+
" 6 inat21_cls_name 0 non-null object \n",
|
| 281 |
+
" 7 inat21_cls_num 0 non-null float64\n",
|
| 282 |
+
" 8 kingdom 0 non-null object \n",
|
| 283 |
+
" 9 phylum 0 non-null object \n",
|
| 284 |
+
" 10 class 0 non-null object \n",
|
| 285 |
+
" 11 order 0 non-null object \n",
|
| 286 |
+
" 12 family 0 non-null object \n",
|
| 287 |
+
" 13 genus 0 non-null object \n",
|
| 288 |
+
" 14 species 0 non-null object \n",
|
| 289 |
+
" 15 common 0 non-null object \n",
|
| 290 |
+
" 16 data_source 0 non-null object \n",
|
| 291 |
+
"dtypes: float64(4), object(13)\n",
|
| 292 |
+
"memory usage: 0.0+ bytes\n"
|
| 293 |
+
]
|
| 294 |
+
}
|
| 295 |
+
],
|
| 296 |
+
"source": [
|
| 297 |
+
"df_test.loc[df_test.species == \"(unidentified)\"].info(show_counts = True)"
|
| 298 |
+
]
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"cell_type": "code",
|
| 302 |
+
"execution_count": 12,
|
| 303 |
"metadata": {},
|
| 304 |
"outputs": [],
|
| 305 |
"source": [
|
| 306 |
+
"df_test = pd.concat([df_test, df.loc[df.species == \"(unidentified)\"].sample(10)])"
|
| 307 |
]
|
| 308 |
},
|
| 309 |
{
|
| 310 |
"cell_type": "markdown",
|
| 311 |
"metadata": {},
|
| 312 |
"source": [
|
| 313 |
+
"Good, these are now represented too, so we can save this file."
|
| 314 |
]
|
| 315 |
},
|
| 316 |
{
|
| 317 |
"cell_type": "code",
|
| 318 |
+
"execution_count": 13,
|
| 319 |
+
"metadata": {},
|
| 320 |
+
"outputs": [],
|
| 321 |
+
"source": [
|
| 322 |
+
"# Don't overwrite current test set (but is in VC)\n",
|
| 323 |
+
"#df_test.to_csv(\"../data/tol_hierarchy_test.csv\", index = False)"
|
| 324 |
+
]
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"cell_type": "markdown",
|
| 328 |
+
"metadata": {},
|
| 329 |
+
"source": [
|
| 330 |
+
"There is also apparently a species which is labeled as `(unidentified)` (found in earlier run). Let's check where that is and if there's more than one (in our full dataset)."
|
| 331 |
+
]
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"cell_type": "code",
|
| 335 |
+
"execution_count": 11,
|
| 336 |
"metadata": {},
|
| 337 |
"outputs": [
|
| 338 |
{
|
|
|
|
| 379 |
},
|
| 380 |
{
|
| 381 |
"cell_type": "code",
|
| 382 |
+
"execution_count": 12,
|
| 383 |
"metadata": {},
|
| 384 |
"outputs": [
|
| 385 |
{
|
|
|
|
| 424 |
" </thead>\n",
|
| 425 |
" <tbody>\n",
|
| 426 |
" <tr>\n",
|
| 427 |
+
" <th>708128</th>\n",
|
| 428 |
+
" <td>d8ec4f3a-9f7d-45f8-af94-a9e6bc243d3b</td>\n",
|
| 429 |
+
" <td>14845132.0</td>\n",
|
| 430 |
+
" <td>64427694.0</td>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
" <td>NaN</td>\n",
|
| 432 |
" <td>NaN</td>\n",
|
| 433 |
" <td>NaN</td>\n",
|
|
|
|
| 438 |
" <td>NaN</td>\n",
|
| 439 |
" <td>NaN</td>\n",
|
| 440 |
" <td>NaN</td>\n",
|
| 441 |
+
" <td>Ascomycota</td>\n",
|
| 442 |
" <td>(unidentified)</td>\n",
|
| 443 |
+
" <td>Ascomycota (unidentified)</td>\n",
|
| 444 |
" <td>EOL</td>\n",
|
| 445 |
" </tr>\n",
|
| 446 |
" <tr>\n",
|
| 447 |
+
" <th>1746638</th>\n",
|
| 448 |
+
" <td>ae9457b9-9f7f-404a-87b8-0c69b2082a54</td>\n",
|
| 449 |
+
" <td>14844829.0</td>\n",
|
| 450 |
+
" <td>64428954.0</td>\n",
|
| 451 |
" <td>NaN</td>\n",
|
| 452 |
" <td>NaN</td>\n",
|
| 453 |
" <td>NaN</td>\n",
|
|
|
|
| 458 |
" <td>NaN</td>\n",
|
| 459 |
" <td>NaN</td>\n",
|
| 460 |
" <td>NaN</td>\n",
|
| 461 |
+
" <td>Noctuidae</td>\n",
|
| 462 |
" <td>(unidentified)</td>\n",
|
| 463 |
+
" <td>Noctuidae (unidentified)</td>\n",
|
| 464 |
" <td>EOL</td>\n",
|
| 465 |
" </tr>\n",
|
| 466 |
" <tr>\n",
|
| 467 |
+
" <th>74672</th>\n",
|
| 468 |
+
" <td>d00a6cdd-3ac4-4eca-98dc-8fe03c006dab</td>\n",
|
| 469 |
+
" <td>14845091.0</td>\n",
|
| 470 |
+
" <td>64429560.0</td>\n",
|
| 471 |
" <td>NaN</td>\n",
|
| 472 |
" <td>NaN</td>\n",
|
| 473 |
" <td>NaN</td>\n",
|
|
|
|
| 478 |
" <td>NaN</td>\n",
|
| 479 |
" <td>NaN</td>\n",
|
| 480 |
" <td>NaN</td>\n",
|
| 481 |
+
" <td>Limonia</td>\n",
|
| 482 |
" <td>(unidentified)</td>\n",
|
| 483 |
+
" <td>Limonia (unidentified)</td>\n",
|
| 484 |
" <td>EOL</td>\n",
|
| 485 |
" </tr>\n",
|
| 486 |
" <tr>\n",
|
| 487 |
+
" <th>7041469</th>\n",
|
| 488 |
+
" <td>3c02258d-c93d-400c-846e-d63c1064aa55</td>\n",
|
| 489 |
+
" <td>14843807.0</td>\n",
|
| 490 |
+
" <td>64430930.0</td>\n",
|
| 491 |
" <td>NaN</td>\n",
|
| 492 |
" <td>NaN</td>\n",
|
| 493 |
" <td>NaN</td>\n",
|
|
|
|
| 498 |
" <td>NaN</td>\n",
|
| 499 |
" <td>NaN</td>\n",
|
| 500 |
" <td>NaN</td>\n",
|
| 501 |
+
" <td>Panorpa</td>\n",
|
| 502 |
" <td>(unidentified)</td>\n",
|
| 503 |
+
" <td>Panorpa (unidentified)</td>\n",
|
| 504 |
" <td>EOL</td>\n",
|
| 505 |
" </tr>\n",
|
| 506 |
" <tr>\n",
|
|
|
|
| 524 |
" <td>EOL</td>\n",
|
| 525 |
" </tr>\n",
|
| 526 |
" <tr>\n",
|
| 527 |
+
" <th>1462517</th>\n",
|
| 528 |
+
" <td>5ac64348-e45f-4c54-8316-379543ea1ab2</td>\n",
|
| 529 |
+
" <td>14845057.0</td>\n",
|
| 530 |
+
" <td>64427448.0</td>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
" <td>NaN</td>\n",
|
| 532 |
" <td>NaN</td>\n",
|
| 533 |
" <td>NaN</td>\n",
|
|
|
|
| 538 |
" <td>NaN</td>\n",
|
| 539 |
" <td>NaN</td>\n",
|
| 540 |
" <td>NaN</td>\n",
|
| 541 |
+
" <td>Amerosporium</td>\n",
|
| 542 |
" <td>(unidentified)</td>\n",
|
| 543 |
+
" <td>Amerosporium (unidentified)</td>\n",
|
| 544 |
" <td>EOL</td>\n",
|
| 545 |
" </tr>\n",
|
| 546 |
" <tr>\n",
|
| 547 |
+
" <th>4604554</th>\n",
|
| 548 |
+
" <td>5b222d55-b57d-4b3e-bbdc-837fce856b0a</td>\n",
|
| 549 |
+
" <td>14844676.0</td>\n",
|
| 550 |
+
" <td>64430148.0</td>\n",
|
| 551 |
" <td>NaN</td>\n",
|
| 552 |
" <td>NaN</td>\n",
|
| 553 |
" <td>NaN</td>\n",
|
|
|
|
| 558 |
" <td>NaN</td>\n",
|
| 559 |
" <td>NaN</td>\n",
|
| 560 |
" <td>NaN</td>\n",
|
| 561 |
+
" <td>Symphyta</td>\n",
|
| 562 |
" <td>(unidentified)</td>\n",
|
| 563 |
+
" <td>Symphyta (unidentified)</td>\n",
|
| 564 |
" <td>EOL</td>\n",
|
| 565 |
" </tr>\n",
|
| 566 |
" </tbody>\n",
|
|
|
|
| 568 |
"</div>"
|
| 569 |
],
|
| 570 |
"text/plain": [
|
| 571 |
+
" treeoflife_id eol_content_id eol_page_id \n",
|
| 572 |
+
"708128 d8ec4f3a-9f7d-45f8-af94-a9e6bc243d3b 14845132.0 64427694.0 \\\n",
|
| 573 |
+
"1746638 ae9457b9-9f7f-404a-87b8-0c69b2082a54 14844829.0 64428954.0 \n",
|
| 574 |
+
"74672 d00a6cdd-3ac4-4eca-98dc-8fe03c006dab 14845091.0 64429560.0 \n",
|
| 575 |
+
"7041469 3c02258d-c93d-400c-846e-d63c1064aa55 14843807.0 64430930.0 \n",
|
| 576 |
+
"972647 01633bbe-44f9-4e8d-b4db-d2d9678906eb 14845039.0 64429476.0 \n",
|
| 577 |
+
"1462517 5ac64348-e45f-4c54-8316-379543ea1ab2 14845057.0 64427448.0 \n",
|
| 578 |
+
"4604554 5b222d55-b57d-4b3e-bbdc-837fce856b0a 14844676.0 64430148.0 \n",
|
|
|
|
|
|
|
|
|
|
| 579 |
"\n",
|
| 580 |
+
" bioscan_part bioscan_filename inat21_filename inat21_cls_name \n",
|
| 581 |
+
"708128 NaN NaN NaN NaN \\\n",
|
| 582 |
+
"1746638 NaN NaN NaN NaN \n",
|
| 583 |
+
"74672 NaN NaN NaN NaN \n",
|
| 584 |
+
"7041469 NaN NaN NaN NaN \n",
|
| 585 |
+
"972647 NaN NaN NaN NaN \n",
|
| 586 |
+
"1462517 NaN NaN NaN NaN \n",
|
| 587 |
+
"4604554 NaN NaN NaN NaN \n",
|
|
|
|
|
|
|
|
|
|
| 588 |
"\n",
|
| 589 |
+
" inat21_cls_num kingdom phylum class order family genus \n",
|
| 590 |
+
"708128 NaN NaN NaN NaN NaN NaN Ascomycota \\\n",
|
| 591 |
+
"1746638 NaN NaN NaN NaN NaN NaN Noctuidae \n",
|
| 592 |
+
"74672 NaN NaN NaN NaN NaN NaN Limonia \n",
|
| 593 |
+
"7041469 NaN NaN NaN NaN NaN NaN Panorpa \n",
|
| 594 |
+
"972647 NaN NaN NaN NaN NaN NaN Cheilosia \n",
|
| 595 |
+
"1462517 NaN NaN NaN NaN NaN NaN Amerosporium \n",
|
| 596 |
+
"4604554 NaN NaN NaN NaN NaN NaN Symphyta \n",
|
|
|
|
|
|
|
|
|
|
| 597 |
"\n",
|
| 598 |
+
" species common data_source \n",
|
| 599 |
+
"708128 (unidentified) Ascomycota (unidentified) EOL \n",
|
| 600 |
+
"1746638 (unidentified) Noctuidae (unidentified) EOL \n",
|
| 601 |
+
"74672 (unidentified) Limonia (unidentified) EOL \n",
|
| 602 |
+
"7041469 (unidentified) Panorpa (unidentified) EOL \n",
|
| 603 |
+
"972647 (unidentified) Cheilosia (unidentified) EOL \n",
|
| 604 |
+
"1462517 (unidentified) Amerosporium (unidentified) EOL \n",
|
| 605 |
+
"4604554 (unidentified) Symphyta (unidentified) EOL "
|
|
|
|
|
|
|
|
|
|
| 606 |
]
|
| 607 |
},
|
| 608 |
+
"execution_count": 12,
|
| 609 |
"metadata": {},
|
| 610 |
"output_type": "execute_result"
|
| 611 |
}
|
| 612 |
],
|
| 613 |
"source": [
|
| 614 |
+
"df.loc[df.species == \"(unidentified)\"].sample(7)"
|
| 615 |
]
|
| 616 |
},
|
| 617 |
{
|
|
|
|
| 665 |
"output_type": "stream",
|
| 666 |
"text": [
|
| 667 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 668 |
+
"Index: 678 entries, 3494190 to 2887231\n",
|
| 669 |
"Data columns (total 7 columns):\n",
|
| 670 |
" # Column Non-Null Count Dtype \n",
|
| 671 |
"--- ------ -------------- ----- \n",
|
| 672 |
+
" 0 kingdom 498 non-null object\n",
|
| 673 |
+
" 1 phylum 498 non-null object\n",
|
| 674 |
+
" 2 class 365 non-null object\n",
|
| 675 |
+
" 3 order 491 non-null object\n",
|
| 676 |
+
" 4 family 498 non-null object\n",
|
| 677 |
+
" 5 genus 678 non-null object\n",
|
| 678 |
+
" 6 species 554 non-null object\n",
|
| 679 |
"dtypes: object(7)\n",
|
| 680 |
+
"memory usage: 42.4+ KB\n"
|
| 681 |
]
|
| 682 |
}
|
| 683 |
],
|
|
|
|
| 690 |
"metadata": {},
|
| 691 |
"source": [
|
| 692 |
"We should have\n",
|
| 693 |
+
" - 180 missing `kingdom`, `phylum`, and `family` -- These numbers will not always be the same\n",
|
| 694 |
+
" - 313 missing `class`\n",
|
| 695 |
+
" - 187 missing `order`"
|
| 696 |
]
|
| 697 |
},
|
| 698 |
{
|
| 699 |
"cell_type": "code",
|
| 700 |
+
"execution_count": 17,
|
| 701 |
"metadata": {},
|
| 702 |
"outputs": [
|
| 703 |
{
|
| 704 |
"data": {
|
| 705 |
"text/plain": [
|
| 706 |
+
"100"
|
| 707 |
]
|
| 708 |
},
|
| 709 |
+
"execution_count": 17,
|
| 710 |
"metadata": {},
|
| 711 |
"output_type": "execute_result"
|
| 712 |
}
|
|
|
|
| 719 |
"cell_type": "markdown",
|
| 720 |
"metadata": {},
|
| 721 |
"source": [
|
| 722 |
+
"100 entries for which `species` is non-null, but `genus` is missing."
|
| 723 |
]
|
| 724 |
},
|
| 725 |
{
|
| 726 |
"cell_type": "code",
|
| 727 |
+
"execution_count": 18,
|
| 728 |
"metadata": {},
|
| 729 |
"outputs": [],
|
| 730 |
"source": [
|
|
|
|
| 733 |
},
|
| 734 |
{
|
| 735 |
"cell_type": "code",
|
| 736 |
+
"execution_count": 19,
|
| 737 |
"metadata": {},
|
| 738 |
"outputs": [
|
| 739 |
{
|
|
|
|
| 741 |
"output_type": "stream",
|
| 742 |
"text": [
|
| 743 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 744 |
+
"Index: 198 entries, 1098219 to 1167968\n",
|
| 745 |
"Data columns (total 7 columns):\n",
|
| 746 |
" # Column Non-Null Count Dtype \n",
|
| 747 |
"--- ------ -------------- ----- \n",
|
| 748 |
+
" 0 kingdom 1 non-null object\n",
|
| 749 |
+
" 1 phylum 1 non-null object\n",
|
| 750 |
+
" 2 class 1 non-null object\n",
|
| 751 |
+
" 3 order 1 non-null object\n",
|
| 752 |
" 4 family 0 non-null object\n",
|
| 753 |
" 5 genus 0 non-null object\n",
|
| 754 |
" 6 species 0 non-null object\n",
|
| 755 |
"dtypes: object(7)\n",
|
| 756 |
+
"memory usage: 12.4+ KB\n"
|
| 757 |
]
|
| 758 |
}
|
| 759 |
],
|
|
|
|
| 765 |
"cell_type": "markdown",
|
| 766 |
"metadata": {},
|
| 767 |
"source": [
|
| 768 |
+
"Only 1 instance where `family` is null and higher order taxa are not."
|
| 769 |
]
|
| 770 |
},
|
| 771 |
{
|
| 772 |
"cell_type": "code",
|
| 773 |
+
"execution_count": 20,
|
| 774 |
"metadata": {},
|
| 775 |
"outputs": [
|
| 776 |
{
|
|
|
|
| 778 |
"output_type": "stream",
|
| 779 |
"text": [
|
| 780 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 781 |
+
"Index: 234 entries, 157009 to 5416459\n",
|
| 782 |
"Data columns (total 7 columns):\n",
|
| 783 |
" # Column Non-Null Count Dtype \n",
|
| 784 |
"--- ------ -------------- ----- \n",
|
| 785 |
+
" 0 kingdom 234 non-null object\n",
|
| 786 |
+
" 1 phylum 234 non-null object\n",
|
| 787 |
+
" 2 class 206 non-null object\n",
|
| 788 |
+
" 3 order 234 non-null object\n",
|
| 789 |
+
" 4 family 234 non-null object\n",
|
| 790 |
" 5 genus 0 non-null object\n",
|
| 791 |
+
" 6 species 100 non-null object\n",
|
| 792 |
"dtypes: object(7)\n",
|
| 793 |
+
"memory usage: 14.6+ KB\n"
|
| 794 |
]
|
| 795 |
}
|
| 796 |
],
|
|
|
|
| 802 |
"cell_type": "markdown",
|
| 803 |
"metadata": {},
|
| 804 |
"source": [
|
| 805 |
+
"For `family`, there should be a warning that 28 `class` values are not indicated."
|
| 806 |
]
|
| 807 |
},
|
| 808 |
{
|
|
|
|
| 814 |
},
|
| 815 |
{
|
| 816 |
"cell_type": "code",
|
| 817 |
+
"execution_count": 21,
|
| 818 |
"metadata": {},
|
| 819 |
"outputs": [
|
| 820 |
{
|
|
|
|
| 822 |
"output_type": "stream",
|
| 823 |
"text": [
|
| 824 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 825 |
+
"Index: 100 entries, 3723975 to 5416459\n",
|
| 826 |
"Data columns (total 7 columns):\n",
|
| 827 |
" # Column Non-Null Count Dtype \n",
|
| 828 |
"--- ------ -------------- ----- \n",
|
| 829 |
+
" 0 kingdom 100 non-null object\n",
|
| 830 |
+
" 1 phylum 100 non-null object\n",
|
| 831 |
+
" 2 class 73 non-null object\n",
|
| 832 |
+
" 3 order 100 non-null object\n",
|
| 833 |
+
" 4 family 100 non-null object\n",
|
| 834 |
" 5 genus 0 non-null object\n",
|
| 835 |
+
" 6 species 100 non-null object\n",
|
| 836 |
"dtypes: object(7)\n",
|
| 837 |
+
"memory usage: 6.2+ KB\n"
|
| 838 |
]
|
| 839 |
}
|
| 840 |
],
|
|
|
|
| 848 |
"source": [
|
| 849 |
"We should have\n",
|
| 850 |
" - no instances of missing `kingdom`, `phylum`, `order`, or `family` \n",
|
| 851 |
+
" - 73 instances of missing `class`"
|
| 852 |
+
]
|
| 853 |
+
},
|
| 854 |
+
{
|
| 855 |
+
"cell_type": "code",
|
| 856 |
+
"execution_count": 22,
|
| 857 |
+
"metadata": {},
|
| 858 |
+
"outputs": [
|
| 859 |
+
{
|
| 860 |
+
"data": {
|
| 861 |
+
"text/plain": [
|
| 862 |
+
"kingdom 4\n",
|
| 863 |
+
"phylum 15\n",
|
| 864 |
+
"class 24\n",
|
| 865 |
+
"order 107\n",
|
| 866 |
+
"family 314\n",
|
| 867 |
+
"genus 615\n",
|
| 868 |
+
"species 531\n",
|
| 869 |
+
"dtype: int64"
|
| 870 |
+
]
|
| 871 |
+
},
|
| 872 |
+
"execution_count": 22,
|
| 873 |
+
"metadata": {},
|
| 874 |
+
"output_type": "execute_result"
|
| 875 |
+
}
|
| 876 |
+
],
|
| 877 |
+
"source": [
|
| 878 |
+
"df_test_taxa.nunique()"
|
| 879 |
+
]
|
| 880 |
+
},
|
| 881 |
+
{
|
| 882 |
+
"cell_type": "markdown",
|
| 883 |
+
"metadata": {},
|
| 884 |
+
"source": [
|
| 885 |
+
"We should get a warning of 4 unique values of `kingdom`."
|
| 886 |
+
]
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
"cell_type": "code",
|
| 890 |
+
"execution_count": 23,
|
| 891 |
+
"metadata": {},
|
| 892 |
+
"outputs": [
|
| 893 |
+
{
|
| 894 |
+
"name": "stdout",
|
| 895 |
+
"output_type": "stream",
|
| 896 |
+
"text": [
|
| 897 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 898 |
+
"Index: 10 entries, 1377769 to 2887231\n",
|
| 899 |
+
"Data columns (total 7 columns):\n",
|
| 900 |
+
" # Column Non-Null Count Dtype \n",
|
| 901 |
+
"--- ------ -------------- ----- \n",
|
| 902 |
+
" 0 kingdom 0 non-null object\n",
|
| 903 |
+
" 1 phylum 0 non-null object\n",
|
| 904 |
+
" 2 class 0 non-null object\n",
|
| 905 |
+
" 3 order 0 non-null object\n",
|
| 906 |
+
" 4 family 0 non-null object\n",
|
| 907 |
+
" 5 genus 10 non-null object\n",
|
| 908 |
+
" 6 species 10 non-null object\n",
|
| 909 |
+
"dtypes: object(7)\n",
|
| 910 |
+
"memory usage: 640.0+ bytes\n"
|
| 911 |
+
]
|
| 912 |
+
}
|
| 913 |
+
],
|
| 914 |
+
"source": [
|
| 915 |
+
"df_test_taxa.loc[df_test_taxa.species == \"(unidentified)\"].info(show_counts = True)"
|
| 916 |
]
|
| 917 |
},
|
| 918 |
{
|
| 919 |
"cell_type": "markdown",
|
| 920 |
"metadata": {},
|
| 921 |
+
"source": [
|
| 922 |
+
"And 10 instances of `(unidentified)` label for species."
|
| 923 |
+
]
|
| 924 |
+
},
|
| 925 |
+
{
|
| 926 |
+
"cell_type": "code",
|
| 927 |
+
"execution_count": null,
|
| 928 |
+
"metadata": {},
|
| 929 |
+
"outputs": [],
|
| 930 |
"source": []
|
| 931 |
}
|
| 932 |
],
|