From 566ffa0cc29316e3b0f74c75e4eed848a10a33ab Mon Sep 17 00:00:00 2001 From: LiLeon Date: Fri, 2 Dec 2022 22:27:30 -0600 Subject: [PATCH] Data_Extraction_Project --- Data_Extraction_Output.zip | Bin 0 -> 10456 bytes Project2_API.ipynb | 834 +++++++++++++++++++++++++++++++++++++ README_data_extraction.md | 9 + 3 files changed, 843 insertions(+) create mode 100644 Data_Extraction_Output.zip create mode 100644 Project2_API.ipynb create mode 100644 README_data_extraction.md diff --git a/Data_Extraction_Output.zip b/Data_Extraction_Output.zip new file mode 100644 index 0000000000000000000000000000000000000000..4f440957bec4479539dee4ce78b3e62c06a69a17 GIT binary patch literal 10456 zcmZ{qV{j%wx2=;*>`ZKXV%xTD+t$SP#I~J@-`KWoJ9*=r`R=JYb?c(Ls=IdgUe$lQ zp0yNZet@HafPg@QfJX(XY5TXG#{DZlF+f0&{+&8HJ6M~UxH8iT(R1M7sH$Eq zk0c_N2z7KqL827Pbnu84i=WMc8VQEQ36VjZrP5Oym7^33bwKd5tv!?xhOX=Oe!iU*wfErwj8kzo$P3xoi%2fn;osqOQ&t?@LX&6 z)WUvgTl3O}_2l76A%C=TgGHgmugIqLJvim|UsQ&bw{``7goEwL`8{KJ zI3X&m>}5Wyw|17v2=VmJ6L~vhtOig-O2T{g)U&=ME2J3kez&{Rg8(zwpxuW-qaqpG zvIU9lIH$q}#sR$WJL$iR)%Ny7AMTK@}ZIBG}Wjk}t*i^Q&S2PVx9aMM{Otxutw-jOYKGRSdbMBfCrG8E}ypiS; zDb6xx`OzpH3~$R%KO!oDW?kKWias9^J{sd!j9=D8X1`w#GOn0%rwIvW?-s0g+Pdcj zB}7Qua%*@mvw0yP{A10Wepq9H>}ya_MR~dzLEMihygM+g6sZ{1!> zNzVoj^l1qCM$u-kcatBHI0Rn!7%JxH7%5I4objxY@JxYHxC8=bpUFjc?YL{FgT&i1 zCME0ji^Jgy(ek!1io{C1l#SU%oY|7tOdS?Y;xBxnz&|A?7qcV|1SXnI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ojzCrjQSg|8III`Z_W zC7Yl#Jx`xq^%1}`<_2rIm>fOVs|>ntvn#E-2?pLdK11*A-34MHb`IX(t|#}-DI!NH?PP( zmMg?wcl<&-X*{Agc4!bSztzsS*}8QKKH2plzFYwA8hiHtSR81GQyG7|jW>tXr=4}s zQ#|#BUSOxht^=r4R{$sSP3F$lWzSUd-M7z$O=Tfy0AQ%&legzn_^!wQz6V561{4ep zObPne=qz`DDl6^o}vr{" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response = requests.get('https://collectionapi.metmuseum.org/public/collection/v1/departments')\n", + "response" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a9f766ea-1ff9-449f-b76d-8e0205a6e279", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "b'{\"departments\":[{\"departmentId\":1,\"displayName\":\"American Decorative Arts\"},{\"departmentId\":3,\"displayName\":\"Ancient Near Eastern Art\"},{\"departmentId\":4,\"displayName\":\"Arms and Armor\"},{\"departmentId\":5,\"displayName\":\"Arts of Africa, Oceania, and the Americas\"},{\"departmentId\":6,\"displayName\":\"Asian Art\"},{\"departmentId\":7,\"displayName\":\"The Cloisters\"},{\"departmentId\":8,\"displayName\":\"The Costume Institute\"},{\"departmentId\":9,\"displayName\":\"Drawings and Prints\"},{\"departmentId\":10,\"displayName\":\"Egyptian Art\"},{\"departmentId\":11,\"displayName\":\"European Paintings\"},{\"departmentId\":12,\"displayName\":\"European Sculpture and Decorative Arts\"},{\"departmentId\":13,\"displayName\":\"Greek and Roman Art\"},{\"departmentId\":14,\"displayName\":\"Islamic Art\"},{\"departmentId\":15,\"displayName\":\"The Robert Lehman Collection\"},{\"departmentId\":16,\"displayName\":\"The Libraries\"},{\"departmentId\":17,\"displayName\":\"Medieval Art\"},{\"departmentId\":18,\"displayName\":\"Musical Instruments\"},{\"departmentId\":19,\"displayName\":\"Photographs\"},{\"departmentId\":21,\"displayName\":\"Modern Art\"}]}'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.content" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "60377405-ca48-4259-ba0b-3495d5723c83", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'departments': [{'departmentId': 1,\n", + " 'displayName': 'American Decorative Arts'},\n", + " {'departmentId': 3, 'displayName': 'Ancient Near Eastern Art'},\n", + " {'departmentId': 4, 'displayName': 'Arms and Armor'},\n", + " {'departmentId': 5,\n", + " 'displayName': 'Arts of Africa, Oceania, and the Americas'},\n", + " {'departmentId': 6, 'displayName': 'Asian Art'},\n", + " {'departmentId': 7, 'displayName': 'The Cloisters'},\n", + " {'departmentId': 8, 'displayName': 'The Costume Institute'},\n", + " {'departmentId': 9, 'displayName': 'Drawings and Prints'},\n", + " {'departmentId': 10, 'displayName': 'Egyptian Art'},\n", + " {'departmentId': 11, 'displayName': 'European Paintings'},\n", + " {'departmentId': 12,\n", + " 'displayName': 'European Sculpture and Decorative Arts'},\n", + " {'departmentId': 13, 'displayName': 'Greek and Roman Art'},\n", + " {'departmentId': 14, 'displayName': 'Islamic Art'},\n", + " {'departmentId': 15, 'displayName': 'The Robert Lehman Collection'},\n", + " {'departmentId': 16, 'displayName': 'The Libraries'},\n", + " {'departmentId': 17, 'displayName': 'Medieval Art'},\n", + " {'departmentId': 18, 'displayName': 'Musical Instruments'},\n", + " {'departmentId': 19, 'displayName': 'Photographs'},\n", + " {'departmentId': 21, 'displayName': 'Modern Art'}]}" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_departments = response.json()\n", + "json_departments" + ] + }, + { + "cell_type": "code", + "execution_count": 249, + "id": "a19214e6-7626-43a9-b9dd-e8f6bae72f2d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'departmentId': 1, 'displayName': 'American Decorative Arts'},\n", + " {'departmentId': 3, 'displayName': 'Ancient Near Eastern Art'},\n", + " {'departmentId': 4, 'displayName': 'Arms and Armor'},\n", + " {'departmentId': 5,\n", + " 'displayName': 'Arts of Africa, Oceania, and the Americas'},\n", + " {'departmentId': 6, 'displayName': 'Asian Art'},\n", + " {'departmentId': 7, 'displayName': 'The Cloisters'},\n", + " {'departmentId': 8, 'displayName': 'The Costume Institute'},\n", + " {'departmentId': 9, 'displayName': 'Drawings and Prints'},\n", + " {'departmentId': 10, 'displayName': 'Egyptian Art'},\n", + " {'departmentId': 11, 'displayName': 'European Paintings'},\n", + " {'departmentId': 12, 'displayName': 'European Sculpture and Decorative Arts'},\n", + " {'departmentId': 13, 'displayName': 'Greek and Roman Art'},\n", + " {'departmentId': 14, 'displayName': 'Islamic Art'},\n", + " {'departmentId': 15, 'displayName': 'The Robert Lehman Collection'},\n", + " {'departmentId': 16, 'displayName': 'The Libraries'},\n", + " {'departmentId': 17, 'displayName': 'Medieval Art'},\n", + " {'departmentId': 18, 'displayName': 'Musical Instruments'},\n", + " {'departmentId': 19, 'displayName': 'Photographs'},\n", + " {'departmentId': 21, 'displayName': 'Modern Art'}]" + ] + }, + "execution_count": 249, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "departments = json_departments.get('departments')\n", + "departments" + ] + }, + { + "cell_type": "code", + "execution_count": 250, + "id": "545580bd-2a10-4459-8fca-a05d66532d80", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 250, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(departments)" + ] + }, + { + "cell_type": "code", + "execution_count": 254, + "id": "fcf69dc2-6cdf-4c2e-b06f-1f46949c2bdf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1,\n", + " 'American Decorative Arts',\n", + " 3,\n", + " 'Ancient Near Eastern Art',\n", + " 4,\n", + " 'Arms and Armor',\n", + " 5,\n", + " 'Arts of Africa, Oceania, and the Americas',\n", + " 6,\n", + " 'Asian Art',\n", + " 7,\n", + " 'The Cloisters',\n", + " 8,\n", + " 'The Costume Institute',\n", + " 9,\n", + " 'Drawings and Prints',\n", + " 10,\n", + " 'Egyptian Art',\n", + " 11,\n", + " 'European Paintings',\n", + " 12,\n", + " 'European Sculpture and Decorative Arts',\n", + " 13,\n", + " 'Greek and Roman Art',\n", + " 14,\n", + " 'Islamic Art',\n", + " 15,\n", + " 'The Robert Lehman Collection',\n", + " 16,\n", + " 'The Libraries',\n", + " 17,\n", + " 'Medieval Art',\n", + " 18,\n", + " 'Musical Instruments',\n", + " 19,\n", + " 'Photographs',\n", + " 21,\n", + " 'Modern Art']" + ] + }, + "execution_count": 254, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "departments_list = [value for book in json_departments['departments'] for value in book.values()]\n", + "departments_list" + ] + }, + { + "cell_type": "code", + "execution_count": 255, + "id": "1a385117-99ae-4132-bd3d-d551b9cfabfc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 255, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(departments_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 275, + "id": "a92e3dd8-ecb3-4cbf-a2c4-b52d2d167813", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21]" + ] + }, + "execution_count": 275, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "department_num = [num for num in departments_list if isinstance(num, (int,float))]\n", + "department_num" + ] + }, + { + "cell_type": "code", + "execution_count": 276, + "id": "be4ca82a-4537-4e86-a009-68993bf5f778", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['American Decorative Arts',\n", + " 'Ancient Near Eastern Art',\n", + " 'Arms and Armor',\n", + " 'Arts of Africa, Oceania, and the Americas',\n", + " 'Asian Art',\n", + " 'The Cloisters',\n", + " 'The Costume Institute',\n", + " 'Drawings and Prints',\n", + " 'Egyptian Art',\n", + " 'European Paintings',\n", + " 'European Sculpture and Decorative Arts',\n", + " 'Greek and Roman Art',\n", + " 'Islamic Art',\n", + " 'The Robert Lehman Collection',\n", + " 'The Libraries',\n", + " 'Medieval Art',\n", + " 'Musical Instruments',\n", + " 'Photographs',\n", + " 'Modern Art']" + ] + }, + "execution_count": 276, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "department_name = list(filter(lambda x: x not in index, departments_list))\n", + "department_name" + ] + }, + { + "cell_type": "code", + "execution_count": 328, + "id": "7b14e46d-8b8b-4eea-a620-e49b506574d1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Department
1American Decorative Arts
3Ancient Near Eastern Art
4Arms and Armor
5Arts of Africa, Oceania, and the Americas
6Asian Art
7The Cloisters
8The Costume Institute
9Drawings and Prints
10Egyptian Art
11European Paintings
12European Sculpture and Decorative Arts
13Greek and Roman Art
14Islamic Art
15The Robert Lehman Collection
16The Libraries
17Medieval Art
18Musical Instruments
19Photographs
21Modern Art
\n", + "
" + ], + "text/plain": [ + " Department\n", + "1 American Decorative Arts\n", + "3 Ancient Near Eastern Art\n", + "4 Arms and Armor\n", + "5 Arts of Africa, Oceania, and the Americas\n", + "6 Asian Art\n", + "7 The Cloisters\n", + "8 The Costume Institute\n", + "9 Drawings and Prints\n", + "10 Egyptian Art\n", + "11 European Paintings\n", + "12 European Sculpture and Decorative Arts\n", + "13 Greek and Roman Art\n", + "14 Islamic Art\n", + "15 The Robert Lehman Collection\n", + "16 The Libraries\n", + "17 Medieval Art\n", + "18 Musical Instruments\n", + "19 Photographs\n", + "21 Modern Art" + ] + }, + "execution_count": 328, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "departments_df= pd.DataFrame(department_name,department_num )\n", + "departments_df.columns = ['Department']\n", + "departments_df" + ] + }, + { + "cell_type": "code", + "execution_count": 335, + "id": "fa887750-c036-4264-ba96-44b0bb23d687", + "metadata": {}, + "outputs": [], + "source": [ + "departments_df.to_excel('project2-A.xlsx')" + ] + }, + { + "cell_type": "code", + "execution_count": 329, + "id": "81d0bea9-380a-4105-b872-5decc10055c6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 329, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#https://collectionapi.metmuseum.org/public/collection/v1/objects?departmentIds=3|9|12\n", + "objects_response = requests.get('https://collectionapi.metmuseum.org/public/collection/v1/objects?departmentIds=11')\n", + "objects_response" + ] + }, + { + "cell_type": "code", + "execution_count": 330, + "id": "4e3b8f8b-7035-496f-9806-82de782ed7a4", + "metadata": {}, + "outputs": [], + "source": [ + "objects_jason = objects_response.json()\n" + ] + }, + { + "cell_type": "code", + "execution_count": 331, + "id": "1e599564-5de5-4d01-8a0c-876eea885ec3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[435657,\n", + " 435658,\n", + " 435659,\n", + " 435660,\n", + " 435661,\n", + " 435662,\n", + " 435663,\n", + " 435664,\n", + " 435665,\n", + " 435666,\n", + " 435668,\n", + " 435669,\n", + " 435670,\n", + " 435671,\n", + " 435672]" + ] + }, + "execution_count": 331, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "objects_list = objects_jason.get('objectIDs')\n", + "objects_list[:15]" + ] + }, + { + "cell_type": "code", + "execution_count": 339, + "id": "15893592-0e20-46cf-b21f-c086a0b7a2ed", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2619" + ] + }, + "execution_count": 339, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "objects_response_dep = len(objects_list)\n", + "objects_response_dep" + ] + }, + { + "cell_type": "code", + "execution_count": 363, + "id": "898793a9-6fb6-4306-947c-03128aa8fa5d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Content-Type': 'application/json; charset=UTF-8', 'Vary': 'Origin', 'Access-Control-Allow-Origin': '*', 'X-Powered-By': 'ARR/3.0', 'Date': 'Sat, 03 Dec 2022 00:36:35 GMT', 'Set-Cookie': 'visid_incap_1662004=Qb1BHM8bTMSFWFIv9Ro2AOSZimMAAAAAQUIPAAAAAAAyZEGvIlKMgcLwfKGtGylh; expires=Sat, 02 Dec 2023 07:27:10 GMT; HttpOnly; path=/; Domain=.metmuseum.org, incap_ses_1059_1662004=b3Y4OJnimAVTJyTqD1OyDhSaimMAAAAAn5hQaFvoxtIiiEgBamf3hw==; path=/; Domain=.metmuseum.org', 'X-CDN': 'Imperva', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'X-Iinfo': '7-83399806-83399808 NNYY CT(63 134 0) RT(1670027795286 16) q(0 0 0 0) r(7 7) U12'}" + ] + }, + "execution_count": 363, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import time\n", + "object_response = requests.get('https://collectionapi.metmuseum.org/public/collection/v1/objects/437133')\n", + "h_object_response = object_response.headers\n", + "h_object_response" + ] + }, + { + "cell_type": "code", + "execution_count": 313, + "id": "f771df7a-9f8c-4217-8f35-a47d4d4bda6f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'objectID': 437133,\n", + " 'isHighlight': True,\n", + " 'accessionNumber': '67.241',\n", + " 'accessionYear': '1967',\n", + " 'isPublicDomain': False,\n", + " 'primaryImage': '',\n", + " 'primaryImageSmall': '',\n", + " 'additionalImages': [],\n", + " 'constituents': [{'constituentID': 162135,\n", + " 'role': 'Artist',\n", + " 'name': 'Claude Monet',\n", + " 'constituentULAN_URL': 'http://vocab.getty.edu/page/ulan/500019484',\n", + " 'constituentWikidata_URL': 'https://www.wikidata.org/wiki/Q296',\n", + " 'gender': ''}],\n", + " 'department': 'European Paintings',\n", + " 'objectName': 'Painting',\n", + " 'title': 'Garden at Sainte-Adresse',\n", + " 'culture': '',\n", + " 'period': '',\n", + " 'dynasty': '',\n", + " 'reign': '',\n", + " 'portfolio': '',\n", + " 'artistRole': 'Artist',\n", + " 'artistPrefix': '',\n", + " 'artistDisplayName': 'Claude Monet',\n", + " 'artistDisplayBio': 'French, Paris 1840–1926 Giverny',\n", + " 'artistSuffix': '',\n", + " 'artistAlphaSort': 'Monet, Claude',\n", + " 'artistNationality': 'French',\n", + " 'artistBeginDate': '1840',\n", + " 'artistEndDate': '1926',\n", + " 'artistGender': '',\n", + " 'artistWikidata_URL': 'https://www.wikidata.org/wiki/Q296',\n", + " 'artistULAN_URL': 'http://vocab.getty.edu/page/ulan/500019484',\n", + " 'objectDate': '1867',\n", + " 'objectBeginDate': 1867,\n", + " 'objectEndDate': 1867,\n", + " 'medium': 'Oil on canvas',\n", + " 'dimensions': '38 5/8 x 51 1/8 in. (98.1 x 129.9 cm)',\n", + " 'measurements': [{'elementName': 'Overall',\n", + " 'elementDescription': None,\n", + " 'elementMeasurements': {'Height': 98.1, 'Width': 129.9}},\n", + " {'elementName': 'Frame',\n", + " 'elementDescription': None,\n", + " 'elementMeasurements': {'Depth': 12.7,\n", + " 'Height': 133.3503,\n", + " 'Width': 166.3703}}],\n", + " 'creditLine': 'Purchase, special contributions and funds given or bequeathed by friends of the Museum, 1967',\n", + " 'geographyType': '',\n", + " 'city': '',\n", + " 'state': '',\n", + " 'county': '',\n", + " 'country': '',\n", + " 'region': '',\n", + " 'subregion': '',\n", + " 'locale': '',\n", + " 'locus': '',\n", + " 'excavation': '',\n", + " 'river': '',\n", + " 'classification': 'Paintings',\n", + " 'rightsAndReproduction': '',\n", + " 'linkResource': '',\n", + " 'metadataDate': '2022-11-30T04:47:42.047Z',\n", + " 'repository': 'Metropolitan Museum of Art, New York, NY',\n", + " 'objectURL': 'https://www.metmuseum.org/art/collection/search/437133',\n", + " 'tags': [{'term': 'Gardens',\n", + " 'AAT_URL': 'http://vocab.getty.edu/page/aat/300008090',\n", + " 'Wikidata_URL': 'https://www.wikidata.org/wiki/Q1107656'},\n", + " {'term': 'Men',\n", + " 'AAT_URL': 'http://vocab.getty.edu/page/aat/300025928',\n", + " 'Wikidata_URL': 'https://www.wikidata.org/wiki/Q8441'},\n", + " {'term': 'Women',\n", + " 'AAT_URL': 'http://vocab.getty.edu/page/aat/300025943',\n", + " 'Wikidata_URL': 'https://www.wikidata.org/wiki/Q467'},\n", + " {'term': 'Seas',\n", + " 'AAT_URL': 'http://vocab.getty.edu/page/aat/300008694',\n", + " 'Wikidata_URL': 'https://www.wikidata.org/wiki/Q165'},\n", + " {'term': 'Boats',\n", + " 'AAT_URL': 'http://vocab.getty.edu/page/aat/300178749',\n", + " 'Wikidata_URL': 'https://www.wikidata.org/wiki/Q35872'}],\n", + " 'objectWikidata_URL': 'https://www.wikidata.org/wiki/Q432253',\n", + " 'isTimelineWork': True,\n", + " 'GalleryNumber': '818'}" + ] + }, + "execution_count": 313, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "object_details = object_response.json()\n", + "object_details" + ] + }, + { + "cell_type": "code", + "execution_count": 319, + "id": "4a7e3a72-8d06-4021-86a0-377276103fe1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Garden at Sainte-Adresse',\n", + " 'Claude Monet',\n", + " 'French, Paris 1840–1926 Giverny',\n", + " 'European Paintings']" + ] + }, + "execution_count": 319, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "keys ='title', 'artistDisplayName','artistDisplayBio','department'\n", + "values = list( map(object_details.get, keys) )\n", + "values\n", + "# values = ['bear', 'castle']" + ] + }, + { + "cell_type": "code", + "execution_count": 326, + "id": "e04810c6-fef7-4e7c-9975-ab90ddd2c4eb", + "metadata": {}, + "outputs": [], + "source": [ + "items = 'Title: ', 'Artist: ', 'Artist short bio:', 'Department: '" + ] + }, + { + "cell_type": "code", + "execution_count": 327, + "id": "409428a4-39ef-46df-829b-50bfc9e99672", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Materpiece info
Title:Garden at Sainte-Adresse
Artist:Claude Monet
Artist short bio:French, Paris 1840–1926 Giverny
Department:European Paintings
\n", + "
" + ], + "text/plain": [ + " Materpiece info\n", + "Title: Garden at Sainte-Adresse\n", + "Artist: Claude Monet\n", + "Artist short bio: French, Paris 1840–1926 Giverny\n", + "Department: European Paintings" + ] + }, + "execution_count": 327, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "object_df= pd.DataFrame(values, items)\n", + "object_df.columns = ['Materpiece info']\n", + "object_df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 336, + "id": "c70f97e0-3848-4aad-bf9b-cbec59159e66", + "metadata": {}, + "outputs": [], + "source": [ + "object_df.to_excel('project2-B.xlsx')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55bf7886-975d-4c4f-8658-56f5e6ff14c2", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/README_data_extraction.md b/README_data_extraction.md new file mode 100644 index 0000000..c25c7dd --- /dev/null +++ b/README_data_extraction.md @@ -0,0 +1,9 @@ +The Metropolitan Museum of Art Collection API + +Elegí la API del MET porque se me hizo interesante poder acceder a la información de todas las obras que tiene este museo que es enorme. + +La documentación de la API es corta y sin muchas restricciones asì que no tuve problema para enviar las solicitudes. + +El enfoque de la extracción es de lo general a lo partícular, por ejemplo, primero extraje los departamentos o salas en las que se divide el museo, después quise contar el número de objetos de cada sala para después buscar una obra en particular que pueda mostrar en 5 puntos la información más importante de la misma. + +El resultado fue interesante aunque considero que necesito practicar mas con pandas porque fue lo más difícil para mí, \ No newline at end of file