diff --git a/guide/03-the-gis/cloning-content.ipynb b/guide/03-the-gis/cloning-content.ipynb index a2e59e65f4..ac69a6bfc0 100644 --- a/guide/03-the-gis/cloning-content.ipynb +++ b/guide/03-the-gis/cloning-content.ipynb @@ -84,18 +84,9 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.\n", - "Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.\n" - ] - } - ], + "outputs": [], "source": [ "from pathlib import Path\n", "import sys\n", @@ -123,14 +114,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "GIS @ https://geosaurus.maps.arcgis.com version:2023.3\n" + "GIS @ https://geosaurus.maps.arcgis.com version:2025.2\n" ] } ], @@ -141,19 +132,19 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "GIS @ https://example.url.com/portal version:10.3\n" + "GIS @ https://geosaurus.maps.arcgis.com version:2025.2\n" ] } ], "source": [ - "target = GIS(profile=\"your_data_owner_profile\")\n", + "target = GIS(profile=\"your_online_api_data_owner_profile\")\n", "print(target)" ] }, @@ -485,6 +476,7 @@ "
16 rows × 53 columns
\n", - "" - ], - "text/plain": [ - " id owner created \\\n", - "590 935b9032e6c8492ebcd5ff3d9c8131e9 ArcGISPyAPIBot 1685983591000 \n", - "701 549169f28ce9424d94f7c5f237d33840 ArcGISPyAPIBot 1607547954000 \n", - "1305 e4ba5816764748f1b36ead1a1327c37f ArcGISPyAPIBot 1692895691000 \n", - "1359 061b561058484cbda73eea08dffe43bf ArcGISPyAPIBot 1698259114000 \n", - "1360 6b1f7ea22e2543aa9849e34097d05570 ArcGISPyAPIBot 1708463115000 \n", - "1364 437df2865e0f4147853a98d883d93c13 ArcGISPyAPIBot 1582579501000 \n", - "1382 8596074ae0af45039ec50e86c83b17e0 ArcGISPyAPIBot 1656553353000 \n", - "1383 0c787e9cba574a5eb773c9846d90a8c6 ArcGISPyAPIBot 1654023844000 \n", - "1384 3f7a064e12254f6b80a3f9179b37b8b7 ArcGISPyAPIBot 1656553355000 \n", - "1385 55f662afe71145fcbf107e783710c0bf ArcGISPyAPIBot 1656553356000 \n", - "1386 dde150ba99454b00895225d06bdc7473 ArcGISPyAPIBot 1654023846000 \n", - "1387 21f421cb5817471ab65185a53febc8ab ArcGISPyAPIBot 1654023843000 \n", - "1420 62f50f03e1c846d9a547c0480dc768e0 ArcGISPyAPIBot 1684115932000 \n", - "1421 6d8e89f6fb0a4c8a8bb5e059846425d9 ArcGISPyAPIBot 1601408274000 \n", - "1433 bc2e103d1c81422bb117a2a6f2491db3 ArcGISPyAPIBot 1573859849000 \n", - "1446 84e125b2bb9a413aa250c8bd1a27d4a7 ArcGISPyAPIBot 1694650220000 \n", - "\n", - " isOrgItem modified guid name title \\\n", - "590 True 1685983595000 None None Case 02773785 220 Mbs \n", - "701 True 1612904683000 None None Chicago_Libraries_High_Checkout \n", - "1305 True 1693252353000 None None set1_cities_webmap \n", - "1359 True 1698259116000 None None UC Location \n", - "1360 True 1708463115000 None None US Power Plant Data \n", - "1364 True 1582590674000 None None Vietnam for Testing \n", - "1382 True 1656553353000 None None erase_me_map \n", - "1383 True 1654023844000 None None erase_me_map \n", - "1384 True 1656553355000 None None erase_me_map \n", - "1385 True 1656553356000 None None erase_me_map \n", - "1386 True 1654023846000 None None erase_me_map \n", - "1387 True 1654023843000 None None erase_me_map \n", - "1420 True 1684115935000 None None Giraffes \n", - "1421 True 1684115692000 None None Giraffes Original \n", - "1433 True 1573859860000 None None mult_lyr_webmap \n", - "1446 True 1694650235000 None None pansharpened_landsat_times_3 \n", - "\n", - " type typeKeywords ... \\\n", - "590 Web Map [ArcGIS Online, Collector, Data Editing, Explo... ... \n", - "701 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1305 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1359 Web Map [ArcGIS API for JavaScript, ArcGIS Online, Exp... ... \n", - "1360 Web Map [ArcGIS API for JavaScript, ArcGIS Online, Exp... ... \n", - "1364 Web Map [ArcGIS Online, Explorer Web Map, Map, Offline... ... \n", - "1382 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1383 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1384 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1385 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1386 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1387 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1420 Web Map [ArcGIS Online, Explorer Web Map, FieldMapsDis... ... \n", - "1421 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1433 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "1446 Web Map [ArcGIS Online, Explorer Web Map, Map, Online ... ... \n", - "\n", - " tokenExpirationDate token2ExpirationDate contentOrigin lastViewed \\\n", - "590 -1 -1 self 1708671600000 \n", - "701 -1 -1 self 1708671600000 \n", - "1305 -1 -1 self 1709020800000 \n", - "1359 -1 -1 self 1708671600000 \n", - "1360 -1 -1 self 1708671600000 \n", - "1364 -1 -1 self 1708671600000 \n", - "1382 -1 -1 self 1708671600000 \n", - "1383 -1 -1 self 1708671600000 \n", - "1384 -1 -1 self 1708671600000 \n", - "1385 -1 -1 self 1708671600000 \n", - "1386 -1 -1 self 1708671600000 \n", - "1387 -1 -1 self 1708671600000 \n", - "1420 -1 -1 self 1708671600000 \n", - "1421 -1 -1 self 1708671600000 \n", - "1433 -1 -1 self 1708671600000 \n", - "1446 -1 -1 self 1708671600000 \n", - "\n", - " size commentsEnabled itemControl layers tables contentStatus \n", - "590 NaN NaN NaN NaN NaN NaN \n", - "701 NaN NaN NaN NaN NaN NaN \n", - "1305 NaN NaN NaN NaN NaN NaN \n", - "1359 NaN NaN NaN NaN NaN NaN \n", - "1360 NaN NaN NaN NaN NaN NaN \n", - "1364 NaN NaN NaN NaN NaN NaN \n", - "1382 NaN NaN NaN NaN NaN NaN \n", - "1383 NaN NaN NaN NaN NaN NaN \n", - "1384 NaN NaN NaN NaN NaN NaN \n", - "1385 NaN NaN NaN NaN NaN NaN \n", - "1386 NaN NaN NaN NaN NaN NaN \n", - "1387 NaN NaN NaN NaN NaN NaN \n", - "1420 NaN NaN NaN NaN NaN NaN \n", - "1421 NaN NaN NaN NaN NaN NaN \n", - "1433 NaN NaN NaN NaN NaN NaN \n", - "1446 NaN NaN NaN NaN NaN NaN \n", - "\n", - "[16 rows x 53 columns]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "wm_item_df = owner_items_df.groupby(\"type\").get_group(\"Web Map\")\n", - "wm_item_df" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The resulting DataFrame's index uses the position value of each web map in the original dataframe for the row index, so we'll reset it to a zero-based index:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index([1081, 1092, 1250, 1251, 1255, 1363, 1364, 1365, 1366, 1367, 1368, 1401,\n", - " 1402, 1414, 1428, 1454],\n", - " dtype='int64')" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "wm_item_df.index" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "web_maps = wm_item_df.reset_index(drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "RangeIndex(start=0, stop=16, step=1)" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "web_maps.index" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's retrieve a web map using a tag search so we can clone it into our target:" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "def check_wm(tag_list):\n", - " return \"power_plants\" in tag_list" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "power_plant_df = web_maps[web_maps.tags.apply(check_wm)]" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index([3], dtype='int64')" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "power_plant_df.index" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'6b1f7ea22e2543aa9849e34097d05570'" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "power_plant_df.loc[3].id" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "40 rows × 54 columns
\n", + "" + ], + "text/plain": [ + " id owner orgId \\\n", + "1147 935b9032e6c8492ebcd5ff3d9c8131e9 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1160 549169f28ce9424d94f7c5f237d33840 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1345 b365a799efc34fc7b1b286c06c019b3a ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1410 0c787e9cba574a5eb773c9846d90a8c6 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1411 8596074ae0af45039ec50e86c83b17e0 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1412 55f662afe71145fcbf107e783710c0bf ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1413 3f7a064e12254f6b80a3f9179b37b8b7 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1414 dde150ba99454b00895225d06bdc7473 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1415 21f421cb5817471ab65185a53febc8ab ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1462 62f50f03e1c846d9a547c0480dc768e0 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1463 6d8e89f6fb0a4c8a8bb5e059846425d9 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1465 ff0361d75c494f77a4959c959201b998 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1481 658e09e0c0cf415aa4bea0047195108d ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1483 85c3d6a0ac594f71b4e67ea79c05f184 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1490 bc2e103d1c81422bb117a2a6f2491db3 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "1997 e4ba5816764748f1b36ead1a1327c37f ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2263 31b5a9cc00d84407894aaf75cb474514 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2265 1ccb65d6c6a14f25adb4e2cf34c53f51 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2266 a49eabc793814b6ca65eb0dd746808a0 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2268 c9fc524a0e1b44549bc4c3236d94df01 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2269 4c22a07ee1764a15ad808755843c82a7 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2271 e6e14f068c804831bd97fa214beecec8 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2272 dbcd5d035a3c48b6ac6899079bb2b68d ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2273 5741f0cd54684aaaa5555ba530dbf031 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2275 c1aeb94d26494d959076acc343d62c4a ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2276 fa23b8c765db4078b0b67c795527adff ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2277 cea1ee09715b4a3b91bb19d14abf8266 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2279 e4ac0aa340d846aea9f6056876f0a7bd ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2281 ab00598e5d4049b2b4431231fcca2a7e ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2282 e16ef566feac455686ff00e59c324d18 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2283 22082b26fc4b4cb4b6a7b41ac46a70ec ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2285 1e6a34664fe44ef09ed2a524dfe637cf ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2286 c68dd1afb54841f1b9782f6bfb802d7b ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2288 5b6885b632c44252aa83ea75f2b35131 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2293 061b561058484cbda73eea08dffe43bf ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2294 6b1f7ea22e2543aa9849e34097d05570 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2297 2829cb17770c4dd5828f3513ea9181e0 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2305 437df2865e0f4147853a98d883d93c13 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2310 8179a6db6b3744f197ad1ae0663e6da4 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "2311 4196d87246444a088d23832e66732930 ArcGISPyAPIBot JEwYeAy2cc8qOe3o \n", + "\n", + " created isOrgItem modified guid name \\\n", + "1147 1685983591000 True 1685983595000 None None \n", + "1160 1607547954000 True 1612904683000 None None \n", + "1345 1754003328000 True 1754003328000 None None \n", + "1410 1654023844000 True 1654023844000 None None \n", + "1411 1656553353000 True 1656553353000 None None \n", + "1412 1656553356000 True 1656553356000 None None \n", + "1413 1656553355000 True 1656553355000 None None \n", + "1414 1654023846000 True 1654023846000 None None \n", + "1415 1654023843000 True 1654023843000 None None \n", + "1462 1684115932000 True 1684115935000 None None \n", + "1463 1601408274000 True 1684115692000 None None \n", + "1465 1709422836000 True 1709423741000 None None \n", + "1481 1743008654000 True 1743008654000 None None \n", + "1483 1723827682000 True 1723828093000 None None \n", + "1490 1573859849000 True 1573859860000 None None \n", + "1997 1692895691000 True 1693252353000 None None \n", + "2263 1737475928000 True 1737475928000 None None \n", + "2265 1737475927000 True 1737475928000 None None \n", + "2266 1737475994000 True 1737475995000 None None \n", + "2268 1737475994000 True 1737475995000 None None \n", + "2269 1737477965000 True 1737477965000 None None \n", + "2271 1737477963000 True 1737477964000 None None \n", + "2272 1737478026000 True 1737478027000 None None \n", + "2273 1737478025000 True 1737478026000 None None \n", + "2275 1737478122000 True 1737478123000 None None \n", + "2276 1737478121000 True 1737478122000 None None \n", + "2277 1737475866000 True 1737475866000 None None \n", + "2279 1737475865000 True 1737475866000 None None \n", + "2281 1750803035000 True 1750803104000 None None \n", + "2282 1750803035000 True 1750803103000 None None \n", + "2283 1750803363000 True 1750803417000 None None \n", + "2285 1750803362000 True 1750803416000 None None \n", + "2286 1750802975000 True 1750802976000 None None \n", + "2288 1750802975000 True 1750802976000 None None \n", + "2293 1698259114000 True 1698259116000 None None \n", + "2294 1708463115000 True 1708463115000 None None \n", + "2297 1723840528000 True 1738787019000 None None \n", + "2305 1582579501000 True 1582590674000 None None \n", + "2310 1750865389000 True 1750865429000 None None \n", + "2311 1750865388000 True 1750865428000 None None \n", + "\n", + " title type ... \\\n", + "1147 Case 02773785 220 Mbs Web Map ... \n", + "1160 Chicago_Libraries_High_Checkout Web Map ... \n", + "1345 dnk_map Web Map ... \n", + "1410 erase_me_map Web Map ... \n", + "1411 erase_me_map Web Map ... \n", + "1412 erase_me_map Web Map ... \n", + "1413 erase_me_map Web Map ... \n", + "1414 erase_me_map Web Map ... \n", + "1415 erase_me_map Web Map ... \n", + "1462 Giraffes Web Map ... \n", + "1463 Giraffes Original Web Map ... \n", + "1465 HIFLD Hospital Locations Web Map ... \n", + "1481 KG_Quick_Capture Web Map ... \n", + "1483 Leaf Pickup Popup Test Web Map ... \n", + "1490 mult_lyr_webmap Web Map ... \n", + "1997 set1_cities_webmap Web Map ... \n", + "2263 Time stamp: 2025_1_21_17_11_37 Web Map ... \n", + "2265 Time stamp: 2025_1_21_17_11_37 Dispatcher Map Web Map ... \n", + "2266 Time stamp: 2025_1_21_17_12_38 Web Map ... \n", + "2268 Time stamp: 2025_1_21_17_12_38 Dispatcher Map Web Map ... \n", + "2269 Time stamp: 2025_1_21_17_45_24 Web Map ... \n", + "2271 Time stamp: 2025_1_21_17_45_24 Dispatcher Map Web Map ... \n", + "2272 Time stamp: 2025_1_21_17_46_37 Web Map ... \n", + "2273 Time stamp: 2025_1_21_17_46_37 Dispatcher Map Web Map ... \n", + "2275 Time stamp: 2025_1_21_17_48_10 Web Map ... \n", + "2276 Time stamp: 2025_1_21_17_48_10 Dispatcher Map Web Map ... \n", + "2277 Time stamp: 2025_1_21_17_9_45 Web Map ... \n", + "2279 Time stamp: 2025_1_21_17_9_45 Dispatcher Map Web Map ... \n", + "2281 Time stamp: 2025_6_24_15_10_11 Web Map ... \n", + "2282 Time stamp: 2025_6_24_15_10_11 Dispatcher Map Web Map ... \n", + "2283 Time stamp: 2025_6_24_15_15_39 Web Map ... \n", + "2285 Time stamp: 2025_6_24_15_15_39 Dispatcher Map Web Map ... \n", + "2286 Time stamp: 2025_6_24_15_9_10 Web Map ... \n", + "2288 Time stamp: 2025_6_24_15_9_10 Dispatcher Map Web Map ... \n", + "2293 UC Location Web Map ... \n", + "2294 US Power Plant Data Web Map ... \n", + "2297 USA time zones and traffic counts WebMap Web Map ... \n", + "2305 Vietnam for Testing Web Map ... \n", + "2310 Workforce-Ntgrtn-tst: 2025_6_25_11_29_25 Web Map ... \n", + "2311 Workforce-Ntgrtn-tst: 2025_6_25_11_29_25 Dispa... Web Map ... \n", + "\n", + " apiToken1ExpirationDate apiToken2ExpirationDate contentOrigin \\\n", + "1147 -1 -1 self \n", + "1160 -1 -1 self \n", + "1345 -1 -1 self \n", + "1410 -1 -1 self \n", + "1411 -1 -1 self \n", + "1412 -1 -1 self \n", + "1413 -1 -1 self \n", + "1414 -1 -1 self \n", + "1415 -1 -1 self \n", + "1462 -1 -1 self \n", + "1463 -1 -1 self \n", + "1465 -1 -1 self \n", + "1481 -1 -1 self \n", + "1483 -1 -1 self \n", + "1490 -1 -1 self \n", + "1997 -1 -1 self \n", + "2263 -1 -1 self \n", + "2265 -1 -1 self \n", + "2266 -1 -1 self \n", + "2268 -1 -1 self \n", + "2269 -1 -1 self \n", + "2271 -1 -1 self \n", + "2272 -1 -1 self \n", + "2273 -1 -1 self \n", + "2275 -1 -1 self \n", + "2276 -1 -1 self \n", + "2277 -1 -1 self \n", + "2279 -1 -1 self \n", + "2281 -1 -1 self \n", + "2282 -1 -1 self \n", + "2283 -1 -1 self \n", + "2285 -1 -1 self \n", + "2286 -1 -1 self \n", + "2288 -1 -1 self \n", + "2293 -1 -1 self \n", + "2294 -1 -1 self \n", + "2297 -1 -1 self \n", + "2305 -1 -1 self \n", + "2310 -1 -1 self \n", + "2311 -1 -1 self \n", + "\n", + " lastViewed size commentsEnabled itemControl layers tables \\\n", + "1147 1750683600000 NaN NaN NaN NaN NaN \n", + "1160 1750683600000 NaN NaN NaN NaN NaN \n", + "1345 1756936800000 NaN NaN NaN NaN NaN \n", + "1410 1744761600000 NaN NaN NaN NaN NaN \n", + "1411 1744761600000 NaN NaN NaN NaN NaN \n", + "1412 1728936000000 NaN NaN NaN NaN NaN \n", + "1413 1728936000000 NaN NaN NaN NaN NaN \n", + "1414 1728936000000 NaN NaN NaN NaN NaN \n", + "1415 1728936000000 NaN NaN NaN NaN NaN \n", + "1462 1728936000000 NaN NaN NaN NaN NaN \n", + "1463 1754067600000 NaN NaN NaN NaN NaN \n", + "1465 1753286400000 NaN NaN NaN NaN NaN \n", + "1481 1744858800000 NaN NaN NaN NaN NaN \n", + "1483 1728936000000 NaN NaN NaN NaN NaN \n", + "1490 1744761600000 NaN NaN NaN NaN NaN \n", + "1997 1728936000000 NaN NaN NaN NaN NaN \n", + "2263 1753286400000 NaN NaN NaN NaN NaN \n", + "2265 1744761600000 NaN NaN NaN NaN NaN \n", + "2266 1750683600000 NaN NaN NaN NaN NaN \n", + "2268 -1 NaN NaN NaN NaN NaN \n", + "2269 1750683600000 NaN NaN NaN NaN NaN \n", + "2271 1750683600000 NaN NaN NaN NaN NaN \n", + "2272 1744761600000 NaN NaN NaN NaN NaN \n", + "2273 -1 NaN NaN NaN NaN NaN \n", + "2275 1744761600000 NaN NaN NaN NaN NaN \n", + "2276 -1 NaN NaN NaN NaN NaN \n", + "2277 1744761600000 NaN NaN NaN NaN NaN \n", + "2279 1744761600000 NaN NaN NaN NaN NaN \n", + "2281 1753286400000 NaN NaN NaN NaN NaN \n", + "2282 1750802400000 NaN NaN NaN NaN NaN \n", + "2283 1750802400000 NaN NaN NaN NaN NaN \n", + "2285 1750802400000 NaN NaN NaN NaN NaN \n", + "2286 -1 NaN NaN NaN NaN NaN \n", + "2288 -1 NaN NaN NaN NaN NaN \n", + "2293 1744761600000 NaN NaN NaN NaN NaN \n", + "2294 1752264000000 NaN NaN NaN NaN NaN \n", + "2297 1741903200000 NaN NaN NaN NaN NaN \n", + "2305 1754002800000 NaN NaN NaN NaN NaN \n", + "2310 1753286400000 NaN NaN NaN NaN NaN \n", + "2311 1750863600000 NaN NaN NaN NaN NaN \n", + "\n", + " contentStatus \n", + "1147 NaN \n", + "1160 NaN \n", + "1345 NaN \n", + "1410 NaN \n", + "1411 NaN \n", + "1412 NaN \n", + "1413 NaN \n", + "1414 NaN \n", + "1415 NaN \n", + "1462 NaN \n", + "1463 NaN \n", + "1465 NaN \n", + "1481 NaN \n", + "1483 NaN \n", + "1490 NaN \n", + "1997 NaN \n", + "2263 NaN \n", + "2265 NaN \n", + "2266 NaN \n", + "2268 NaN \n", + "2269 NaN \n", + "2271 NaN \n", + "2272 NaN \n", + "2273 NaN \n", + "2275 NaN \n", + "2276 NaN \n", + "2277 NaN \n", + "2279 NaN \n", + "2281 NaN \n", + "2282 NaN \n", + "2283 NaN \n", + "2285 NaN \n", + "2286 NaN \n", + "2288 NaN \n", + "2293 NaN \n", + "2294 NaN \n", + "2297 NaN \n", + "2305 NaN \n", + "2310 NaN \n", + "2311 NaN \n", + "\n", + "[40 rows x 54 columns]" ] }, - "execution_count": 13, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wm_item_df = owner_items_df.groupby(\"type\").get_group(\"Web Map\")\n", + "wm_item_df" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The resulting DataFrame's index uses the position value of each web map in the original dataframe for the row index, so we'll reset it to a zero-based index:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index([1147, 1160, 1345, 1410, 1411, 1412, 1413, 1414, 1415, 1462, 1463, 1465,\n", + " 1481, 1483, 1490, 1997, 2263, 2265, 2266, 2268, 2269, 2271, 2272, 2273,\n", + " 2275, 2276, 2277, 2279, 2281, 2282, 2283, 2285, 2286, 2288, 2293, 2294,\n", + " 2297, 2305, 2310, 2311],\n", + " dtype='int64')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wm_item_df.index" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "web_maps = wm_item_df.reset_index(drop=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "RangeIndex(start=0, stop=40, step=1)" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "web_maps.index" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's retrieve a web map using a tag search so we can clone it into our target:" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "def check_wm(tag_list):\n", + " return \"power_plants\" in tag_list" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "power_plant_df = web_maps[web_maps.tags.apply(check_wm)]" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index([35], dtype='int64')" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "power_plant_df.index" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'6b1f7ea22e2543aa9849e34097d05570'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "power_plant_df.loc[35].id" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n",
" \n",
"