egrace479 commited on
Commit
5b076b7
·
1 Parent(s): 4ae804b

Explore content of newer media manifest (Dec. 6 download in EOL repo) and compare earlier media manifest.

Browse files
notebooks/ToL_license_check.ipynb CHANGED
@@ -29,7 +29,7 @@
29
  "name": "stderr",
30
  "output_type": "stream",
31
  "text": [
32
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_59620/4112647395.py:1: DtypeWarning: Columns (5,6,7,14,15) have mixed types. Specify dtype option on import or set low_memory=False.\n",
33
  " df = pd.read_csv(\"../data/predicted-catalog.csv\")\n"
34
  ]
35
  }
@@ -189,22 +189,22 @@
189
  "</div>"
190
  ],
191
  "text/plain": [
192
- " split treeoflife_id eol_content_id eol_page_id \n",
193
- "0 train f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0 \\\n",
194
  "1 train 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
195
  "2 train 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
196
  "3 train 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
197
  "4 train f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
198
  "\n",
199
- " bioscan_part bioscan_filename inat21_filename inat21_cls_name \n",
200
- "0 NaN NaN NaN NaN \\\n",
201
  "1 NaN NaN NaN NaN \n",
202
  "2 NaN NaN NaN NaN \n",
203
  "3 NaN NaN NaN NaN \n",
204
  "4 NaN NaN NaN NaN \n",
205
  "\n",
206
- " inat21_cls_num kingdom phylum class order \n",
207
- "0 NaN Animalia Arthropoda Insecta Lepidoptera \\\n",
208
  "1 NaN Plantae Tracheophyta Polypodiopsida Polypodiales \n",
209
  "2 NaN Animalia Chordata Aves Passeriformes \n",
210
  "3 NaN NaN NaN NaN NaN \n",
@@ -548,7 +548,7 @@
548
  },
549
  {
550
  "cell_type": "code",
551
- "execution_count": 22,
552
  "metadata": {},
553
  "outputs": [],
554
  "source": [
@@ -659,14 +659,14 @@
659
  },
660
  {
661
  "cell_type": "code",
662
- "execution_count": 6,
663
  "metadata": {},
664
  "outputs": [
665
  {
666
  "name": "stderr",
667
  "output_type": "stream",
668
  "text": [
669
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_59620/2809897267.py:1: DtypeWarning: Columns (5) have mixed types. Specify dtype option on import or set low_memory=False.\n",
670
  " media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n"
671
  ]
672
  },
@@ -724,7 +724,7 @@
724
  },
725
  {
726
  "cell_type": "code",
727
- "execution_count": 7,
728
  "metadata": {},
729
  "outputs": [],
730
  "source": [
@@ -733,7 +733,7 @@
733
  },
734
  {
735
  "cell_type": "code",
736
- "execution_count": 23,
737
  "metadata": {},
738
  "outputs": [],
739
  "source": [
@@ -958,9 +958,128 @@
958
  },
959
  {
960
  "cell_type": "code",
961
- "execution_count": null,
962
  "metadata": {},
963
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  "source": [
965
  "eol_missing_content_ids = eol_df_media.loc[eol_df_media[\"Medium Source URL\"].isna()]\n",
966
  "eol_missing_content_ids.head()"
@@ -979,19 +1098,19 @@
979
  "metadata": {},
980
  "outputs": [],
981
  "source": [
982
- "eol_missing_content_ids.to_csv(\"../data/eol_missing_content_ids.csv\", index = False)"
983
  ]
984
  },
985
  {
986
  "cell_type": "code",
987
- "execution_count": 25,
988
  "metadata": {},
989
  "outputs": [
990
  {
991
  "name": "stderr",
992
  "output_type": "stream",
993
  "text": [
994
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_74901/610094471.py:1: DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False.\n",
995
  " media_old = pd.read_csv(\"../data/media_manifest.csv\")\n"
996
  ]
997
  },
@@ -1022,7 +1141,7 @@
1022
  },
1023
  {
1024
  "cell_type": "code",
1025
- "execution_count": 26,
1026
  "metadata": {},
1027
  "outputs": [],
1028
  "source": [
@@ -1086,7 +1205,7 @@
1086
  },
1087
  {
1088
  "cell_type": "code",
1089
- "execution_count": 9,
1090
  "metadata": {},
1091
  "outputs": [],
1092
  "source": [
@@ -1097,7 +1216,7 @@
1097
  },
1098
  {
1099
  "cell_type": "code",
1100
- "execution_count": 10,
1101
  "metadata": {},
1102
  "outputs": [],
1103
  "source": [
@@ -1109,7 +1228,7 @@
1109
  },
1110
  {
1111
  "cell_type": "code",
1112
- "execution_count": 11,
1113
  "metadata": {},
1114
  "outputs": [],
1115
  "source": [
@@ -1201,7 +1320,7 @@
1201
  },
1202
  {
1203
  "cell_type": "code",
1204
- "execution_count": 13,
1205
  "metadata": {},
1206
  "outputs": [],
1207
  "source": [
@@ -1212,7 +1331,7 @@
1212
  },
1213
  {
1214
  "cell_type": "code",
1215
- "execution_count": 14,
1216
  "metadata": {},
1217
  "outputs": [],
1218
  "source": [
@@ -1222,7 +1341,7 @@
1222
  },
1223
  {
1224
  "cell_type": "code",
1225
- "execution_count": 15,
1226
  "metadata": {},
1227
  "outputs": [],
1228
  "source": [
@@ -1231,7 +1350,7 @@
1231
  },
1232
  {
1233
  "cell_type": "code",
1234
- "execution_count": 16,
1235
  "metadata": {},
1236
  "outputs": [
1237
  {
@@ -1256,7 +1375,7 @@
1256
  "dtype: int64"
1257
  ]
1258
  },
1259
- "execution_count": 16,
1260
  "metadata": {},
1261
  "output_type": "execute_result"
1262
  }
@@ -1307,9 +1426,7 @@
1307
  {
1308
  "cell_type": "code",
1309
  "execution_count": 45,
1310
- "metadata": {
1311
- "scrolled": false
1312
- },
1313
  "outputs": [
1314
  {
1315
  "data": {
@@ -1557,7 +1674,7 @@
1557
  "metadata": {},
1558
  "outputs": [],
1559
  "source": [
1560
- "eol_taxa_df_media.loc[eol_taxa_df_media[\"Medium Source URL\"].isna()].to_csv(\"../data/eol_taxa_missing_content_ids.csv\", index = False)"
1561
  ]
1562
  },
1563
  {
@@ -2074,19 +2191,1692 @@
2074
  "But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed."
2075
  ]
2076
  },
 
 
 
 
 
 
 
 
 
2077
  {
2078
  "cell_type": "code",
2079
- "execution_count": null,
2080
  "metadata": {},
2081
- "outputs": [],
2082
- "source": []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2083
  },
2084
  {
2085
  "cell_type": "code",
2086
- "execution_count": null,
2087
  "metadata": {},
2088
- "outputs": [],
2089
- "source": []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2090
  },
2091
  {
2092
  "cell_type": "markdown",
@@ -2658,5 +4448,5 @@
2658
  }
2659
  },
2660
  "nbformat": 4,
2661
- "nbformat_minor": 2
2662
  }
 
29
  "name": "stderr",
30
  "output_type": "stream",
31
  "text": [
32
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/4112647395.py:1: DtypeWarning: Columns (5,6,7,14,15) have mixed types. Specify dtype option on import or set low_memory=False.\n",
33
  " df = pd.read_csv(\"../data/predicted-catalog.csv\")\n"
34
  ]
35
  }
 
189
  "</div>"
190
  ],
191
  "text/plain": [
192
+ " split treeoflife_id eol_content_id eol_page_id \\\n",
193
+ "0 train f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0 \n",
194
  "1 train 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
195
  "2 train 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
196
  "3 train 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
197
  "4 train f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
198
  "\n",
199
+ " bioscan_part bioscan_filename inat21_filename inat21_cls_name \\\n",
200
+ "0 NaN NaN NaN NaN \n",
201
  "1 NaN NaN NaN NaN \n",
202
  "2 NaN NaN NaN NaN \n",
203
  "3 NaN NaN NaN NaN \n",
204
  "4 NaN NaN NaN NaN \n",
205
  "\n",
206
+ " inat21_cls_num kingdom phylum class order \\\n",
207
+ "0 NaN Animalia Arthropoda Insecta Lepidoptera \n",
208
  "1 NaN Plantae Tracheophyta Polypodiopsida Polypodiales \n",
209
  "2 NaN Animalia Chordata Aves Passeriformes \n",
210
  "3 NaN NaN NaN NaN NaN \n",
 
548
  },
549
  {
550
  "cell_type": "code",
551
+ "execution_count": 6,
552
  "metadata": {},
553
  "outputs": [],
554
  "source": [
 
659
  },
660
  {
661
  "cell_type": "code",
662
+ "execution_count": 7,
663
  "metadata": {},
664
  "outputs": [
665
  {
666
  "name": "stderr",
667
  "output_type": "stream",
668
  "text": [
669
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/2809897267.py:1: DtypeWarning: Columns (5) have mixed types. Specify dtype option on import or set low_memory=False.\n",
670
  " media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n"
671
  ]
672
  },
 
724
  },
725
  {
726
  "cell_type": "code",
727
+ "execution_count": 8,
728
  "metadata": {},
729
  "outputs": [],
730
  "source": [
 
733
  },
734
  {
735
  "cell_type": "code",
736
+ "execution_count": 9,
737
  "metadata": {},
738
  "outputs": [],
739
  "source": [
 
958
  },
959
  {
960
  "cell_type": "code",
961
+ "execution_count": 11,
962
  "metadata": {},
963
+ "outputs": [
964
+ {
965
+ "data": {
966
+ "text/html": [
967
+ "<div>\n",
968
+ "<style scoped>\n",
969
+ " .dataframe tbody tr th:only-of-type {\n",
970
+ " vertical-align: middle;\n",
971
+ " }\n",
972
+ "\n",
973
+ " .dataframe tbody tr th {\n",
974
+ " vertical-align: top;\n",
975
+ " }\n",
976
+ "\n",
977
+ " .dataframe thead th {\n",
978
+ " text-align: right;\n",
979
+ " }\n",
980
+ "</style>\n",
981
+ "<table border=\"1\" class=\"dataframe\">\n",
982
+ " <thead>\n",
983
+ " <tr style=\"text-align: right;\">\n",
984
+ " <th></th>\n",
985
+ " <th>treeoflife_id</th>\n",
986
+ " <th>eol_content_id</th>\n",
987
+ " <th>eol_page_id</th>\n",
988
+ " <th>EOL page ID</th>\n",
989
+ " <th>Medium Source URL</th>\n",
990
+ " <th>EOL Full-Size Copy URL</th>\n",
991
+ " <th>License Name</th>\n",
992
+ " <th>Copyright Owner</th>\n",
993
+ " </tr>\n",
994
+ " </thead>\n",
995
+ " <tbody>\n",
996
+ " <tr>\n",
997
+ " <th>126</th>\n",
998
+ " <td>4b56e165-c4d5-49f9-a321-ac9474d099f3</td>\n",
999
+ " <td>2753529.0</td>\n",
1000
+ " <td>1225965.0</td>\n",
1001
+ " <td>NaN</td>\n",
1002
+ " <td>NaN</td>\n",
1003
+ " <td>NaN</td>\n",
1004
+ " <td>NaN</td>\n",
1005
+ " <td>NaN</td>\n",
1006
+ " </tr>\n",
1007
+ " <tr>\n",
1008
+ " <th>174</th>\n",
1009
+ " <td>421678a0-c8ec-43c8-815c-fc5888835068</td>\n",
1010
+ " <td>16288.0</td>\n",
1011
+ " <td>45514264.0</td>\n",
1012
+ " <td>NaN</td>\n",
1013
+ " <td>NaN</td>\n",
1014
+ " <td>NaN</td>\n",
1015
+ " <td>NaN</td>\n",
1016
+ " <td>NaN</td>\n",
1017
+ " </tr>\n",
1018
+ " <tr>\n",
1019
+ " <th>177</th>\n",
1020
+ " <td>be81bd8c-16a7-4911-8279-431245d67195</td>\n",
1021
+ " <td>2730639.0</td>\n",
1022
+ " <td>1034220.0</td>\n",
1023
+ " <td>NaN</td>\n",
1024
+ " <td>NaN</td>\n",
1025
+ " <td>NaN</td>\n",
1026
+ " <td>NaN</td>\n",
1027
+ " <td>NaN</td>\n",
1028
+ " </tr>\n",
1029
+ " <tr>\n",
1030
+ " <th>259</th>\n",
1031
+ " <td>fc765c82-84e6-437e-b9a5-1c7601c5be81</td>\n",
1032
+ " <td>2717906.0</td>\n",
1033
+ " <td>1052077.0</td>\n",
1034
+ " <td>NaN</td>\n",
1035
+ " <td>NaN</td>\n",
1036
+ " <td>NaN</td>\n",
1037
+ " <td>NaN</td>\n",
1038
+ " <td>NaN</td>\n",
1039
+ " </tr>\n",
1040
+ " <tr>\n",
1041
+ " <th>322</th>\n",
1042
+ " <td>8c1e6878-47ac-4f7b-8475-73e71c0e99c3</td>\n",
1043
+ " <td>2836995.0</td>\n",
1044
+ " <td>957074.0</td>\n",
1045
+ " <td>NaN</td>\n",
1046
+ " <td>NaN</td>\n",
1047
+ " <td>NaN</td>\n",
1048
+ " <td>NaN</td>\n",
1049
+ " <td>NaN</td>\n",
1050
+ " </tr>\n",
1051
+ " </tbody>\n",
1052
+ "</table>\n",
1053
+ "</div>"
1054
+ ],
1055
+ "text/plain": [
1056
+ " treeoflife_id eol_content_id eol_page_id \\\n",
1057
+ "126 4b56e165-c4d5-49f9-a321-ac9474d099f3 2753529.0 1225965.0 \n",
1058
+ "174 421678a0-c8ec-43c8-815c-fc5888835068 16288.0 45514264.0 \n",
1059
+ "177 be81bd8c-16a7-4911-8279-431245d67195 2730639.0 1034220.0 \n",
1060
+ "259 fc765c82-84e6-437e-b9a5-1c7601c5be81 2717906.0 1052077.0 \n",
1061
+ "322 8c1e6878-47ac-4f7b-8475-73e71c0e99c3 2836995.0 957074.0 \n",
1062
+ "\n",
1063
+ " EOL page ID Medium Source URL EOL Full-Size Copy URL License Name \\\n",
1064
+ "126 NaN NaN NaN NaN \n",
1065
+ "174 NaN NaN NaN NaN \n",
1066
+ "177 NaN NaN NaN NaN \n",
1067
+ "259 NaN NaN NaN NaN \n",
1068
+ "322 NaN NaN NaN NaN \n",
1069
+ "\n",
1070
+ " Copyright Owner \n",
1071
+ "126 NaN \n",
1072
+ "174 NaN \n",
1073
+ "177 NaN \n",
1074
+ "259 NaN \n",
1075
+ "322 NaN "
1076
+ ]
1077
+ },
1078
+ "execution_count": 11,
1079
+ "metadata": {},
1080
+ "output_type": "execute_result"
1081
+ }
1082
+ ],
1083
  "source": [
1084
  "eol_missing_content_ids = eol_df_media.loc[eol_df_media[\"Medium Source URL\"].isna()]\n",
1085
  "eol_missing_content_ids.head()"
 
1098
  "metadata": {},
1099
  "outputs": [],
1100
  "source": [
1101
+ "#eol_missing_content_ids.to_csv(\"../data/eol_missing_content_ids.csv\", index = False)"
1102
  ]
1103
  },
1104
  {
1105
  "cell_type": "code",
1106
+ "execution_count": 47,
1107
  "metadata": {},
1108
  "outputs": [
1109
  {
1110
  "name": "stderr",
1111
  "output_type": "stream",
1112
  "text": [
1113
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/610094471.py:1: DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False.\n",
1114
  " media_old = pd.read_csv(\"../data/media_manifest.csv\")\n"
1115
  ]
1116
  },
 
1141
  },
1142
  {
1143
  "cell_type": "code",
1144
+ "execution_count": 48,
1145
  "metadata": {},
1146
  "outputs": [],
1147
  "source": [
 
1205
  },
1206
  {
1207
  "cell_type": "code",
1208
+ "execution_count": 28,
1209
  "metadata": {},
1210
  "outputs": [],
1211
  "source": [
 
1216
  },
1217
  {
1218
  "cell_type": "code",
1219
+ "execution_count": 29,
1220
  "metadata": {},
1221
  "outputs": [],
1222
  "source": [
 
1228
  },
1229
  {
1230
  "cell_type": "code",
1231
+ "execution_count": 30,
1232
  "metadata": {},
1233
  "outputs": [],
1234
  "source": [
 
1320
  },
1321
  {
1322
  "cell_type": "code",
1323
+ "execution_count": 10,
1324
  "metadata": {},
1325
  "outputs": [],
1326
  "source": [
 
1331
  },
1332
  {
1333
  "cell_type": "code",
1334
+ "execution_count": 11,
1335
  "metadata": {},
1336
  "outputs": [],
1337
  "source": [
 
1341
  },
1342
  {
1343
  "cell_type": "code",
1344
+ "execution_count": 12,
1345
  "metadata": {},
1346
  "outputs": [],
1347
  "source": [
 
1350
  },
1351
  {
1352
  "cell_type": "code",
1353
+ "execution_count": 13,
1354
  "metadata": {},
1355
  "outputs": [
1356
  {
 
1375
  "dtype: int64"
1376
  ]
1377
  },
1378
+ "execution_count": 13,
1379
  "metadata": {},
1380
  "output_type": "execute_result"
1381
  }
 
1426
  {
1427
  "cell_type": "code",
1428
  "execution_count": 45,
1429
+ "metadata": {},
 
 
1430
  "outputs": [
1431
  {
1432
  "data": {
 
1674
  "metadata": {},
1675
  "outputs": [],
1676
  "source": [
1677
+ "#eol_taxa_df_media.loc[eol_taxa_df_media[\"Medium Source URL\"].isna()].to_csv(\"../data/eol_taxa_missing_content_ids.csv\", index = False)"
1678
  ]
1679
  },
1680
  {
 
2191
  "But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed."
2192
  ]
2193
  },
2194
+ {
2195
+ "cell_type": "markdown",
2196
+ "metadata": {},
2197
+ "source": [
2198
+ "## Compare to Newer Media Manifest\n",
2199
+ "\n",
2200
+ "We will load in a [new media manifest](https://huggingface.co/datasets/imageomics/eol/blob/3aa274067fc4a18877fb394b1d49a92962c57ed8/data/interim/media_manifest_Dec6.csv) (downloaded Dec. 6) to match up `page_id`s for the missing `content_id`s. This way we can download the images and compare via MD5 checksums to hopefully map the new `content_id`s to the old. (See [discussion #18](https://huggingface.co/datasets/imageomics/eol/discussions/18) in [EOL Repo](https://huggingface.co/datasets/imageomics/eol).)"
2201
+ ]
2202
+ },
2203
  {
2204
  "cell_type": "code",
2205
+ "execution_count": 14,
2206
  "metadata": {},
2207
+ "outputs": [
2208
+ {
2209
+ "name": "stdout",
2210
+ "output_type": "stream",
2211
+ "text": [
2212
+ "<class 'pandas.core.frame.DataFrame'>\n",
2213
+ "RangeIndex: 6576247 entries, 0 to 6576246\n",
2214
+ "Data columns (total 6 columns):\n",
2215
+ " # Column Non-Null Count Dtype \n",
2216
+ "--- ------ -------------- ----- \n",
2217
+ " 0 EOL content ID 6576247 non-null int64 \n",
2218
+ " 1 EOL page ID 6576247 non-null int64 \n",
2219
+ " 2 Medium Source URL 6576245 non-null object\n",
2220
+ " 3 EOL Full-Size Copy URL 6576247 non-null object\n",
2221
+ " 4 License Name 6576247 non-null object\n",
2222
+ " 5 Copyright Owner 5944184 non-null object\n",
2223
+ "dtypes: int64(2), object(4)\n",
2224
+ "memory usage: 301.0+ MB\n"
2225
+ ]
2226
+ }
2227
+ ],
2228
+ "source": [
2229
+ "media_new = pd.read_csv(\"../data/media_manifest_Dec6.csv\", low_memory = False)\n",
2230
+ "media_new.info(show_counts = True)"
2231
+ ]
2232
  },
2233
  {
2234
  "cell_type": "code",
2235
+ "execution_count": 15,
2236
  "metadata": {},
2237
+ "outputs": [
2238
+ {
2239
+ "data": {
2240
+ "text/html": [
2241
+ "<div>\n",
2242
+ "<style scoped>\n",
2243
+ " .dataframe tbody tr th:only-of-type {\n",
2244
+ " vertical-align: middle;\n",
2245
+ " }\n",
2246
+ "\n",
2247
+ " .dataframe tbody tr th {\n",
2248
+ " vertical-align: top;\n",
2249
+ " }\n",
2250
+ "\n",
2251
+ " .dataframe thead th {\n",
2252
+ " text-align: right;\n",
2253
+ " }\n",
2254
+ "</style>\n",
2255
+ "<table border=\"1\" class=\"dataframe\">\n",
2256
+ " <thead>\n",
2257
+ " <tr style=\"text-align: right;\">\n",
2258
+ " <th></th>\n",
2259
+ " <th>EOL content ID</th>\n",
2260
+ " <th>EOL page ID</th>\n",
2261
+ " <th>Medium Source URL</th>\n",
2262
+ " <th>EOL Full-Size Copy URL</th>\n",
2263
+ " <th>License Name</th>\n",
2264
+ " <th>Copyright Owner</th>\n",
2265
+ " </tr>\n",
2266
+ " </thead>\n",
2267
+ " <tbody>\n",
2268
+ " <tr>\n",
2269
+ " <th>0</th>\n",
2270
+ " <td>5470022</td>\n",
2271
+ " <td>500901</td>\n",
2272
+ " <td>http://entnemdept.ufl.edu/walker/buzz/487dmj.gif</td>\n",
2273
+ " <td>https://content.eol.org/data/media/54/67/bb/80...</td>\n",
2274
+ " <td>cc-by-nc-sa-3.0</td>\n",
2275
+ " <td>Susan A. Wineriter/Singing Insects of North Am...</td>\n",
2276
+ " </tr>\n",
2277
+ " <tr>\n",
2278
+ " <th>1</th>\n",
2279
+ " <td>5470023</td>\n",
2280
+ " <td>858799</td>\n",
2281
+ " <td>http://entnemdept.ufl.edu/walker/buzz/291pm.jpg</td>\n",
2282
+ " <td>https://content.eol.org/data/media/54/67/6a/80...</td>\n",
2283
+ " <td>cc-by-nc-sa-3.0</td>\n",
2284
+ " <td>Thomas J. Walker/Singing Insects of North America</td>\n",
2285
+ " </tr>\n",
2286
+ " <tr>\n",
2287
+ " <th>2</th>\n",
2288
+ " <td>5470024</td>\n",
2289
+ " <td>598702</td>\n",
2290
+ " <td>http://entnemdept.ufl.edu/walker/buzz/539pm.jpg</td>\n",
2291
+ " <td>https://content.eol.org/data/media/54/67/d9/80...</td>\n",
2292
+ " <td>cc-by-nc-sa-3.0</td>\n",
2293
+ " <td>Thomas J. Walker/Singing Insects of North America</td>\n",
2294
+ " </tr>\n",
2295
+ " <tr>\n",
2296
+ " <th>3</th>\n",
2297
+ " <td>5470025</td>\n",
2298
+ " <td>598703</td>\n",
2299
+ " <td>http://entnemdept.ufl.edu/walker/buzz/540pm.jpg</td>\n",
2300
+ " <td>https://content.eol.org/data/media/54/67/da/80...</td>\n",
2301
+ " <td>cc-by-nc-sa-3.0</td>\n",
2302
+ " <td>Thomas J. Walker/Singing Insects of North America</td>\n",
2303
+ " </tr>\n",
2304
+ " <tr>\n",
2305
+ " <th>4</th>\n",
2306
+ " <td>5470026</td>\n",
2307
+ " <td>598703</td>\n",
2308
+ " <td>http://entnemdept.ufl.edu/walker/buzz/540pm2.jpg</td>\n",
2309
+ " <td>https://content.eol.org/data/media/54/67/db/80...</td>\n",
2310
+ " <td>cc-by-nc-sa-3.0</td>\n",
2311
+ " <td>Thomas J. Walker/Singing Insects of North America</td>\n",
2312
+ " </tr>\n",
2313
+ " </tbody>\n",
2314
+ "</table>\n",
2315
+ "</div>"
2316
+ ],
2317
+ "text/plain": [
2318
+ " EOL content ID EOL page ID \\\n",
2319
+ "0 5470022 500901 \n",
2320
+ "1 5470023 858799 \n",
2321
+ "2 5470024 598702 \n",
2322
+ "3 5470025 598703 \n",
2323
+ "4 5470026 598703 \n",
2324
+ "\n",
2325
+ " Medium Source URL \\\n",
2326
+ "0 http://entnemdept.ufl.edu/walker/buzz/487dmj.gif \n",
2327
+ "1 http://entnemdept.ufl.edu/walker/buzz/291pm.jpg \n",
2328
+ "2 http://entnemdept.ufl.edu/walker/buzz/539pm.jpg \n",
2329
+ "3 http://entnemdept.ufl.edu/walker/buzz/540pm.jpg \n",
2330
+ "4 http://entnemdept.ufl.edu/walker/buzz/540pm2.jpg \n",
2331
+ "\n",
2332
+ " EOL Full-Size Copy URL License Name \\\n",
2333
+ "0 https://content.eol.org/data/media/54/67/bb/80... cc-by-nc-sa-3.0 \n",
2334
+ "1 https://content.eol.org/data/media/54/67/6a/80... cc-by-nc-sa-3.0 \n",
2335
+ "2 https://content.eol.org/data/media/54/67/d9/80... cc-by-nc-sa-3.0 \n",
2336
+ "3 https://content.eol.org/data/media/54/67/da/80... cc-by-nc-sa-3.0 \n",
2337
+ "4 https://content.eol.org/data/media/54/67/db/80... cc-by-nc-sa-3.0 \n",
2338
+ "\n",
2339
+ " Copyright Owner \n",
2340
+ "0 Susan A. Wineriter/Singing Insects of North Am... \n",
2341
+ "1 Thomas J. Walker/Singing Insects of North America \n",
2342
+ "2 Thomas J. Walker/Singing Insects of North America \n",
2343
+ "3 Thomas J. Walker/Singing Insects of North America \n",
2344
+ "4 Thomas J. Walker/Singing Insects of North America "
2345
+ ]
2346
+ },
2347
+ "execution_count": 15,
2348
+ "metadata": {},
2349
+ "output_type": "execute_result"
2350
+ }
2351
+ ],
2352
+ "source": [
2353
+ "media_new.head()"
2354
+ ]
2355
+ },
2356
+ {
2357
+ "cell_type": "markdown",
2358
+ "metadata": {},
2359
+ "source": [
2360
+ "To allow for easier sanity-check on the matches, we'll use the version of missing info list with taxa included."
2361
+ ]
2362
+ },
2363
+ {
2364
+ "cell_type": "code",
2365
+ "execution_count": 16,
2366
+ "metadata": {},
2367
+ "outputs": [
2368
+ {
2369
+ "data": {
2370
+ "text/html": [
2371
+ "<div>\n",
2372
+ "<style scoped>\n",
2373
+ " .dataframe tbody tr th:only-of-type {\n",
2374
+ " vertical-align: middle;\n",
2375
+ " }\n",
2376
+ "\n",
2377
+ " .dataframe tbody tr th {\n",
2378
+ " vertical-align: top;\n",
2379
+ " }\n",
2380
+ "\n",
2381
+ " .dataframe thead th {\n",
2382
+ " text-align: right;\n",
2383
+ " }\n",
2384
+ "</style>\n",
2385
+ "<table border=\"1\" class=\"dataframe\">\n",
2386
+ " <thead>\n",
2387
+ " <tr style=\"text-align: right;\">\n",
2388
+ " <th></th>\n",
2389
+ " <th>treeoflife_id</th>\n",
2390
+ " <th>eol_content_id</th>\n",
2391
+ " <th>eol_page_id</th>\n",
2392
+ " <th>kingdom</th>\n",
2393
+ " <th>phylum</th>\n",
2394
+ " <th>class</th>\n",
2395
+ " <th>order</th>\n",
2396
+ " <th>family</th>\n",
2397
+ " <th>genus</th>\n",
2398
+ " <th>species</th>\n",
2399
+ " <th>common</th>\n",
2400
+ " <th>EOL page ID</th>\n",
2401
+ " <th>Medium Source URL</th>\n",
2402
+ " <th>EOL Full-Size Copy URL</th>\n",
2403
+ " <th>License Name</th>\n",
2404
+ " <th>Copyright Owner</th>\n",
2405
+ " </tr>\n",
2406
+ " </thead>\n",
2407
+ " <tbody>\n",
2408
+ " <tr>\n",
2409
+ " <th>126</th>\n",
2410
+ " <td>4b56e165-c4d5-49f9-a321-ac9474d099f3</td>\n",
2411
+ " <td>2753529.0</td>\n",
2412
+ " <td>1225965.0</td>\n",
2413
+ " <td>Animalia</td>\n",
2414
+ " <td>Chordata</td>\n",
2415
+ " <td>Reptilia</td>\n",
2416
+ " <td>Squamata</td>\n",
2417
+ " <td>Colubridae</td>\n",
2418
+ " <td>Opheodrys</td>\n",
2419
+ " <td>aestivus</td>\n",
2420
+ " <td>Northern Rough Greensnake</td>\n",
2421
+ " <td>NaN</td>\n",
2422
+ " <td>NaN</td>\n",
2423
+ " <td>NaN</td>\n",
2424
+ " <td>NaN</td>\n",
2425
+ " <td>NaN</td>\n",
2426
+ " </tr>\n",
2427
+ " <tr>\n",
2428
+ " <th>174</th>\n",
2429
+ " <td>421678a0-c8ec-43c8-815c-fc5888835068</td>\n",
2430
+ " <td>16288.0</td>\n",
2431
+ " <td>45514264.0</td>\n",
2432
+ " <td>Animalia</td>\n",
2433
+ " <td>Chordata</td>\n",
2434
+ " <td>Aves</td>\n",
2435
+ " <td>Passeriformes</td>\n",
2436
+ " <td>Laniidae</td>\n",
2437
+ " <td>Lanius</td>\n",
2438
+ " <td>excubitor</td>\n",
2439
+ " <td>Great Grey Shrike</td>\n",
2440
+ " <td>NaN</td>\n",
2441
+ " <td>NaN</td>\n",
2442
+ " <td>NaN</td>\n",
2443
+ " <td>NaN</td>\n",
2444
+ " <td>NaN</td>\n",
2445
+ " </tr>\n",
2446
+ " <tr>\n",
2447
+ " <th>177</th>\n",
2448
+ " <td>be81bd8c-16a7-4911-8279-431245d67195</td>\n",
2449
+ " <td>2730639.0</td>\n",
2450
+ " <td>1034220.0</td>\n",
2451
+ " <td>Animalia</td>\n",
2452
+ " <td>Arthropoda</td>\n",
2453
+ " <td>Insecta</td>\n",
2454
+ " <td>Odonata</td>\n",
2455
+ " <td>Lestidae</td>\n",
2456
+ " <td>Lestes</td>\n",
2457
+ " <td>rectangularis</td>\n",
2458
+ " <td>Slender Spreadwing</td>\n",
2459
+ " <td>NaN</td>\n",
2460
+ " <td>NaN</td>\n",
2461
+ " <td>NaN</td>\n",
2462
+ " <td>NaN</td>\n",
2463
+ " <td>NaN</td>\n",
2464
+ " </tr>\n",
2465
+ " <tr>\n",
2466
+ " <th>259</th>\n",
2467
+ " <td>fc765c82-84e6-437e-b9a5-1c7601c5be81</td>\n",
2468
+ " <td>2717906.0</td>\n",
2469
+ " <td>1052077.0</td>\n",
2470
+ " <td>Animalia</td>\n",
2471
+ " <td>Chordata</td>\n",
2472
+ " <td>Aves</td>\n",
2473
+ " <td>Passeriformes</td>\n",
2474
+ " <td>Cardinalidae</td>\n",
2475
+ " <td>Pheucticus</td>\n",
2476
+ " <td>melanocephalus</td>\n",
2477
+ " <td>Black-headed Grosbeak</td>\n",
2478
+ " <td>NaN</td>\n",
2479
+ " <td>NaN</td>\n",
2480
+ " <td>NaN</td>\n",
2481
+ " <td>NaN</td>\n",
2482
+ " <td>NaN</td>\n",
2483
+ " </tr>\n",
2484
+ " <tr>\n",
2485
+ " <th>322</th>\n",
2486
+ " <td>8c1e6878-47ac-4f7b-8475-73e71c0e99c3</td>\n",
2487
+ " <td>2836995.0</td>\n",
2488
+ " <td>957074.0</td>\n",
2489
+ " <td>Animalia</td>\n",
2490
+ " <td>Arthropoda</td>\n",
2491
+ " <td>Insecta</td>\n",
2492
+ " <td>Lepidoptera</td>\n",
2493
+ " <td>Psychidae</td>\n",
2494
+ " <td>Thyridopteryx</td>\n",
2495
+ " <td>ephemeraeformis</td>\n",
2496
+ " <td>Evergreen Bagworm</td>\n",
2497
+ " <td>NaN</td>\n",
2498
+ " <td>NaN</td>\n",
2499
+ " <td>NaN</td>\n",
2500
+ " <td>NaN</td>\n",
2501
+ " <td>NaN</td>\n",
2502
+ " </tr>\n",
2503
+ " </tbody>\n",
2504
+ "</table>\n",
2505
+ "</div>"
2506
+ ],
2507
+ "text/plain": [
2508
+ " treeoflife_id eol_content_id eol_page_id \\\n",
2509
+ "126 4b56e165-c4d5-49f9-a321-ac9474d099f3 2753529.0 1225965.0 \n",
2510
+ "174 421678a0-c8ec-43c8-815c-fc5888835068 16288.0 45514264.0 \n",
2511
+ "177 be81bd8c-16a7-4911-8279-431245d67195 2730639.0 1034220.0 \n",
2512
+ "259 fc765c82-84e6-437e-b9a5-1c7601c5be81 2717906.0 1052077.0 \n",
2513
+ "322 8c1e6878-47ac-4f7b-8475-73e71c0e99c3 2836995.0 957074.0 \n",
2514
+ "\n",
2515
+ " kingdom phylum class order family \\\n",
2516
+ "126 Animalia Chordata Reptilia Squamata Colubridae \n",
2517
+ "174 Animalia Chordata Aves Passeriformes Laniidae \n",
2518
+ "177 Animalia Arthropoda Insecta Odonata Lestidae \n",
2519
+ "259 Animalia Chordata Aves Passeriformes Cardinalidae \n",
2520
+ "322 Animalia Arthropoda Insecta Lepidoptera Psychidae \n",
2521
+ "\n",
2522
+ " genus species common EOL page ID \\\n",
2523
+ "126 Opheodrys aestivus Northern Rough Greensnake NaN \n",
2524
+ "174 Lanius excubitor Great Grey Shrike NaN \n",
2525
+ "177 Lestes rectangularis Slender Spreadwing NaN \n",
2526
+ "259 Pheucticus melanocephalus Black-headed Grosbeak NaN \n",
2527
+ "322 Thyridopteryx ephemeraeformis Evergreen Bagworm NaN \n",
2528
+ "\n",
2529
+ " Medium Source URL EOL Full-Size Copy URL License Name Copyright Owner \n",
2530
+ "126 NaN NaN NaN NaN \n",
2531
+ "174 NaN NaN NaN NaN \n",
2532
+ "177 NaN NaN NaN NaN \n",
2533
+ "259 NaN NaN NaN NaN \n",
2534
+ "322 NaN NaN NaN NaN "
2535
+ ]
2536
+ },
2537
+ "execution_count": 16,
2538
+ "metadata": {},
2539
+ "output_type": "execute_result"
2540
+ }
2541
+ ],
2542
+ "source": [
2543
+ "eol_taxa_df_missing_media = eol_taxa_df_media.loc[eol_taxa_df_media[\"Medium Source URL\"].isna()]\n",
2544
+ "eol_taxa_df_missing_media.head()"
2545
+ ]
2546
+ },
2547
+ {
2548
+ "cell_type": "markdown",
2549
+ "metadata": {},
2550
+ "source": [
2551
+ "Rename `EOL content ID` and `EOL page ID` columns to match our `eol_taxa_df_missing_media` for easier merging."
2552
+ ]
2553
+ },
2554
+ {
2555
+ "cell_type": "code",
2556
+ "execution_count": 17,
2557
+ "metadata": {},
2558
+ "outputs": [],
2559
+ "source": [
2560
+ "media_new.rename(columns = {\"EOL content ID\": \"eol_content_id\", \"EOL page ID\": \"eol_page_id\"}, inplace = True)"
2561
+ ]
2562
+ },
2563
+ {
2564
+ "cell_type": "markdown",
2565
+ "metadata": {},
2566
+ "source": [
2567
+ "First check for any matching content IDs"
2568
+ ]
2569
+ },
2570
+ {
2571
+ "cell_type": "code",
2572
+ "execution_count": 18,
2573
+ "metadata": {},
2574
+ "outputs": [
2575
+ {
2576
+ "name": "stdout",
2577
+ "output_type": "stream",
2578
+ "text": [
2579
+ "<class 'pandas.core.frame.DataFrame'>\n",
2580
+ "RangeIndex: 113471 entries, 0 to 113470\n",
2581
+ "Data columns (total 16 columns):\n",
2582
+ " # Column Non-Null Count Dtype \n",
2583
+ "--- ------ -------------- ----- \n",
2584
+ " 0 treeoflife_id 113471 non-null object \n",
2585
+ " 1 eol_content_id 113471 non-null float64\n",
2586
+ " 2 eol_page_id_x 113471 non-null float64\n",
2587
+ " 3 kingdom 113405 non-null object \n",
2588
+ " 4 phylum 113405 non-null object \n",
2589
+ " 5 class 113372 non-null object \n",
2590
+ " 6 order 113338 non-null object \n",
2591
+ " 7 family 113405 non-null object \n",
2592
+ " 8 genus 113406 non-null object \n",
2593
+ " 9 species 113457 non-null object \n",
2594
+ " 10 common 113471 non-null object \n",
2595
+ " 11 eol_page_id_y 0 non-null float64\n",
2596
+ " 12 Medium Source URL 0 non-null object \n",
2597
+ " 13 EOL Full-Size Copy URL 0 non-null object \n",
2598
+ " 14 License Name 0 non-null object \n",
2599
+ " 15 Copyright Owner 0 non-null object \n",
2600
+ "dtypes: float64(3), object(13)\n",
2601
+ "memory usage: 13.9+ MB\n"
2602
+ ]
2603
+ }
2604
+ ],
2605
+ "source": [
2606
+ "eol_taxa_df_missing_media_new_check = pd.merge(eol_taxa_df_missing_media[cols_of_interest], media_new, how = \"left\", on = \"eol_content_id\")\n",
2607
+ "eol_taxa_df_missing_media_new_check.info(show_counts = True)"
2608
+ ]
2609
+ },
2610
+ {
2611
+ "cell_type": "markdown",
2612
+ "metadata": {},
2613
+ "source": [
2614
+ "Yes, there are no matching content IDs here.\n",
2615
+ "\n",
2616
+ "Now, let's get our match on page IDs to check they are all listed still for download."
2617
+ ]
2618
+ },
2619
+ {
2620
+ "cell_type": "code",
2621
+ "execution_count": 19,
2622
+ "metadata": {},
2623
+ "outputs": [
2624
+ {
2625
+ "name": "stdout",
2626
+ "output_type": "stream",
2627
+ "text": [
2628
+ "There are 9762 unique page ids that have missing content ids, and there are 577900 total page ids in the new media manifest.\n"
2629
+ ]
2630
+ }
2631
+ ],
2632
+ "source": [
2633
+ "pg_ids_missing_content = set(eol_taxa_df_missing_media.eol_page_id)\n",
2634
+ "pg_ids_media_new = set(media_new.eol_page_id)\n",
2635
+ "\n",
2636
+ "print(f\"There are {len(pg_ids_missing_content)} unique page ids that have missing content ids, and there are {len(pg_ids_media_new)} total page ids in the new media manifest.\")\n",
2637
+ " "
2638
+ ]
2639
+ },
2640
+ {
2641
+ "cell_type": "code",
2642
+ "execution_count": 20,
2643
+ "metadata": {},
2644
+ "outputs": [
2645
+ {
2646
+ "name": "stdout",
2647
+ "output_type": "stream",
2648
+ "text": [
2649
+ "152\n"
2650
+ ]
2651
+ }
2652
+ ],
2653
+ "source": [
2654
+ "missing_pgs = []\n",
2655
+ "for pg in pg_ids_missing_content:\n",
2656
+ " if pg not in pg_ids_media_new:\n",
2657
+ " missing_pgs.append(pg)\n",
2658
+ "print(len(missing_pgs))"
2659
+ ]
2660
+ },
2661
+ {
2662
+ "cell_type": "code",
2663
+ "execution_count": 21,
2664
+ "metadata": {},
2665
+ "outputs": [
2666
+ {
2667
+ "name": "stdout",
2668
+ "output_type": "stream",
2669
+ "text": [
2670
+ "There are 577732 total page ids in the July 26 media manifest.\n",
2671
+ "152\n"
2672
+ ]
2673
+ }
2674
+ ],
2675
+ "source": [
2676
+ "media.rename(columns = {\"EOL page ID\": \"eol_page_id\"}, inplace = True)\n",
2677
+ "pg_ids_media = set(media.eol_page_id)\n",
2678
+ "\n",
2679
+ "print(f\"There are {len(pg_ids_media)} total page ids in the July 26 media manifest.\")\n",
2680
+ "\n",
2681
+ "missing_pgs_jul26 = []\n",
2682
+ "for pg in pg_ids_missing_content:\n",
2683
+ " if pg not in pg_ids_media:\n",
2684
+ " missing_pgs_jul26.append(pg)\n",
2685
+ "print(len(missing_pgs_jul26))"
2686
+ ]
2687
+ },
2688
+ {
2689
+ "cell_type": "markdown",
2690
+ "metadata": {},
2691
+ "source": [
2692
+ "There seem to be 152 page IDs that don't match to either manifest."
2693
+ ]
2694
+ },
2695
+ {
2696
+ "cell_type": "code",
2697
+ "execution_count": 22,
2698
+ "metadata": {},
2699
+ "outputs": [
2700
+ {
2701
+ "data": {
2702
+ "text/plain": [
2703
+ "[47186210.0,\n",
2704
+ " 47186225.0,\n",
2705
+ " 46334362.0,\n",
2706
+ " 47186380.0,\n",
2707
+ " 47121005.0,\n",
2708
+ " 1082047.0,\n",
2709
+ " 5341906.0,\n",
2710
+ " 131804.0,\n",
2711
+ " 47187121.0,\n",
2712
+ " 5015679.0]"
2713
+ ]
2714
+ },
2715
+ "execution_count": 22,
2716
+ "metadata": {},
2717
+ "output_type": "execute_result"
2718
+ }
2719
+ ],
2720
+ "source": [
2721
+ "missing_pgs[:10]"
2722
+ ]
2723
+ },
2724
+ {
2725
+ "cell_type": "code",
2726
+ "execution_count": 27,
2727
+ "metadata": {},
2728
+ "outputs": [
2729
+ {
2730
+ "name": "stdout",
2731
+ "output_type": "stream",
2732
+ "text": [
2733
+ "152\n",
2734
+ "[47186210, 47186225, 46334362, 47186380, 47121005]\n"
2735
+ ]
2736
+ }
2737
+ ],
2738
+ "source": [
2739
+ "# Why are these floats...does it matter?\n",
2740
+ "missing_pgs_int = [int(pg) for pg in missing_pgs]\n",
2741
+ "\n",
2742
+ "int_missing_pgs = []\n",
2743
+ "for pg in missing_pgs_int:\n",
2744
+ " if pg not in pg_ids_media_new:\n",
2745
+ " int_missing_pgs.append(pg)\n",
2746
+ "print(len(int_missing_pgs))\n",
2747
+ "print(int_missing_pgs[:5])"
2748
+ ]
2749
+ },
2750
+ {
2751
+ "cell_type": "markdown",
2752
+ "metadata": {},
2753
+ "source": [
2754
+ "It does not matter. There seem to be 152 missing pages, let's try making a couple into URLs...\n",
2755
+ "\n",
2756
+ "The first has a page (https://eol.org/pages/47186210) without images. Let's compare these 152 page IDs to our `category.csv` page IDs. Maybe these were not added because there were no images (still odd they exist in `predicted-category.csv`, but not in the manifest)."
2757
+ ]
2758
+ },
2759
+ {
2760
+ "cell_type": "code",
2761
+ "execution_count": 31,
2762
+ "metadata": {},
2763
+ "outputs": [
2764
+ {
2765
+ "name": "stdout",
2766
+ "output_type": "stream",
2767
+ "text": [
2768
+ "There are 503589 total page ids in the July 26 media manifest.\n",
2769
+ "0\n"
2770
+ ]
2771
+ }
2772
+ ],
2773
+ "source": [
2774
+ "cat_pgs = set(eol_cat_df.eol_page_id)\n",
2775
+ "\n",
2776
+ "print(f\"There are {len(cat_pgs)} total page ids in the July 26 media manifest.\")\n",
2777
+ "\n",
2778
+ "missing_cat_pgs = []\n",
2779
+ "for pg in missing_pgs:\n",
2780
+ " if pg not in cat_pgs:\n",
2781
+ " missing_cat_pgs.append(pg)\n",
2782
+ "print(len(missing_cat_pgs))"
2783
+ ]
2784
+ },
2785
+ {
2786
+ "cell_type": "markdown",
2787
+ "metadata": {},
2788
+ "source": [
2789
+ "Nope, these are all in `category.csv`.\n",
2790
+ "\n",
2791
+ "Another no image page (https://eol.org/pages/47186225), [this](https://eol.org/pages/46334362) has more data, but still no images. https://eol.org/pages/47186380 & https://eol.org/pages/47121005 also don't show any images.\n",
2792
+ "\n",
2793
+ "Seems the images for all of these were removed or moved to other pages...\n",
2794
+ "\n",
2795
+ "Let's make a CSV for the missing pages to check that we do indeed have the images (sanity check), and we can compare the taxa!"
2796
+ ]
2797
+ },
2798
+ {
2799
+ "cell_type": "code",
2800
+ "execution_count": 34,
2801
+ "metadata": {},
2802
+ "outputs": [
2803
+ {
2804
+ "name": "stdout",
2805
+ "output_type": "stream",
2806
+ "text": [
2807
+ "<class 'pandas.core.frame.DataFrame'>\n",
2808
+ "Index: 577 entries, 4850 to 6260647\n",
2809
+ "Data columns (total 11 columns):\n",
2810
+ " # Column Non-Null Count Dtype \n",
2811
+ "--- ------ -------------- ----- \n",
2812
+ " 0 treeoflife_id 577 non-null object \n",
2813
+ " 1 eol_content_id 577 non-null float64\n",
2814
+ " 2 eol_page_id 577 non-null float64\n",
2815
+ " 3 kingdom 514 non-null object \n",
2816
+ " 4 phylum 514 non-null object \n",
2817
+ " 5 class 508 non-null object \n",
2818
+ " 6 order 508 non-null object \n",
2819
+ " 7 family 514 non-null object \n",
2820
+ " 8 genus 515 non-null object \n",
2821
+ " 9 species 577 non-null object \n",
2822
+ " 10 common 577 non-null object \n",
2823
+ "dtypes: float64(2), object(9)\n",
2824
+ "memory usage: 54.1+ KB\n"
2825
+ ]
2826
+ }
2827
+ ],
2828
+ "source": [
2829
+ "missing_pgs_df = eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media[\"eol_page_id\"].isin(missing_pgs)]\n",
2830
+ "missing_pgs_df = missing_pgs_df[cols_of_interest]\n",
2831
+ "missing_pgs_df.info()"
2832
+ ]
2833
+ },
2834
+ {
2835
+ "cell_type": "code",
2836
+ "execution_count": 35,
2837
+ "metadata": {},
2838
+ "outputs": [
2839
+ {
2840
+ "data": {
2841
+ "text/html": [
2842
+ "<div>\n",
2843
+ "<style scoped>\n",
2844
+ " .dataframe tbody tr th:only-of-type {\n",
2845
+ " vertical-align: middle;\n",
2846
+ " }\n",
2847
+ "\n",
2848
+ " .dataframe tbody tr th {\n",
2849
+ " vertical-align: top;\n",
2850
+ " }\n",
2851
+ "\n",
2852
+ " .dataframe thead th {\n",
2853
+ " text-align: right;\n",
2854
+ " }\n",
2855
+ "</style>\n",
2856
+ "<table border=\"1\" class=\"dataframe\">\n",
2857
+ " <thead>\n",
2858
+ " <tr style=\"text-align: right;\">\n",
2859
+ " <th></th>\n",
2860
+ " <th>treeoflife_id</th>\n",
2861
+ " <th>eol_content_id</th>\n",
2862
+ " <th>eol_page_id</th>\n",
2863
+ " <th>kingdom</th>\n",
2864
+ " <th>phylum</th>\n",
2865
+ " <th>class</th>\n",
2866
+ " <th>order</th>\n",
2867
+ " <th>family</th>\n",
2868
+ " <th>genus</th>\n",
2869
+ " <th>species</th>\n",
2870
+ " <th>common</th>\n",
2871
+ " </tr>\n",
2872
+ " </thead>\n",
2873
+ " <tbody>\n",
2874
+ " <tr>\n",
2875
+ " <th>1777659</th>\n",
2876
+ " <td>fee72f98-0e52-407d-9b95-2c423dba24ca</td>\n",
2877
+ " <td>7745.0</td>\n",
2878
+ " <td>47188355.0</td>\n",
2879
+ " <td>Plantae</td>\n",
2880
+ " <td>Tracheophyta</td>\n",
2881
+ " <td>Magnoliopsida</td>\n",
2882
+ " <td>Asterales</td>\n",
2883
+ " <td>Asteraceae</td>\n",
2884
+ " <td>Erigeron</td>\n",
2885
+ " <td>acer</td>\n",
2886
+ " <td>narrowleaf fleabane</td>\n",
2887
+ " </tr>\n",
2888
+ " <tr>\n",
2889
+ " <th>4173487</th>\n",
2890
+ " <td>d2a6ccaa-da99-464c-85e5-ff08a17f2dac</td>\n",
2891
+ " <td>2779265.0</td>\n",
2892
+ " <td>4446364.0</td>\n",
2893
+ " <td>Animalia</td>\n",
2894
+ " <td>Chordata</td>\n",
2895
+ " <td>Mammalia</td>\n",
2896
+ " <td>Artiodactyla</td>\n",
2897
+ " <td>Cervidae</td>\n",
2898
+ " <td>Cervus</td>\n",
2899
+ " <td>elaphus</td>\n",
2900
+ " <td>Yarkand deer</td>\n",
2901
+ " </tr>\n",
2902
+ " <tr>\n",
2903
+ " <th>4495906</th>\n",
2904
+ " <td>ff5dc70d-6816-4f4d-b7e4-207bc16622c1</td>\n",
2905
+ " <td>2779346.0</td>\n",
2906
+ " <td>4446364.0</td>\n",
2907
+ " <td>Animalia</td>\n",
2908
+ " <td>Chordata</td>\n",
2909
+ " <td>Mammalia</td>\n",
2910
+ " <td>Artiodactyla</td>\n",
2911
+ " <td>Cervidae</td>\n",
2912
+ " <td>Cervus</td>\n",
2913
+ " <td>elaphus</td>\n",
2914
+ " <td>Yarkand deer</td>\n",
2915
+ " </tr>\n",
2916
+ " <tr>\n",
2917
+ " <th>1594880</th>\n",
2918
+ " <td>bd322026-611d-4187-a2c4-c3c3cf43c2f6</td>\n",
2919
+ " <td>14802.0</td>\n",
2920
+ " <td>47043911.0</td>\n",
2921
+ " <td>Animalia</td>\n",
2922
+ " <td>Chordata</td>\n",
2923
+ " <td>NaN</td>\n",
2924
+ " <td>NaN</td>\n",
2925
+ " <td>Ceratopsidae</td>\n",
2926
+ " <td>Triceratops</td>\n",
2927
+ " <td>serratus</td>\n",
2928
+ " <td>Triceratops serratus</td>\n",
2929
+ " </tr>\n",
2930
+ " <tr>\n",
2931
+ " <th>5128557</th>\n",
2932
+ " <td>f36325a0-c815-40f4-ad3d-188389897ae8</td>\n",
2933
+ " <td>2740131.0</td>\n",
2934
+ " <td>47364113.0</td>\n",
2935
+ " <td>Animalia</td>\n",
2936
+ " <td>Chordata</td>\n",
2937
+ " <td>Actinopterygii</td>\n",
2938
+ " <td>Labriformes</td>\n",
2939
+ " <td>Labridae</td>\n",
2940
+ " <td>Notolabrus</td>\n",
2941
+ " <td>tetricus</td>\n",
2942
+ " <td>Rotfish</td>\n",
2943
+ " </tr>\n",
2944
+ " <tr>\n",
2945
+ " <th>2698612</th>\n",
2946
+ " <td>bc4df6ef-0176-47d9-9c83-e91478a67c69</td>\n",
2947
+ " <td>2779357.0</td>\n",
2948
+ " <td>4446364.0</td>\n",
2949
+ " <td>Animalia</td>\n",
2950
+ " <td>Chordata</td>\n",
2951
+ " <td>Mammalia</td>\n",
2952
+ " <td>Artiodactyla</td>\n",
2953
+ " <td>Cervidae</td>\n",
2954
+ " <td>Cervus</td>\n",
2955
+ " <td>elaphus</td>\n",
2956
+ " <td>Yarkand deer</td>\n",
2957
+ " </tr>\n",
2958
+ " <tr>\n",
2959
+ " <th>1052488</th>\n",
2960
+ " <td>8aaf93d1-0b47-475c-b7f2-ce6227b00207</td>\n",
2961
+ " <td>2800926.0</td>\n",
2962
+ " <td>47370127.0</td>\n",
2963
+ " <td>NaN</td>\n",
2964
+ " <td>NaN</td>\n",
2965
+ " <td>NaN</td>\n",
2966
+ " <td>NaN</td>\n",
2967
+ " <td>NaN</td>\n",
2968
+ " <td>NaN</td>\n",
2969
+ " <td>nipponica</td>\n",
2970
+ " <td>Nipponica</td>\n",
2971
+ " </tr>\n",
2972
+ " <tr>\n",
2973
+ " <th>3783126</th>\n",
2974
+ " <td>09cbab95-760d-4175-b495-82a38d6a865a</td>\n",
2975
+ " <td>7955.0</td>\n",
2976
+ " <td>5523149.0</td>\n",
2977
+ " <td>Plantae</td>\n",
2978
+ " <td>Tracheophyta</td>\n",
2979
+ " <td>Magnoliopsida</td>\n",
2980
+ " <td>Ranunculales</td>\n",
2981
+ " <td>Ranunculaceae</td>\n",
2982
+ " <td>Ranunculus</td>\n",
2983
+ " <td>acutilobus</td>\n",
2984
+ " <td>Ranunculus acutilobus</td>\n",
2985
+ " </tr>\n",
2986
+ " <tr>\n",
2987
+ " <th>2211057</th>\n",
2988
+ " <td>869f72dd-5640-417a-9278-5d5719505bd0</td>\n",
2989
+ " <td>2779220.0</td>\n",
2990
+ " <td>4446364.0</td>\n",
2991
+ " <td>Animalia</td>\n",
2992
+ " <td>Chordata</td>\n",
2993
+ " <td>Mammalia</td>\n",
2994
+ " <td>Artiodactyla</td>\n",
2995
+ " <td>Cervidae</td>\n",
2996
+ " <td>Cervus</td>\n",
2997
+ " <td>elaphus</td>\n",
2998
+ " <td>Yarkand deer</td>\n",
2999
+ " </tr>\n",
3000
+ " <tr>\n",
3001
+ " <th>604305</th>\n",
3002
+ " <td>a9555b8e-d52f-4bcb-aee2-38354de6e92e</td>\n",
3003
+ " <td>2779222.0</td>\n",
3004
+ " <td>4446364.0</td>\n",
3005
+ " <td>Animalia</td>\n",
3006
+ " <td>Chordata</td>\n",
3007
+ " <td>Mammalia</td>\n",
3008
+ " <td>Artiodactyla</td>\n",
3009
+ " <td>Cervidae</td>\n",
3010
+ " <td>Cervus</td>\n",
3011
+ " <td>elaphus</td>\n",
3012
+ " <td>Yarkand deer</td>\n",
3013
+ " </tr>\n",
3014
+ " </tbody>\n",
3015
+ "</table>\n",
3016
+ "</div>"
3017
+ ],
3018
+ "text/plain": [
3019
+ " treeoflife_id eol_content_id eol_page_id \\\n",
3020
+ "1777659 fee72f98-0e52-407d-9b95-2c423dba24ca 7745.0 47188355.0 \n",
3021
+ "4173487 d2a6ccaa-da99-464c-85e5-ff08a17f2dac 2779265.0 4446364.0 \n",
3022
+ "4495906 ff5dc70d-6816-4f4d-b7e4-207bc16622c1 2779346.0 4446364.0 \n",
3023
+ "1594880 bd322026-611d-4187-a2c4-c3c3cf43c2f6 14802.0 47043911.0 \n",
3024
+ "5128557 f36325a0-c815-40f4-ad3d-188389897ae8 2740131.0 47364113.0 \n",
3025
+ "2698612 bc4df6ef-0176-47d9-9c83-e91478a67c69 2779357.0 4446364.0 \n",
3026
+ "1052488 8aaf93d1-0b47-475c-b7f2-ce6227b00207 2800926.0 47370127.0 \n",
3027
+ "3783126 09cbab95-760d-4175-b495-82a38d6a865a 7955.0 5523149.0 \n",
3028
+ "2211057 869f72dd-5640-417a-9278-5d5719505bd0 2779220.0 4446364.0 \n",
3029
+ "604305 a9555b8e-d52f-4bcb-aee2-38354de6e92e 2779222.0 4446364.0 \n",
3030
+ "\n",
3031
+ " kingdom phylum class order family \\\n",
3032
+ "1777659 Plantae Tracheophyta Magnoliopsida Asterales Asteraceae \n",
3033
+ "4173487 Animalia Chordata Mammalia Artiodactyla Cervidae \n",
3034
+ "4495906 Animalia Chordata Mammalia Artiodactyla Cervidae \n",
3035
+ "1594880 Animalia Chordata NaN NaN Ceratopsidae \n",
3036
+ "5128557 Animalia Chordata Actinopterygii Labriformes Labridae \n",
3037
+ "2698612 Animalia Chordata Mammalia Artiodactyla Cervidae \n",
3038
+ "1052488 NaN NaN NaN NaN NaN \n",
3039
+ "3783126 Plantae Tracheophyta Magnoliopsida Ranunculales Ranunculaceae \n",
3040
+ "2211057 Animalia Chordata Mammalia Artiodactyla Cervidae \n",
3041
+ "604305 Animalia Chordata Mammalia Artiodactyla Cervidae \n",
3042
+ "\n",
3043
+ " genus species common \n",
3044
+ "1777659 Erigeron acer narrowleaf fleabane \n",
3045
+ "4173487 Cervus elaphus Yarkand deer \n",
3046
+ "4495906 Cervus elaphus Yarkand deer \n",
3047
+ "1594880 Triceratops serratus Triceratops serratus \n",
3048
+ "5128557 Notolabrus tetricus Rotfish \n",
3049
+ "2698612 Cervus elaphus Yarkand deer \n",
3050
+ "1052488 NaN nipponica Nipponica \n",
3051
+ "3783126 Ranunculus acutilobus Ranunculus acutilobus \n",
3052
+ "2211057 Cervus elaphus Yarkand deer \n",
3053
+ "604305 Cervus elaphus Yarkand deer "
3054
+ ]
3055
+ },
3056
+ "execution_count": 35,
3057
+ "metadata": {},
3058
+ "output_type": "execute_result"
3059
+ }
3060
+ ],
3061
+ "source": [
3062
+ "missing_pgs_df.sample(10)"
3063
+ ]
3064
+ },
3065
+ {
3066
+ "cell_type": "code",
3067
+ "execution_count": 39,
3068
+ "metadata": {},
3069
+ "outputs": [],
3070
+ "source": [
3071
+ "missing_pgs_df.to_csv(\"../data/catalog_missing_media_pages.csv\", index = False)"
3072
+ ]
3073
+ },
3074
+ {
3075
+ "cell_type": "markdown",
3076
+ "metadata": {},
3077
+ "source": [
3078
+ "### Save File with EOL Page IDs & Number of missing content IDs associated with each"
3079
+ ]
3080
+ },
3081
+ {
3082
+ "cell_type": "code",
3083
+ "execution_count": 43,
3084
+ "metadata": {},
3085
+ "outputs": [
3086
+ {
3087
+ "data": {
3088
+ "text/html": [
3089
+ "<div>\n",
3090
+ "<style scoped>\n",
3091
+ " .dataframe tbody tr th:only-of-type {\n",
3092
+ " vertical-align: middle;\n",
3093
+ " }\n",
3094
+ "\n",
3095
+ " .dataframe tbody tr th {\n",
3096
+ " vertical-align: top;\n",
3097
+ " }\n",
3098
+ "\n",
3099
+ " .dataframe thead th {\n",
3100
+ " text-align: right;\n",
3101
+ " }\n",
3102
+ "</style>\n",
3103
+ "<table border=\"1\" class=\"dataframe\">\n",
3104
+ " <thead>\n",
3105
+ " <tr style=\"text-align: right;\">\n",
3106
+ " <th></th>\n",
3107
+ " <th>treeoflife_id</th>\n",
3108
+ " <th>eol_content_id</th>\n",
3109
+ " <th>eol_page_id</th>\n",
3110
+ " <th>kingdom</th>\n",
3111
+ " <th>phylum</th>\n",
3112
+ " <th>class</th>\n",
3113
+ " <th>order</th>\n",
3114
+ " <th>family</th>\n",
3115
+ " <th>genus</th>\n",
3116
+ " <th>species</th>\n",
3117
+ " <th>common</th>\n",
3118
+ " <th>num_content_ids_missing</th>\n",
3119
+ " </tr>\n",
3120
+ " </thead>\n",
3121
+ " <tbody>\n",
3122
+ " <tr>\n",
3123
+ " <th>126</th>\n",
3124
+ " <td>4b56e165-c4d5-49f9-a321-ac9474d099f3</td>\n",
3125
+ " <td>2753529.0</td>\n",
3126
+ " <td>1225965.0</td>\n",
3127
+ " <td>Animalia</td>\n",
3128
+ " <td>Chordata</td>\n",
3129
+ " <td>Reptilia</td>\n",
3130
+ " <td>Squamata</td>\n",
3131
+ " <td>Colubridae</td>\n",
3132
+ " <td>Opheodrys</td>\n",
3133
+ " <td>aestivus</td>\n",
3134
+ " <td>Northern Rough Greensnake</td>\n",
3135
+ " <td>24</td>\n",
3136
+ " </tr>\n",
3137
+ " <tr>\n",
3138
+ " <th>174</th>\n",
3139
+ " <td>421678a0-c8ec-43c8-815c-fc5888835068</td>\n",
3140
+ " <td>16288.0</td>\n",
3141
+ " <td>45514264.0</td>\n",
3142
+ " <td>Animalia</td>\n",
3143
+ " <td>Chordata</td>\n",
3144
+ " <td>Aves</td>\n",
3145
+ " <td>Passeriformes</td>\n",
3146
+ " <td>Laniidae</td>\n",
3147
+ " <td>Lanius</td>\n",
3148
+ " <td>excubitor</td>\n",
3149
+ " <td>Great Grey Shrike</td>\n",
3150
+ " <td>23</td>\n",
3151
+ " </tr>\n",
3152
+ " <tr>\n",
3153
+ " <th>177</th>\n",
3154
+ " <td>be81bd8c-16a7-4911-8279-431245d67195</td>\n",
3155
+ " <td>2730639.0</td>\n",
3156
+ " <td>1034220.0</td>\n",
3157
+ " <td>Animalia</td>\n",
3158
+ " <td>Arthropoda</td>\n",
3159
+ " <td>Insecta</td>\n",
3160
+ " <td>Odonata</td>\n",
3161
+ " <td>Lestidae</td>\n",
3162
+ " <td>Lestes</td>\n",
3163
+ " <td>rectangularis</td>\n",
3164
+ " <td>Slender Spreadwing</td>\n",
3165
+ " <td>141</td>\n",
3166
+ " </tr>\n",
3167
+ " <tr>\n",
3168
+ " <th>259</th>\n",
3169
+ " <td>fc765c82-84e6-437e-b9a5-1c7601c5be81</td>\n",
3170
+ " <td>2717906.0</td>\n",
3171
+ " <td>1052077.0</td>\n",
3172
+ " <td>Animalia</td>\n",
3173
+ " <td>Chordata</td>\n",
3174
+ " <td>Aves</td>\n",
3175
+ " <td>Passeriformes</td>\n",
3176
+ " <td>Cardinalidae</td>\n",
3177
+ " <td>Pheucticus</td>\n",
3178
+ " <td>melanocephalus</td>\n",
3179
+ " <td>Black-headed Grosbeak</td>\n",
3180
+ " <td>818</td>\n",
3181
+ " </tr>\n",
3182
+ " <tr>\n",
3183
+ " <th>322</th>\n",
3184
+ " <td>8c1e6878-47ac-4f7b-8475-73e71c0e99c3</td>\n",
3185
+ " <td>2836995.0</td>\n",
3186
+ " <td>957074.0</td>\n",
3187
+ " <td>Animalia</td>\n",
3188
+ " <td>Arthropoda</td>\n",
3189
+ " <td>Insecta</td>\n",
3190
+ " <td>Lepidoptera</td>\n",
3191
+ " <td>Psychidae</td>\n",
3192
+ " <td>Thyridopteryx</td>\n",
3193
+ " <td>ephemeraeformis</td>\n",
3194
+ " <td>Evergreen Bagworm</td>\n",
3195
+ " <td>30</td>\n",
3196
+ " </tr>\n",
3197
+ " </tbody>\n",
3198
+ "</table>\n",
3199
+ "</div>"
3200
+ ],
3201
+ "text/plain": [
3202
+ " treeoflife_id eol_content_id eol_page_id \\\n",
3203
+ "126 4b56e165-c4d5-49f9-a321-ac9474d099f3 2753529.0 1225965.0 \n",
3204
+ "174 421678a0-c8ec-43c8-815c-fc5888835068 16288.0 45514264.0 \n",
3205
+ "177 be81bd8c-16a7-4911-8279-431245d67195 2730639.0 1034220.0 \n",
3206
+ "259 fc765c82-84e6-437e-b9a5-1c7601c5be81 2717906.0 1052077.0 \n",
3207
+ "322 8c1e6878-47ac-4f7b-8475-73e71c0e99c3 2836995.0 957074.0 \n",
3208
+ "\n",
3209
+ " kingdom phylum class order family \\\n",
3210
+ "126 Animalia Chordata Reptilia Squamata Colubridae \n",
3211
+ "174 Animalia Chordata Aves Passeriformes Laniidae \n",
3212
+ "177 Animalia Arthropoda Insecta Odonata Lestidae \n",
3213
+ "259 Animalia Chordata Aves Passeriformes Cardinalidae \n",
3214
+ "322 Animalia Arthropoda Insecta Lepidoptera Psychidae \n",
3215
+ "\n",
3216
+ " genus species common \\\n",
3217
+ "126 Opheodrys aestivus Northern Rough Greensnake \n",
3218
+ "174 Lanius excubitor Great Grey Shrike \n",
3219
+ "177 Lestes rectangularis Slender Spreadwing \n",
3220
+ "259 Pheucticus melanocephalus Black-headed Grosbeak \n",
3221
+ "322 Thyridopteryx ephemeraeformis Evergreen Bagworm \n",
3222
+ "\n",
3223
+ " num_content_ids_missing \n",
3224
+ "126 24 \n",
3225
+ "174 23 \n",
3226
+ "177 141 \n",
3227
+ "259 818 \n",
3228
+ "322 30 "
3229
+ ]
3230
+ },
3231
+ "execution_count": 43,
3232
+ "metadata": {},
3233
+ "output_type": "execute_result"
3234
+ }
3235
+ ],
3236
+ "source": [
3237
+ "# Count and record number of content IDs for each page ID\n",
3238
+ "for pg_id in pg_ids_missing_content:\n",
3239
+ " content_id_list = ['{}'.format(i) for i in eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media['eol_page_id'] == pg_id]['eol_content_id'].unique()]\n",
3240
+ " eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media['eol_page_id'] == pg_id, \"num_content_ids_missing\"] = len(content_id_list)\n",
3241
+ "\n",
3242
+ "cols_of_interest.append(\"num_content_ids_missing\")\n",
3243
+ "eol_taxa_df_missing_media[cols_of_interest].head()"
3244
+ ]
3245
+ },
3246
+ {
3247
+ "cell_type": "code",
3248
+ "execution_count": 44,
3249
+ "metadata": {},
3250
+ "outputs": [
3251
+ {
3252
+ "name": "stdout",
3253
+ "output_type": "stream",
3254
+ "text": [
3255
+ "<class 'pandas.core.frame.DataFrame'>\n",
3256
+ "Index: 9762 entries, 126 to 6276743\n",
3257
+ "Data columns (total 18 columns):\n",
3258
+ " # Column Non-Null Count Dtype \n",
3259
+ "--- ------ -------------- ----- \n",
3260
+ " 0 treeoflife_id 9762 non-null object \n",
3261
+ " 1 eol_content_id 9762 non-null float64\n",
3262
+ " 2 eol_page_id 9762 non-null float64\n",
3263
+ " 3 kingdom 9737 non-null object \n",
3264
+ " 4 phylum 9737 non-null object \n",
3265
+ " 5 class 9729 non-null object \n",
3266
+ " 6 order 9728 non-null object \n",
3267
+ " 7 family 9737 non-null object \n",
3268
+ " 8 genus 9738 non-null object \n",
3269
+ " 9 species 9749 non-null object \n",
3270
+ " 10 common 9762 non-null object \n",
3271
+ " 11 EOL page ID 0 non-null float64\n",
3272
+ " 12 Medium Source URL 0 non-null object \n",
3273
+ " 13 EOL Full-Size Copy URL 0 non-null object \n",
3274
+ " 14 License Name 0 non-null object \n",
3275
+ " 15 Copyright Owner 0 non-null object \n",
3276
+ " 16 num_content_ids_missing 9762 non-null object \n",
3277
+ " 17 duplicate 9762 non-null bool \n",
3278
+ "dtypes: bool(1), float64(3), object(14)\n",
3279
+ "memory usage: 1.3+ MB\n"
3280
+ ]
3281
+ },
3282
+ {
3283
+ "name": "stderr",
3284
+ "output_type": "stream",
3285
+ "text": [
3286
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/4119024090.py:2: SettingWithCopyWarning: \n",
3287
+ "A value is trying to be set on a copy of a slice from a DataFrame.\n",
3288
+ "Try using .loc[row_indexer,col_indexer] = value instead\n",
3289
+ "\n",
3290
+ "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
3291
+ " eol_taxa_df_missing_media['duplicate'] = eol_taxa_df_missing_media.duplicated(subset = \"eol_page_id\", keep = 'first')\n"
3292
+ ]
3293
+ }
3294
+ ],
3295
+ "source": [
3296
+ "#unique page_ids\n",
3297
+ "eol_taxa_df_missing_media['duplicate'] = eol_taxa_df_missing_media.duplicated(subset = \"eol_page_id\", keep = 'first')\n",
3298
+ "eol_taxa_df_num_missing_pg = eol_taxa_df_missing_media.loc[~eol_taxa_df_missing_media['duplicate']]\n",
3299
+ "eol_taxa_df_num_missing_pg.info()"
3300
+ ]
3301
+ },
3302
+ {
3303
+ "cell_type": "markdown",
3304
+ "metadata": {},
3305
+ "source": [
3306
+ "This file has the relevant info relating to number of missing content IDs per page id, content ID included is just the first instance of such a content ID."
3307
+ ]
3308
+ },
3309
+ {
3310
+ "cell_type": "code",
3311
+ "execution_count": 46,
3312
+ "metadata": {},
3313
+ "outputs": [],
3314
+ "source": [
3315
+ "eol_taxa_df_num_missing_pg[cols_of_interest].to_csv(\"../data/eol_taxa_df_num_missing_pg.csv\", index = False)"
3316
+ ]
3317
+ },
3318
+ {
3319
+ "cell_type": "code",
3320
+ "execution_count": 64,
3321
+ "metadata": {},
3322
+ "outputs": [
3323
+ {
3324
+ "name": "stdout",
3325
+ "output_type": "stream",
3326
+ "text": [
3327
+ "<class 'pandas.core.frame.DataFrame'>\n",
3328
+ "Index: 625101 entries, 158 to 6574052\n",
3329
+ "Data columns (total 6 columns):\n",
3330
+ " # Column Non-Null Count Dtype \n",
3331
+ "--- ------ -------------- ----- \n",
3332
+ " 0 eol_content_id 625101 non-null int64 \n",
3333
+ " 1 eol_page_id 625101 non-null int64 \n",
3334
+ " 2 Medium Source URL 625101 non-null object\n",
3335
+ " 3 EOL Full-Size Copy URL 625101 non-null object\n",
3336
+ " 4 License Name 625101 non-null object\n",
3337
+ " 5 Copyright Owner 548916 non-null object\n",
3338
+ "dtypes: int64(2), object(4)\n",
3339
+ "memory usage: 33.4+ MB\n"
3340
+ ]
3341
+ }
3342
+ ],
3343
+ "source": [
3344
+ "jul26_page_df = media.loc[media.eol_page_id.isin(pg_ids_missing_content)]\n",
3345
+ "jul26_page_df.info()"
3346
+ ]
3347
+ },
3348
+ {
3349
+ "cell_type": "code",
3350
+ "execution_count": 65,
3351
+ "metadata": {},
3352
+ "outputs": [
3353
+ {
3354
+ "data": {
3355
+ "text/plain": [
3356
+ "eol_content_id 625101\n",
3357
+ "eol_page_id 9610\n",
3358
+ "Medium Source URL 624653\n",
3359
+ "EOL Full-Size Copy URL 625101\n",
3360
+ "License Name 16\n",
3361
+ "Copyright Owner 87833\n",
3362
+ "dtype: int64"
3363
+ ]
3364
+ },
3365
+ "execution_count": 65,
3366
+ "metadata": {},
3367
+ "output_type": "execute_result"
3368
+ }
3369
+ ],
3370
+ "source": [
3371
+ "jul26_page_df.nunique()"
3372
+ ]
3373
+ },
3374
+ {
3375
+ "cell_type": "markdown",
3376
+ "metadata": {},
3377
+ "source": [
3378
+ "Yes, that's the expected number of unique page IDs. Let's save to CSV for download."
3379
+ ]
3380
+ },
3381
+ {
3382
+ "cell_type": "code",
3383
+ "execution_count": 66,
3384
+ "metadata": {},
3385
+ "outputs": [],
3386
+ "source": [
3387
+ "jul26_page_df.to_csv(\"../data/jul26_pages.csv\", index = False)"
3388
+ ]
3389
+ },
3390
+ {
3391
+ "cell_type": "markdown",
3392
+ "metadata": {},
3393
+ "source": [
3394
+ "#### Check Older Media Manifest for Missing Pages\n",
3395
+ "\n",
3396
+ "Let's take a look at the July 6th media manifest to see if these pages are there."
3397
+ ]
3398
+ },
3399
+ {
3400
+ "cell_type": "code",
3401
+ "execution_count": 49,
3402
+ "metadata": {},
3403
+ "outputs": [
3404
+ {
3405
+ "name": "stdout",
3406
+ "output_type": "stream",
3407
+ "text": [
3408
+ "There are 443898 total page ids in the July 6 media manifest.\n",
3409
+ "0\n"
3410
+ ]
3411
+ }
3412
+ ],
3413
+ "source": [
3414
+ "media_old.rename(columns = {\"EOL page ID\": \"eol_page_id\"}, inplace = True)\n",
3415
+ "pg_ids_media_old = set(media_old.eol_page_id)\n",
3416
+ "\n",
3417
+ "print(f\"There are {len(pg_ids_media_old)} total page ids in the July 6 media manifest.\")\n",
3418
+ "\n",
3419
+ "missing_pgs_jul6 = []\n",
3420
+ "for pg in missing_pgs:\n",
3421
+ " if pg not in pg_ids_media_old:\n",
3422
+ " missing_pgs_jul6.append(pg)\n",
3423
+ "print(len(missing_pgs_jul6))"
3424
+ ]
3425
+ },
3426
+ {
3427
+ "cell_type": "markdown",
3428
+ "metadata": {},
3429
+ "source": [
3430
+ "It seems the missing pages are in the _older_ media manifest!\n",
3431
+ "\n",
3432
+ "Let's merge this with the `missing_pgs_df`, so we can get URLs to download from the pages there."
3433
+ ]
3434
+ },
3435
+ {
3436
+ "cell_type": "code",
3437
+ "execution_count": 51,
3438
+ "metadata": {},
3439
+ "outputs": [
3440
+ {
3441
+ "data": {
3442
+ "text/html": [
3443
+ "<div>\n",
3444
+ "<style scoped>\n",
3445
+ " .dataframe tbody tr th:only-of-type {\n",
3446
+ " vertical-align: middle;\n",
3447
+ " }\n",
3448
+ "\n",
3449
+ " .dataframe tbody tr th {\n",
3450
+ " vertical-align: top;\n",
3451
+ " }\n",
3452
+ "\n",
3453
+ " .dataframe thead th {\n",
3454
+ " text-align: right;\n",
3455
+ " }\n",
3456
+ "</style>\n",
3457
+ "<table border=\"1\" class=\"dataframe\">\n",
3458
+ " <thead>\n",
3459
+ " <tr style=\"text-align: right;\">\n",
3460
+ " <th></th>\n",
3461
+ " <th>treeoflife_id</th>\n",
3462
+ " <th>eol_content_id</th>\n",
3463
+ " <th>eol_page_id</th>\n",
3464
+ " <th>kingdom</th>\n",
3465
+ " <th>phylum</th>\n",
3466
+ " <th>class</th>\n",
3467
+ " <th>order</th>\n",
3468
+ " <th>family</th>\n",
3469
+ " <th>genus</th>\n",
3470
+ " <th>species</th>\n",
3471
+ " <th>common</th>\n",
3472
+ " <th>num_content_ids_missing</th>\n",
3473
+ " </tr>\n",
3474
+ " </thead>\n",
3475
+ " <tbody>\n",
3476
+ " <tr>\n",
3477
+ " <th>4850</th>\n",
3478
+ " <td>e5a7255b-14c0-45eb-b404-09562425e03d</td>\n",
3479
+ " <td>2779195.0</td>\n",
3480
+ " <td>4446364.0</td>\n",
3481
+ " <td>Animalia</td>\n",
3482
+ " <td>Chordata</td>\n",
3483
+ " <td>Mammalia</td>\n",
3484
+ " <td>Artiodactyla</td>\n",
3485
+ " <td>Cervidae</td>\n",
3486
+ " <td>Cervus</td>\n",
3487
+ " <td>elaphus</td>\n",
3488
+ " <td>Yarkand deer</td>\n",
3489
+ " <td>252.0</td>\n",
3490
+ " </tr>\n",
3491
+ " <tr>\n",
3492
+ " <th>9875</th>\n",
3493
+ " <td>97b26264-4d17-4c25-ba11-ee1d13038787</td>\n",
3494
+ " <td>2740143.0</td>\n",
3495
+ " <td>47364113.0</td>\n",
3496
+ " <td>Animalia</td>\n",
3497
+ " <td>Chordata</td>\n",
3498
+ " <td>Actinopterygii</td>\n",
3499
+ " <td>Labriformes</td>\n",
3500
+ " <td>Labridae</td>\n",
3501
+ " <td>Notolabrus</td>\n",
3502
+ " <td>tetricus</td>\n",
3503
+ " <td>Rotfish</td>\n",
3504
+ " <td>20.0</td>\n",
3505
+ " </tr>\n",
3506
+ " <tr>\n",
3507
+ " <th>46727</th>\n",
3508
+ " <td>88b70cf5-29eb-47ec-b342-d948d17eb75b</td>\n",
3509
+ " <td>2779236.0</td>\n",
3510
+ " <td>4446364.0</td>\n",
3511
+ " <td>Animalia</td>\n",
3512
+ " <td>Chordata</td>\n",
3513
+ " <td>Mammalia</td>\n",
3514
+ " <td>Artiodactyla</td>\n",
3515
+ " <td>Cervidae</td>\n",
3516
+ " <td>Cervus</td>\n",
3517
+ " <td>elaphus</td>\n",
3518
+ " <td>Yarkand deer</td>\n",
3519
+ " <td>252.0</td>\n",
3520
+ " </tr>\n",
3521
+ " <tr>\n",
3522
+ " <th>51799</th>\n",
3523
+ " <td>f18ffd83-1f37-4196-9508-9d5a6170d18f</td>\n",
3524
+ " <td>2779349.0</td>\n",
3525
+ " <td>4446364.0</td>\n",
3526
+ " <td>Animalia</td>\n",
3527
+ " <td>Chordata</td>\n",
3528
+ " <td>Mammalia</td>\n",
3529
+ " <td>Artiodactyla</td>\n",
3530
+ " <td>Cervidae</td>\n",
3531
+ " <td>Cervus</td>\n",
3532
+ " <td>elaphus</td>\n",
3533
+ " <td>Yarkand deer</td>\n",
3534
+ " <td>252.0</td>\n",
3535
+ " </tr>\n",
3536
+ " <tr>\n",
3537
+ " <th>53243</th>\n",
3538
+ " <td>9d3f201f-84fd-4552-89a6-3d87184bd3e1</td>\n",
3539
+ " <td>2779324.0</td>\n",
3540
+ " <td>4446364.0</td>\n",
3541
+ " <td>Animalia</td>\n",
3542
+ " <td>Chordata</td>\n",
3543
+ " <td>Mammalia</td>\n",
3544
+ " <td>Artiodactyla</td>\n",
3545
+ " <td>Cervidae</td>\n",
3546
+ " <td>Cervus</td>\n",
3547
+ " <td>elaphus</td>\n",
3548
+ " <td>Yarkand deer</td>\n",
3549
+ " <td>252.0</td>\n",
3550
+ " </tr>\n",
3551
+ " </tbody>\n",
3552
+ "</table>\n",
3553
+ "</div>"
3554
+ ],
3555
+ "text/plain": [
3556
+ " treeoflife_id eol_content_id eol_page_id \\\n",
3557
+ "4850 e5a7255b-14c0-45eb-b404-09562425e03d 2779195.0 4446364.0 \n",
3558
+ "9875 97b26264-4d17-4c25-ba11-ee1d13038787 2740143.0 47364113.0 \n",
3559
+ "46727 88b70cf5-29eb-47ec-b342-d948d17eb75b 2779236.0 4446364.0 \n",
3560
+ "51799 f18ffd83-1f37-4196-9508-9d5a6170d18f 2779349.0 4446364.0 \n",
3561
+ "53243 9d3f201f-84fd-4552-89a6-3d87184bd3e1 2779324.0 4446364.0 \n",
3562
+ "\n",
3563
+ " kingdom phylum class order family genus \\\n",
3564
+ "4850 Animalia Chordata Mammalia Artiodactyla Cervidae Cervus \n",
3565
+ "9875 Animalia Chordata Actinopterygii Labriformes Labridae Notolabrus \n",
3566
+ "46727 Animalia Chordata Mammalia Artiodactyla Cervidae Cervus \n",
3567
+ "51799 Animalia Chordata Mammalia Artiodactyla Cervidae Cervus \n",
3568
+ "53243 Animalia Chordata Mammalia Artiodactyla Cervidae Cervus \n",
3569
+ "\n",
3570
+ " species common num_content_ids_missing \n",
3571
+ "4850 elaphus Yarkand deer 252.0 \n",
3572
+ "9875 tetricus Rotfish 20.0 \n",
3573
+ "46727 elaphus Yarkand deer 252.0 \n",
3574
+ "51799 elaphus Yarkand deer 252.0 \n",
3575
+ "53243 elaphus Yarkand deer 252.0 "
3576
+ ]
3577
+ },
3578
+ "execution_count": 51,
3579
+ "metadata": {},
3580
+ "output_type": "execute_result"
3581
+ }
3582
+ ],
3583
+ "source": [
3584
+ "# Count and record number of content IDs for each page ID\n",
3585
+ "for pg_id in missing_pgs:\n",
3586
+ " content_id_list_mp = ['{}'.format(i) for i in missing_pgs_df.loc[missing_pgs_df['eol_page_id'] == pg_id]['eol_content_id'].unique()]\n",
3587
+ " missing_pgs_df.loc[missing_pgs_df['eol_page_id'] == pg_id, \"num_content_ids_missing\"] = len(content_id_list_mp)\n",
3588
+ "\n",
3589
+ "missing_pgs_df.head()"
3590
+ ]
3591
+ },
3592
+ {
3593
+ "cell_type": "code",
3594
+ "execution_count": 52,
3595
+ "metadata": {},
3596
+ "outputs": [
3597
+ {
3598
+ "name": "stdout",
3599
+ "output_type": "stream",
3600
+ "text": [
3601
+ "<class 'pandas.core.frame.DataFrame'>\n",
3602
+ "Index: 152 entries, 4850 to 6257217\n",
3603
+ "Data columns (total 13 columns):\n",
3604
+ " # Column Non-Null Count Dtype \n",
3605
+ "--- ------ -------------- ----- \n",
3606
+ " 0 treeoflife_id 152 non-null object \n",
3607
+ " 1 eol_content_id 152 non-null float64\n",
3608
+ " 2 eol_page_id 152 non-null float64\n",
3609
+ " 3 kingdom 130 non-null object \n",
3610
+ " 4 phylum 130 non-null object \n",
3611
+ " 5 class 128 non-null object \n",
3612
+ " 6 order 128 non-null object \n",
3613
+ " 7 family 130 non-null object \n",
3614
+ " 8 genus 131 non-null object \n",
3615
+ " 9 species 152 non-null object \n",
3616
+ " 10 common 152 non-null object \n",
3617
+ " 11 num_content_ids_missing 152 non-null float64\n",
3618
+ " 12 duplicate 152 non-null bool \n",
3619
+ "dtypes: bool(1), float64(3), object(9)\n",
3620
+ "memory usage: 15.6+ KB\n"
3621
+ ]
3622
+ }
3623
+ ],
3624
+ "source": [
3625
+ "#unique page_ids\n",
3626
+ "missing_pgs_df['duplicate'] = missing_pgs_df.duplicated(subset = \"eol_page_id\", keep = 'first')\n",
3627
+ "eol_taxa_num_missing_pgs_df = missing_pgs_df.loc[~missing_pgs_df['duplicate']]\n",
3628
+ "eol_taxa_num_missing_pgs_df.info()"
3629
+ ]
3630
+ },
3631
+ {
3632
+ "cell_type": "code",
3633
+ "execution_count": 58,
3634
+ "metadata": {},
3635
+ "outputs": [
3636
+ {
3637
+ "name": "stdout",
3638
+ "output_type": "stream",
3639
+ "text": [
3640
+ "<class 'pandas.core.frame.DataFrame'>\n",
3641
+ "Index: 629 entries, 330 to 5701753\n",
3642
+ "Data columns (total 6 columns):\n",
3643
+ " # Column Non-Null Count Dtype \n",
3644
+ "--- ------ -------------- ----- \n",
3645
+ " 0 eol_content_id 629 non-null object\n",
3646
+ " 1 eol_page_id 629 non-null object\n",
3647
+ " 2 Medium Source URL 629 non-null object\n",
3648
+ " 3 EOL Full-Size Copy URL 629 non-null object\n",
3649
+ " 4 License Name 629 non-null object\n",
3650
+ " 5 Copyright Owner 628 non-null object\n",
3651
+ "dtypes: object(6)\n",
3652
+ "memory usage: 34.4+ KB\n"
3653
+ ]
3654
+ }
3655
+ ],
3656
+ "source": [
3657
+ "older_page_df = media_old.loc[media_old.eol_page_id.isin(missing_pgs)]\n",
3658
+ "older_page_df.info()"
3659
+ ]
3660
+ },
3661
+ {
3662
+ "cell_type": "code",
3663
+ "execution_count": 62,
3664
+ "metadata": {},
3665
+ "outputs": [
3666
+ {
3667
+ "data": {
3668
+ "text/html": [
3669
+ "<div>\n",
3670
+ "<style scoped>\n",
3671
+ " .dataframe tbody tr th:only-of-type {\n",
3672
+ " vertical-align: middle;\n",
3673
+ " }\n",
3674
+ "\n",
3675
+ " .dataframe tbody tr th {\n",
3676
+ " vertical-align: top;\n",
3677
+ " }\n",
3678
+ "\n",
3679
+ " .dataframe thead th {\n",
3680
+ " text-align: right;\n",
3681
+ " }\n",
3682
+ "</style>\n",
3683
+ "<table border=\"1\" class=\"dataframe\">\n",
3684
+ " <thead>\n",
3685
+ " <tr style=\"text-align: right;\">\n",
3686
+ " <th></th>\n",
3687
+ " <th>eol_content_id</th>\n",
3688
+ " <th>eol_page_id</th>\n",
3689
+ " <th>Medium Source URL</th>\n",
3690
+ " <th>EOL Full-Size Copy URL</th>\n",
3691
+ " <th>License Name</th>\n",
3692
+ " <th>Copyright Owner</th>\n",
3693
+ " </tr>\n",
3694
+ " </thead>\n",
3695
+ " <tbody>\n",
3696
+ " <tr>\n",
3697
+ " <th>98279</th>\n",
3698
+ " <td>2779184</td>\n",
3699
+ " <td>4446364.0</td>\n",
3700
+ " <td>https://static.inaturalist.org/photos/1056942/...</td>\n",
3701
+ " <td>https://content.eol.org/data/media/28/50/cf/18...</td>\n",
3702
+ " <td>cc-by-nc-4.0</td>\n",
3703
+ " <td>Tony Iwane</td>\n",
3704
+ " </tr>\n",
3705
+ " <tr>\n",
3706
+ " <th>98280</th>\n",
3707
+ " <td>2779185</td>\n",
3708
+ " <td>4446364.0</td>\n",
3709
+ " <td>https://static.inaturalist.org/photos/1110278/...</td>\n",
3710
+ " <td>https://content.eol.org/data/media/28/98/57/18...</td>\n",
3711
+ " <td>cc-by-nc-4.0</td>\n",
3712
+ " <td>Kenneth Bader</td>\n",
3713
+ " </tr>\n",
3714
+ " <tr>\n",
3715
+ " <th>98281</th>\n",
3716
+ " <td>2779186</td>\n",
3717
+ " <td>4446364.0</td>\n",
3718
+ " <td>https://static.inaturalist.org/photos/1314173/...</td>\n",
3719
+ " <td>https://content.eol.org/data/media/29/96/fc/18...</td>\n",
3720
+ " <td>cc-by-nc-4.0</td>\n",
3721
+ " <td>parobbert</td>\n",
3722
+ " </tr>\n",
3723
+ " <tr>\n",
3724
+ " <th>98282</th>\n",
3725
+ " <td>2779187</td>\n",
3726
+ " <td>4446364.0</td>\n",
3727
+ " <td>https://static.inaturalist.org/photos/1314707/...</td>\n",
3728
+ " <td>https://content.eol.org/data/media/29/97/db/18...</td>\n",
3729
+ " <td>cc-by-nc-4.0</td>\n",
3730
+ " <td>jriddell</td>\n",
3731
+ " </tr>\n",
3732
+ " <tr>\n",
3733
+ " <th>98283</th>\n",
3734
+ " <td>2779188</td>\n",
3735
+ " <td>4446364.0</td>\n",
3736
+ " <td>https://static.inaturalist.org/photos/1320107/...</td>\n",
3737
+ " <td>https://content.eol.org/data/media/29/9f/67/18...</td>\n",
3738
+ " <td>cc-by-nc-4.0</td>\n",
3739
+ " <td>Daniel George</td>\n",
3740
+ " </tr>\n",
3741
+ " <tr>\n",
3742
+ " <th>...</th>\n",
3743
+ " <td>...</td>\n",
3744
+ " <td>...</td>\n",
3745
+ " <td>...</td>\n",
3746
+ " <td>...</td>\n",
3747
+ " <td>...</td>\n",
3748
+ " <td>...</td>\n",
3749
+ " </tr>\n",
3750
+ " <tr>\n",
3751
+ " <th>98526</th>\n",
3752
+ " <td>2779431</td>\n",
3753
+ " <td>4446364.0</td>\n",
3754
+ " <td>https://static.inaturalist.org/photos/810701/o...</td>\n",
3755
+ " <td>https://content.eol.org/data/media/4c/10/a6/18...</td>\n",
3756
+ " <td>cc-by-nc-4.0</td>\n",
3757
+ " <td>john_peyton_anderson</td>\n",
3758
+ " </tr>\n",
3759
+ " <tr>\n",
3760
+ " <th>98527</th>\n",
3761
+ " <td>2779432</td>\n",
3762
+ " <td>4446364.0</td>\n",
3763
+ " <td>https://static.inaturalist.org/photos/810703/o...</td>\n",
3764
+ " <td>https://content.eol.org/data/media/4c/10/a8/18...</td>\n",
3765
+ " <td>cc-by-nc-4.0</td>\n",
3766
+ " <td>john_peyton_anderson</td>\n",
3767
+ " </tr>\n",
3768
+ " <tr>\n",
3769
+ " <th>98528</th>\n",
3770
+ " <td>2779433</td>\n",
3771
+ " <td>4446364.0</td>\n",
3772
+ " <td>https://static.inaturalist.org/photos/810704/o...</td>\n",
3773
+ " <td>https://content.eol.org/data/media/4c/10/a9/18...</td>\n",
3774
+ " <td>cc-by-nc-4.0</td>\n",
3775
+ " <td>john_peyton_anderson</td>\n",
3776
+ " </tr>\n",
3777
+ " <tr>\n",
3778
+ " <th>98529</th>\n",
3779
+ " <td>2779434</td>\n",
3780
+ " <td>4446364.0</td>\n",
3781
+ " <td>https://static.inaturalist.org/photos/814016/o...</td>\n",
3782
+ " <td>https://content.eol.org/data/media/4c/16/0d/18...</td>\n",
3783
+ " <td>cc-by-nc-4.0</td>\n",
3784
+ " <td>JK Johnson</td>\n",
3785
+ " </tr>\n",
3786
+ " <tr>\n",
3787
+ " <th>98530</th>\n",
3788
+ " <td>2779435</td>\n",
3789
+ " <td>4446364.0</td>\n",
3790
+ " <td>https://static.inaturalist.org/photos/828800/o...</td>\n",
3791
+ " <td>https://content.eol.org/data/media/4c/28/09/18...</td>\n",
3792
+ " <td>cc-by-nc-4.0</td>\n",
3793
+ " <td>Liam O'Brien</td>\n",
3794
+ " </tr>\n",
3795
+ " </tbody>\n",
3796
+ "</table>\n",
3797
+ "<p>252 rows × 6 columns</p>\n",
3798
+ "</div>"
3799
+ ],
3800
+ "text/plain": [
3801
+ " eol_content_id eol_page_id \\\n",
3802
+ "98279 2779184 4446364.0 \n",
3803
+ "98280 2779185 4446364.0 \n",
3804
+ "98281 2779186 4446364.0 \n",
3805
+ "98282 2779187 4446364.0 \n",
3806
+ "98283 2779188 4446364.0 \n",
3807
+ "... ... ... \n",
3808
+ "98526 2779431 4446364.0 \n",
3809
+ "98527 2779432 4446364.0 \n",
3810
+ "98528 2779433 4446364.0 \n",
3811
+ "98529 2779434 4446364.0 \n",
3812
+ "98530 2779435 4446364.0 \n",
3813
+ "\n",
3814
+ " Medium Source URL \\\n",
3815
+ "98279 https://static.inaturalist.org/photos/1056942/... \n",
3816
+ "98280 https://static.inaturalist.org/photos/1110278/... \n",
3817
+ "98281 https://static.inaturalist.org/photos/1314173/... \n",
3818
+ "98282 https://static.inaturalist.org/photos/1314707/... \n",
3819
+ "98283 https://static.inaturalist.org/photos/1320107/... \n",
3820
+ "... ... \n",
3821
+ "98526 https://static.inaturalist.org/photos/810701/o... \n",
3822
+ "98527 https://static.inaturalist.org/photos/810703/o... \n",
3823
+ "98528 https://static.inaturalist.org/photos/810704/o... \n",
3824
+ "98529 https://static.inaturalist.org/photos/814016/o... \n",
3825
+ "98530 https://static.inaturalist.org/photos/828800/o... \n",
3826
+ "\n",
3827
+ " EOL Full-Size Copy URL License Name \\\n",
3828
+ "98279 https://content.eol.org/data/media/28/50/cf/18... cc-by-nc-4.0 \n",
3829
+ "98280 https://content.eol.org/data/media/28/98/57/18... cc-by-nc-4.0 \n",
3830
+ "98281 https://content.eol.org/data/media/29/96/fc/18... cc-by-nc-4.0 \n",
3831
+ "98282 https://content.eol.org/data/media/29/97/db/18... cc-by-nc-4.0 \n",
3832
+ "98283 https://content.eol.org/data/media/29/9f/67/18... cc-by-nc-4.0 \n",
3833
+ "... ... ... \n",
3834
+ "98526 https://content.eol.org/data/media/4c/10/a6/18... cc-by-nc-4.0 \n",
3835
+ "98527 https://content.eol.org/data/media/4c/10/a8/18... cc-by-nc-4.0 \n",
3836
+ "98528 https://content.eol.org/data/media/4c/10/a9/18... cc-by-nc-4.0 \n",
3837
+ "98529 https://content.eol.org/data/media/4c/16/0d/18... cc-by-nc-4.0 \n",
3838
+ "98530 https://content.eol.org/data/media/4c/28/09/18... cc-by-nc-4.0 \n",
3839
+ "\n",
3840
+ " Copyright Owner \n",
3841
+ "98279 Tony Iwane \n",
3842
+ "98280 Kenneth Bader \n",
3843
+ "98281 parobbert \n",
3844
+ "98282 jriddell \n",
3845
+ "98283 Daniel George \n",
3846
+ "... ... \n",
3847
+ "98526 john_peyton_anderson \n",
3848
+ "98527 john_peyton_anderson \n",
3849
+ "98528 john_peyton_anderson \n",
3850
+ "98529 JK Johnson \n",
3851
+ "98530 Liam O'Brien \n",
3852
+ "\n",
3853
+ "[252 rows x 6 columns]"
3854
+ ]
3855
+ },
3856
+ "execution_count": 62,
3857
+ "metadata": {},
3858
+ "output_type": "execute_result"
3859
+ }
3860
+ ],
3861
+ "source": [
3862
+ "older_page_df.loc[older_page_df.eol_page_id.astype(str) == \"4446364.0\"]"
3863
+ ]
3864
+ },
3865
+ {
3866
+ "cell_type": "markdown",
3867
+ "metadata": {},
3868
+ "source": [
3869
+ "Looks good, let's save to CSV."
3870
+ ]
3871
+ },
3872
+ {
3873
+ "cell_type": "code",
3874
+ "execution_count": 63,
3875
+ "metadata": {},
3876
+ "outputs": [],
3877
+ "source": [
3878
+ "older_page_df.to_csv(\"../data/media_old_pages.csv\", index = False)"
3879
+ ]
3880
  },
3881
  {
3882
  "cell_type": "markdown",
 
4448
  }
4449
  },
4450
  "nbformat": 4,
4451
+ "nbformat_minor": 4
4452
  }
notebooks/ToL_license_check.py CHANGED
@@ -6,7 +6,7 @@
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
@@ -120,7 +120,7 @@ eol_missing_content_ids.head()
120
  # The pages exist (`eol.org/pages/<eol_page_id>`), but the content IDs do not (`eol.org/media/<eol_content_id>` produces 404).
121
 
122
  # %%
123
- eol_missing_content_ids.to_csv("../data/eol_missing_content_ids.csv", index = False)
124
 
125
  # %%
126
  media_old = pd.read_csv("../data/media_manifest.csv")
@@ -199,7 +199,7 @@ eol_taxa_df_media.loc[eol_taxa_df_media["Medium Source URL"].isna()].sample(7)
199
  # Save a copy of the missing content IDs with taxa info as well.
200
 
201
  # %%
202
- eol_taxa_df_media.loc[eol_taxa_df_media["Medium Source URL"].isna()].to_csv("../data/eol_taxa_missing_content_ids.csv", index = False)
203
 
204
  # %% [markdown]
205
  # And in `catalog`...
@@ -257,9 +257,207 @@ media_in_cargo.info(show_counts = True)
257
  # %% [markdown]
258
  # But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed.
259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  # %%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
 
262
  # %%
 
263
 
264
  # %% [markdown]
265
  # ## Check EOL License file(s)
 
6
  # extension: .py
7
  # format_name: percent
8
  # format_version: '1.3'
9
+ # jupytext_version: 1.16.0
10
  # kernelspec:
11
  # display_name: Python 3 (ipykernel)
12
  # language: python
 
120
  # The pages exist (`eol.org/pages/<eol_page_id>`), but the content IDs do not (`eol.org/media/<eol_content_id>` produces 404).
121
 
122
  # %%
123
+ #eol_missing_content_ids.to_csv("../data/eol_missing_content_ids.csv", index = False)
124
 
125
  # %%
126
  media_old = pd.read_csv("../data/media_manifest.csv")
 
199
  # Save a copy of the missing content IDs with taxa info as well.
200
 
201
  # %%
202
+ #eol_taxa_df_media.loc[eol_taxa_df_media["Medium Source URL"].isna()].to_csv("../data/eol_taxa_missing_content_ids.csv", index = False)
203
 
204
  # %% [markdown]
205
  # And in `catalog`...
 
257
  # %% [markdown]
258
  # But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed.
259
 
260
+ # %% [markdown]
261
+ # ## Compare to Newer Media Manifest
262
+ #
263
+ # We will load in a [new media manifest](https://huggingface.co/datasets/imageomics/eol/blob/3aa274067fc4a18877fb394b1d49a92962c57ed8/data/interim/media_manifest_Dec6.csv) (downloaded Dec. 6) to match up `page_id`s for the missing `content_id`s. This way we can download the images and compare via MD5 checksums to hopefully map the new `content_id`s to the old. (See [discussion #18](https://huggingface.co/datasets/imageomics/eol/discussions/18) in [EOL Repo](https://huggingface.co/datasets/imageomics/eol).)
264
+
265
+ # %%
266
+ media_new = pd.read_csv("../data/media_manifest_Dec6.csv", low_memory = False)
267
+ media_new.info(show_counts = True)
268
+
269
+ # %%
270
+ media_new.head()
271
+
272
+ # %% [markdown]
273
+ # To allow for easier sanity-check on the matches, we'll use the version of missing info list with taxa included.
274
+
275
+ # %%
276
+ eol_taxa_df_missing_media = eol_taxa_df_media.loc[eol_taxa_df_media["Medium Source URL"].isna()]
277
+ eol_taxa_df_missing_media.head()
278
+
279
+ # %% [markdown]
280
+ # Rename `EOL content ID` and `EOL page ID` columns to match our `eol_taxa_df_missing_media` for easier merging.
281
+
282
+ # %%
283
+ media_new.rename(columns = {"EOL content ID": "eol_content_id", "EOL page ID": "eol_page_id"}, inplace = True)
284
+
285
+ # %% [markdown]
286
+ # First check for any matching content IDs
287
+
288
+ # %%
289
+ eol_taxa_df_missing_media_new_check = pd.merge(eol_taxa_df_missing_media[cols_of_interest], media_new, how = "left", on = "eol_content_id")
290
+ eol_taxa_df_missing_media_new_check.info(show_counts = True)
291
+
292
+ # %% [markdown]
293
+ # Yes, there are no matching content IDs here.
294
+ #
295
+ # Now, let's get our match on page IDs to check they are all listed still for download.
296
+
297
+ # %%
298
+ pg_ids_missing_content = set(eol_taxa_df_missing_media.eol_page_id)
299
+ pg_ids_media_new = set(media_new.eol_page_id)
300
+
301
+ print(f"There are {len(pg_ids_missing_content)} unique page ids that have missing content ids, and there are {len(pg_ids_media_new)} total page ids in the new media manifest.")
302
+
303
+
304
+ # %%
305
+ missing_pgs = []
306
+ for pg in pg_ids_missing_content:
307
+ if pg not in pg_ids_media_new:
308
+ missing_pgs.append(pg)
309
+ print(len(missing_pgs))
310
+
311
+ # %%
312
+ media.rename(columns = {"EOL page ID": "eol_page_id"}, inplace = True)
313
+ pg_ids_media = set(media.eol_page_id)
314
+
315
+ print(f"There are {len(pg_ids_media)} total page ids in the July 26 media manifest.")
316
+
317
+ missing_pgs_jul26 = []
318
+ for pg in pg_ids_missing_content:
319
+ if pg not in pg_ids_media:
320
+ missing_pgs_jul26.append(pg)
321
+ print(len(missing_pgs_jul26))
322
+
323
+ # %% [markdown]
324
+ # There seem to be 152 page IDs that don't match to either manifest.
325
+
326
+ # %%
327
+ missing_pgs[:10]
328
+
329
+ # %%
330
+ # Why are these floats...does it matter?
331
+ missing_pgs_int = [int(pg) for pg in missing_pgs]
332
+
333
+ int_missing_pgs = []
334
+ for pg in missing_pgs_int:
335
+ if pg not in pg_ids_media_new:
336
+ int_missing_pgs.append(pg)
337
+ print(len(int_missing_pgs))
338
+ print(int_missing_pgs[:5])
339
+
340
+ # %% [markdown]
341
+ # It does not matter. There seem to be 152 missing pages, let's try making a couple into URLs...
342
+ #
343
+ # The first has a page (https://eol.org/pages/47186210) without images. Let's compare these 152 page IDs to our `category.csv` page IDs. Maybe these were not added because there were no images (still odd they exist in `predicted-category.csv`, but not in the manifest).
344
+
345
+ # %%
346
+ cat_pgs = set(eol_cat_df.eol_page_id)
347
+
348
+ print(f"There are {len(cat_pgs)} total page ids in the July 26 media manifest.")
349
+
350
+ missing_cat_pgs = []
351
+ for pg in missing_pgs:
352
+ if pg not in cat_pgs:
353
+ missing_cat_pgs.append(pg)
354
+ print(len(missing_cat_pgs))
355
+
356
+ # %% [markdown]
357
+ # Nope, these are all in `category.csv`.
358
+ #
359
+ # Another no image page (https://eol.org/pages/47186225), [this](https://eol.org/pages/46334362) has more data, but still no images. https://eol.org/pages/47186380 & https://eol.org/pages/47121005 also don't show any images.
360
+ #
361
+ # Seems the images for all of these were removed or moved to other pages...
362
+ #
363
+ # Let's make a CSV for the missing pages to check that we do indeed have the images (sanity check), and we can compare the taxa!
364
+
365
+ # %%
366
+ missing_pgs_df = eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media["eol_page_id"].isin(missing_pgs)]
367
+ missing_pgs_df = missing_pgs_df[cols_of_interest]
368
+ missing_pgs_df.info()
369
+
370
+ # %%
371
+ missing_pgs_df.sample(10)
372
+
373
+ # %%
374
+ missing_pgs_df.to_csv("../data/catalog_missing_media_pages.csv", index = False)
375
+
376
+ # %% [markdown]
377
+ # ### Save File with EOL Page IDs & Number of missing content IDs associated with each
378
+
379
+ # %%
380
+ # Count and record number of content IDs for each page ID
381
+ for pg_id in pg_ids_missing_content:
382
+ content_id_list = ['{}'.format(i) for i in eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media['eol_page_id'] == pg_id]['eol_content_id'].unique()]
383
+ eol_taxa_df_missing_media.loc[eol_taxa_df_missing_media['eol_page_id'] == pg_id, "num_content_ids_missing"] = len(content_id_list)
384
+
385
+ cols_of_interest.append("num_content_ids_missing")
386
+ eol_taxa_df_missing_media[cols_of_interest].head()
387
+
388
+ # %%
389
+ #unique page_ids
390
+ eol_taxa_df_missing_media['duplicate'] = eol_taxa_df_missing_media.duplicated(subset = "eol_page_id", keep = 'first')
391
+ eol_taxa_df_num_missing_pg = eol_taxa_df_missing_media.loc[~eol_taxa_df_missing_media['duplicate']]
392
+ eol_taxa_df_num_missing_pg.info()
393
+
394
+ # %% [markdown]
395
+ # This file has the relevant info relating to number of missing content IDs per page id, content ID included is just the first instance of such a content ID.
396
+
397
  # %%
398
+ eol_taxa_df_num_missing_pg[cols_of_interest].to_csv("../data/eol_taxa_df_num_missing_pg.csv", index = False)
399
+
400
+ # %%
401
+ jul26_page_df = media.loc[media.eol_page_id.isin(pg_ids_missing_content)]
402
+ jul26_page_df.info()
403
+
404
+ # %%
405
+ jul26_page_df.nunique()
406
+
407
+ # %% [markdown]
408
+ # Yes, that's the expected number of unique page IDs. Let's save to CSV for download.
409
+
410
+ # %%
411
+ jul26_page_df.to_csv("../data/jul26_pages.csv", index = False)
412
+
413
+ # %% [markdown]
414
+ # #### Check Older Media Manifest for Missing Pages
415
+ #
416
+ # Let's take a look at the July 6th media manifest to see if these pages are there.
417
+
418
+ # %%
419
+ media_old.rename(columns = {"EOL page ID": "eol_page_id"}, inplace = True)
420
+ pg_ids_media_old = set(media_old.eol_page_id)
421
+
422
+ print(f"There are {len(pg_ids_media_old)} total page ids in the July 6 media manifest.")
423
+
424
+ missing_pgs_jul6 = []
425
+ for pg in missing_pgs:
426
+ if pg not in pg_ids_media_old:
427
+ missing_pgs_jul6.append(pg)
428
+ print(len(missing_pgs_jul6))
429
+
430
+ # %% [markdown]
431
+ # It seems the missing pages are in the _older_ media manifest!
432
+ #
433
+ # Let's merge this with the `missing_pgs_df`, so we can get URLs to download from the pages there.
434
+
435
+ # %%
436
+ # Count and record number of content IDs for each page ID
437
+ for pg_id in missing_pgs:
438
+ content_id_list_mp = ['{}'.format(i) for i in missing_pgs_df.loc[missing_pgs_df['eol_page_id'] == pg_id]['eol_content_id'].unique()]
439
+ missing_pgs_df.loc[missing_pgs_df['eol_page_id'] == pg_id, "num_content_ids_missing"] = len(content_id_list_mp)
440
+
441
+ missing_pgs_df.head()
442
+
443
+ # %%
444
+ #unique page_ids
445
+ missing_pgs_df['duplicate'] = missing_pgs_df.duplicated(subset = "eol_page_id", keep = 'first')
446
+ eol_taxa_num_missing_pgs_df = missing_pgs_df.loc[~missing_pgs_df['duplicate']]
447
+ eol_taxa_num_missing_pgs_df.info()
448
+
449
+ # %%
450
+ older_page_df = media_old.loc[media_old.eol_page_id.isin(missing_pgs)]
451
+ older_page_df.info()
452
+
453
+ # %%
454
+ older_page_df.loc[older_page_df.eol_page_id.astype(str) == "4446364.0"]
455
+
456
+ # %% [markdown]
457
+ # Looks good, let's save to CSV.
458
 
459
  # %%
460
+ older_page_df.to_csv("../data/media_old_pages.csv", index = False)
461
 
462
  # %% [markdown]
463
  # ## Check EOL License file(s)