From 30e16254c835b4aa6b43da59b88388a161f8e9d4 Mon Sep 17 00:00:00 2001 From: herguejuan Date: Sat, 22 May 2021 05:01:00 -0500 Subject: [PATCH 1/3] Subiendo Proyecto 2 --- .ipynb_checkpoints/Untitled-checkpoint.ipynb | 6 + .ipynb_checkpoints/Untitled1-checkpoint.ipynb | 1063 +++++++++++ .ipynb_checkpoints/main-checkpoint.ipynb | 957 ++++++++++ Untitled.ipynb | 139 ++ Untitled1.ipynb | 1564 +++++++++++++++++ main.ipynb | 957 ++++++++++ 6 files changed, 4686 insertions(+) create mode 100644 .ipynb_checkpoints/Untitled-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/Untitled1-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/main-checkpoint.ipynb create mode 100644 Untitled.ipynb create mode 100644 Untitled1.ipynb create mode 100644 main.ipynb diff --git a/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/.ipynb_checkpoints/Untitled-checkpoint.ipynb new file mode 100644 index 0000000..7fec515 --- /dev/null +++ b/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/.ipynb_checkpoints/Untitled1-checkpoint.ipynb b/.ipynb_checkpoints/Untitled1-checkpoint.ipynb new file mode 100644 index 0000000..58e58ed --- /dev/null +++ b/.ipynb_checkpoints/Untitled1-checkpoint.ipynb @@ -0,0 +1,1063 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import pandas as pd\n", + "from pandas.io.json import json_normalize\n", + "from urllib.request import urlopen" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "url = 'https://www.zalando.fr/api/catalog/articles?categories=promo-homme&limit=84&offset=60'" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":9: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + } + ], + "source": [ + "df=pd.DataFrame()\n", + "\n", + "\n", + "url = 'https://pokeapi.co/api/v2/pokemon/1/'\n", + "response = requests.get(url)\n", + "results = response.json()\n", + " \n", + " \n", + "flattened_data = json_normalize(results)\n", + " #flattened_data1 = json_normalize(flattened_data.articles[0])\n", + " #flattened_data1=flattened_data1.set_index('sku')\n", + "df = df.append(flattened_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "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", + "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
0[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
\n", + "

1 rows × 115 columns

\n", + "
" + ], + "text/plain": [ + " abilities base_experience \\\n", + "0 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", + "\n", + " forms \\\n", + "0 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", + "\n", + " game_indices height held_items id \\\n", + "0 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", + "\n", + " is_default location_area_encounters \\\n", + "0 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", + "\n", + " moves ... \\\n", + "0 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny \\\n", + "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", + "0 None \n", + "\n", + " sprites.versions.generation-vii.icons.front_default \\\n", + "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_female \\\n", + "0 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", + "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", + "0 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", + "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", + "0 None \n", + "\n", + " sprites.versions.generation-viii.icons.front_default \\\n", + "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_female \n", + "0 None \n", + "\n", + "[1 rows x 115 columns]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'bulbasaur', 'url': 'https://pokeapi.co/api/v2/pokemon-form/1/'}\n" + ] + } + ], + "source": [ + "print(df['forms'][0][0])" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + } + ], + "source": [ + "df=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,11):\n", + " url = f'https://pokeapi.co/api/v2/pokemon/{i}/'\n", + " response = requests.get(url)\n", + " results = response.json()\n", + " \n", + " \n", + " flattened_data = json_normalize(results)\n", + " #flattened_data = flattened_data.set_index('id')\n", + " df = df.append(flattened_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [], + "source": [ + "df.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
\n", + "

3 rows × 115 columns

\n", + "
" + ], + "text/plain": [ + " abilities base_experience \\\n", + "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", + "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", + "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", + "\n", + " forms \\\n", + "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", + "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", + "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", + "\n", + " game_indices height held_items id \\\n", + "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", + "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", + "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", + "\n", + " is_default location_area_encounters \\\n", + "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", + "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", + "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", + "\n", + " moves ... \\\n", + "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", + "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_female \\\n", + "1 None \n", + "2 None \n", + "3 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_female \n", + "1 None \n", + "2 None \n", + "3 None \n", + "\n", + "[3 rows x 115 columns]" + ] + }, + "execution_count": 109, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [], + "source": [ + "nombres = [df['forms'][i][0]['name'] for i in range(1,11)]" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bulbasaur',\n", + " 'ivysaur',\n", + " 'venusaur',\n", + " 'charmander',\n", + " 'charmeleon',\n", + " 'charizard',\n", + " 'squirtle',\n", + " 'wartortle',\n", + " 'blastoise',\n", + " 'caterpie']" + ] + }, + "execution_count": 83, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nombres" + ] + }, + { + "cell_type": "code", + "execution_count": 143, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 143, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ids = [df['id'][i] for i in range(1,11)]\n", + "ids" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [], + "source": [ + "#df['game_indices'][1]" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['razor-wind',\n", + " 'swords-dance',\n", + " 'swords-dance',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'tackle']" + ] + }, + "execution_count": 115, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,11)]\n", + "attacks" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'}" + ] + }, + "execution_count": 118, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['moves'][1][0]['move']" + ] + }, + { + "cell_type": "code", + "execution_count": 129, + "metadata": {}, + "outputs": [], + "source": [ + "links_imagenes = [df['forms'][i][0]['url'] for i in range(1,11)]" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['https://pokeapi.co/api/v2/pokemon-form/1/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/2/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/3/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/4/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/5/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/6/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/7/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/8/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/9/',\n", + " 'https://pokeapi.co/api/v2/pokemon-form/10/']" + ] + }, + "execution_count": 130, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links_imagenes" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data2 = json_normalize(results)\n" + ] + } + ], + "source": [ + "df2=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,11):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " results = response.json()\n", + " \n", + " \n", + " flattened_data2 = json_normalize(results)\n", + " \n", + " df2 = df2.append(flattened_data2)" + ] + }, + { + "cell_type": "code", + "execution_count": 135, + "metadata": {}, + "outputs": [], + "source": [ + "df2.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 136, + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
form_nameform_namesform_orderidis_battle_onlyis_defaultis_meganamenamesorder...sprites.back_defaultsprites.back_femalesprites.back_shinysprites.back_shiny_femalesprites.front_defaultsprites.front_femalesprites.front_shinysprites.front_shiny_femaleversion_group.nameversion_group.url
1[]11FalseTrueFalsebulbasaur[]1...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
2[]12FalseTrueFalseivysaur[]2...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
3[]13FalseTrueFalsevenusaur[]3...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...red-bluehttps://pokeapi.co/api/v2/version-group/1/
\n", + "

3 rows × 23 columns

\n", + "
" + ], + "text/plain": [ + " form_name form_names form_order id is_battle_only is_default is_mega \\\n", + "1 [] 1 1 False True False \n", + "2 [] 1 2 False True False \n", + "3 [] 1 3 False True False \n", + "\n", + " name names order ... \\\n", + "1 bulbasaur [] 1 ... \n", + "2 ivysaur [] 2 ... \n", + "3 venusaur [] 3 ... \n", + "\n", + " sprites.back_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_shiny_female version_group.name \\\n", + "1 None red-blue \n", + "2 None red-blue \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... red-blue \n", + "\n", + " version_group.url \n", + "1 https://pokeapi.co/api/v2/version-group/1/ \n", + "2 https://pokeapi.co/api/v2/version-group/1/ \n", + "3 https://pokeapi.co/api/v2/version-group/1/ \n", + "\n", + "[3 rows x 23 columns]" + ] + }, + "execution_count": 136, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df2.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 139, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/2.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/3.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/4.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/5.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/6.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/7.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/8.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/9.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png']" + ] + }, + "execution_count": 139, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links_pictures = [df2['sprites.back_default'][i] for i in range(1,11)]\n", + "links_pictures" + ] + }, + { + "cell_type": "code", + "execution_count": 146, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'ability': {'name': 'overgrow',\n", + " 'url': 'https://pokeapi.co/api/v2/ability/65/'},\n", + " 'is_hidden': False,\n", + " 'slot': 1}" + ] + }, + "execution_count": 146, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['abilities'][1][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 149, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'move': {'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'},\n", + " 'version_group_details': [{'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'egg',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/2/'},\n", + " 'version_group': {'name': 'gold-silver',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/3/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'egg',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/2/'},\n", + " 'version_group': {'name': 'crystal',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/4/'}}]}" + ] + }, + "execution_count": 149, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['moves'][1][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'move': {'name': 'swords-dance', 'url': 'https://pokeapi.co/api/v2/move/14/'},\n", + " 'version_group_details': [{'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'red-blue',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/1/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'yellow',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/2/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'tutor',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", + " 'version_group': {'name': 'emerald',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/6/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'tutor',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", + " 'version_group': {'name': 'firered-leafgreen',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/7/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'diamond-pearl',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/8/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'platinum',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/9/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'heartgold-soulsilver',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/10/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'black-white',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/11/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'black-2-white-2',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/14/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'x-y',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/15/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'omega-ruby-alpha-sapphire',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/16/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'sun-moon',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/17/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'ultra-sun-ultra-moon',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/18/'}}]}" + ] + }, + "execution_count": 150, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['moves'][1][1]" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/.ipynb_checkpoints/main-checkpoint.ipynb b/.ipynb_checkpoints/main-checkpoint.ipynb new file mode 100644 index 0000000..5b9638f --- /dev/null +++ b/.ipynb_checkpoints/main-checkpoint.ipynb @@ -0,0 +1,957 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import numpy as np\n", + "import pandas as pd\n", + "from pandas.io.json import json_normalize\n", + "from urllib.request import urlopen" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Datos Generales pokemon\n", + "\n", + "df=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " df = df.append(flattened_data)\n", + " \n", + " else:\n", + " print('connection error')\n", + " break\n", + "print('Connecion Successful')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "df.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "ids = [df['id'][i] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "names = [df['forms'][i][0]['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "links_pictures = [df['sprites.versions.generation-vi.x-y.front_shiny'][i] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":12: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Para obtener el tipo de pokemon\n", + "\n", + "df2=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " df2 = df2.append(flattened_data)\n", + " else:\n", + " print('connection error')\n", + " break\n", + "\n", + "print('Connecion Successful')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [], + "source": [ + "df2.index = np.arange(1,len(df2)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [], + "source": [ + "types = [df2['types'][i][0]['type']['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":11: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Para obtener las fotos de pokemons por la parte de atrás\n", + "\n", + "df3=pd.DataFrame()\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " flattened_data = flattened_data.set_index('id')\n", + " df3 = df3.append(flattened_data)\n", + " \n", + " else:\n", + " print('connection error')\n", + " break\n", + "print('Connecion Successful')" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [], + "source": [ + "df3.index = np.arange(1,len(df3)+1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [], + "source": [ + "links_pictures_back = [df3['sprites.back_default'][i] for i in range(1,151)]\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [], + "source": [ + "nom_columns = ['Id','Pokemon','Type','Hard Attack','Picture','Back _Picture']" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [], + "source": [ + "df_pokemon = pd.DataFrame(list(zip(ids, names, types, attacks, links_pictures, links_pictures_back )), columns = nom_columns)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [], + "source": [ + "df_pokemon = df_pokemon.set_index('Id')" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/25.png'" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon['Picture'][25]" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/25.png'" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon['Back _Picture'][25]" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "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", + " \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", + " \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", + " \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", + " \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", + "
PokemonTypeHard AttackPictureBack _Picture
Id
1bulbasaurgrassrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
2ivysaurgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
3venusaurgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
4charmanderfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
5charmeleonfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
6charizardfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
7squirtlewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
8wartortlewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
9blastoisewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
10caterpiebugtacklehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
11metapodbugstring-shothttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
12butterfreebugrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
13weedlebugpoison-stinghttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
14kakunabugstring-shothttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
15beedrillbugswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
16pidgeynormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
17pidgeottonormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
18pidgeotnormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
19rattatanormalcuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
20raticatenormalswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
21spearownormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
22fearownormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
23ekanspoisonbindhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
24arbokpoisonbindhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
25pikachuelectricmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
26raichuelectricmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
27sandshrewgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
28sandslashgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
29nidoran-fpoisonscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
30nidorinapoisonscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
31nidoqueenpoisonmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
32nidoran-mpoisoncuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
33nidorinopoisoncuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
34nidokingpoisonmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
35clefairyfairypoundhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
36clefablefairydouble-slaphttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
37vulpixfireheadbutthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
38ninetalesfireheadbutthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
39jigglypuffnormalpoundhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
40wigglytuffnormaldouble-slaphttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
41zubatpoisonrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
42golbatpoisonrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
43oddishgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
44gloomgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
45vileplumegrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
46parasbugscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
47parasectbugscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
48venonatbugtacklehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
49venomothbugrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
50diglettgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
\n", + "
" + ], + "text/plain": [ + " Pokemon Type Hard Attack \\\n", + "Id \n", + "1 bulbasaur grass razor-wind \n", + "2 ivysaur grass swords-dance \n", + "3 venusaur grass swords-dance \n", + "4 charmander fire mega-punch \n", + "5 charmeleon fire mega-punch \n", + "6 charizard fire mega-punch \n", + "7 squirtle water mega-punch \n", + "8 wartortle water mega-punch \n", + "9 blastoise water mega-punch \n", + "10 caterpie bug tackle \n", + "11 metapod bug string-shot \n", + "12 butterfree bug razor-wind \n", + "13 weedle bug poison-sting \n", + "14 kakuna bug string-shot \n", + "15 beedrill bug swords-dance \n", + "16 pidgey normal razor-wind \n", + "17 pidgeotto normal razor-wind \n", + "18 pidgeot normal razor-wind \n", + "19 rattata normal cut \n", + "20 raticate normal swords-dance \n", + "21 spearow normal razor-wind \n", + "22 fearow normal razor-wind \n", + "23 ekans poison bind \n", + "24 arbok poison bind \n", + "25 pikachu electric mega-punch \n", + "26 raichu electric mega-punch \n", + "27 sandshrew ground scratch \n", + "28 sandslash ground scratch \n", + "29 nidoran-f poison scratch \n", + "30 nidorina poison scratch \n", + "31 nidoqueen poison mega-punch \n", + "32 nidoran-m poison cut \n", + "33 nidorino poison cut \n", + "34 nidoking poison mega-punch \n", + "35 clefairy fairy pound \n", + "36 clefable fairy double-slap \n", + "37 vulpix fire headbutt \n", + "38 ninetales fire headbutt \n", + "39 jigglypuff normal pound \n", + "40 wigglytuff normal double-slap \n", + "41 zubat poison razor-wind \n", + "42 golbat poison razor-wind \n", + "43 oddish grass swords-dance \n", + "44 gloom grass swords-dance \n", + "45 vileplume grass swords-dance \n", + "46 paras bug scratch \n", + "47 parasect bug scratch \n", + "48 venonat bug tackle \n", + "49 venomoth bug razor-wind \n", + "50 diglett ground scratch \n", + "\n", + " Picture \\\n", + "Id \n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "11 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "12 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "13 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "14 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "15 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "16 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "17 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "18 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "19 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "20 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "21 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "22 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "23 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "24 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "25 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "26 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "27 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "28 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "29 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "30 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "31 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "32 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "33 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "34 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "35 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "36 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "37 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "38 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "39 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "40 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "41 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "42 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "43 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "44 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "45 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "46 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "47 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "48 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "49 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "50 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " Back _Picture \n", + "Id \n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "11 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "12 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "13 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "14 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "15 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "16 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "17 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "18 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "19 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "20 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "21 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "22 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "23 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "24 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "25 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "26 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "27 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "28 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "29 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "30 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "31 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "32 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "33 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "34 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "35 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "36 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "37 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "38 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "39 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "40 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "41 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "42 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "43 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "44 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "45 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "46 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "47 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "48 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "49 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "50 https://raw.githubusercontent.com/PokeAPI/spri... " + ] + }, + "execution_count": 77, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon.head(50)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Untitled.ipynb b/Untitled.ipynb new file mode 100644 index 0000000..7f0300b --- /dev/null +++ b/Untitled.ipynb @@ -0,0 +1,139 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "import requests" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "url = 'https://pokeapi.co/api/v2/pokemon-form/'" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "response = requests.get(url)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def get_pokemons(url='https://pokeapi.co/api/v2/pokemon-form/', offset = 0):\n", + " args = {'offset': offset} if offset else[]\n", + " response.status_code == 200" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "bulbasaur\n", + "ivysaur\n", + "venusaur\n", + "charmander\n", + "charmeleon\n", + "charizard\n", + "squirtle\n", + "wartortle\n", + "blastoise\n", + "caterpie\n", + "metapod\n", + "butterfree\n", + "weedle\n", + "kakuna\n", + "beedrill\n", + "pidgey\n", + "pidgeotto\n", + "pidgeot\n", + "rattata\n", + "raticate\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Continua? y\n" + ] + }, + { + "ename": "NameError", + "evalue": "name 'offset' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[0msiguiente\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Continua?'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0msiguiente\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'y'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 16\u001b[1;33m \u001b[0mget_pokemons\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0moffset\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0moffset\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m20\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mNameError\u001b[0m: name 'offset' is not defined" + ] + } + ], + "source": [ + "def get_pokemons(url='https://pokeapi.co/api/v2/pokemon-form/', offset = 0):\n", + " args = {'offset': offset} if offset else[]\n", + " \n", + " response = requests.get(url, params=args)\n", + "\n", + "if response.status_code == 200:\n", + " payload = response.json()\n", + " results = payload.get('results', [])\n", + " \n", + " if results:\n", + " for pokemon in results:\n", + " name = pokemon['name']\n", + " print(name)\n", + " siguiente = input('Continua?')\n", + " if siguiente == 'y':\n", + " get_pokemons(offset= offset+20)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Untitled1.ipynb b/Untitled1.ipynb new file mode 100644 index 0000000..1b6b682 --- /dev/null +++ b/Untitled1.ipynb @@ -0,0 +1,1564 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import pandas as pd\n", + "from pandas.io.json import json_normalize\n", + "from urllib.request import urlopen" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "url = 'https://www.zalando.fr/api/catalog/articles?categories=promo-homme&limit=84&offset=60'" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":9: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + } + ], + "source": [ + "df=pd.DataFrame()\n", + "\n", + "\n", + "url = 'https://pokeapi.co/api/v2/pokemon/1/'\n", + "response = requests.get(url)\n", + "results = response.json()\n", + " \n", + " \n", + "flattened_data = json_normalize(results)\n", + " #flattened_data1 = json_normalize(flattened_data.articles[0])\n", + " #flattened_data1=flattened_data1.set_index('sku')\n", + "df = df.append(flattened_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 171, + "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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
4[{'ability': {'name': 'blaze', 'url': 'https:/...62[{'name': 'charmander', 'url': 'https://pokeap...[{'game_index': 176, 'version': {'name': 'red'...6[]4Truehttps://pokeapi.co/api/v2/pokemon/4/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
5[{'ability': {'name': 'blaze', 'url': 'https:/...142[{'name': 'charmeleon', 'url': 'https://pokeap...[{'game_index': 178, 'version': {'name': 'red'...11[]5Truehttps://pokeapi.co/api/v2/pokemon/5/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
6[{'ability': {'name': 'blaze', 'url': 'https:/...240[{'name': 'charizard', 'url': 'https://pokeapi...[{'game_index': 180, 'version': {'name': 'red'...17[]6Truehttps://pokeapi.co/api/v2/pokemon/6/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
7[{'ability': {'name': 'torrent', 'url': 'https...63[{'name': 'squirtle', 'url': 'https://pokeapi....[{'game_index': 177, 'version': {'name': 'red'...5[]7Truehttps://pokeapi.co/api/v2/pokemon/7/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
8[{'ability': {'name': 'torrent', 'url': 'https...142[{'name': 'wartortle', 'url': 'https://pokeapi...[{'game_index': 179, 'version': {'name': 'red'...10[]8Truehttps://pokeapi.co/api/v2/pokemon/8/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
9[{'ability': {'name': 'torrent', 'url': 'https...239[{'name': 'blastoise', 'url': 'https://pokeapi...[{'game_index': 28, 'version': {'name': 'red',...16[]9Truehttps://pokeapi.co/api/v2/pokemon/9/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
10[{'ability': {'name': 'shield-dust', 'url': 'h...39[{'name': 'caterpie', 'url': 'https://pokeapi....[{'game_index': 123, 'version': {'name': 'red'...3[]10Truehttps://pokeapi.co/api/v2/pokemon/10/encounters[{'move': {'name': 'tackle', 'url': 'https://p......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
\n", + "

10 rows × 115 columns

\n", + "
" + ], + "text/plain": [ + " abilities base_experience \\\n", + "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", + "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", + "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", + "4 [{'ability': {'name': 'blaze', 'url': 'https:/... 62 \n", + "5 [{'ability': {'name': 'blaze', 'url': 'https:/... 142 \n", + "6 [{'ability': {'name': 'blaze', 'url': 'https:/... 240 \n", + "7 [{'ability': {'name': 'torrent', 'url': 'https... 63 \n", + "8 [{'ability': {'name': 'torrent', 'url': 'https... 142 \n", + "9 [{'ability': {'name': 'torrent', 'url': 'https... 239 \n", + "10 [{'ability': {'name': 'shield-dust', 'url': 'h... 39 \n", + "\n", + " forms \\\n", + "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", + "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", + "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", + "4 [{'name': 'charmander', 'url': 'https://pokeap... \n", + "5 [{'name': 'charmeleon', 'url': 'https://pokeap... \n", + "6 [{'name': 'charizard', 'url': 'https://pokeapi... \n", + "7 [{'name': 'squirtle', 'url': 'https://pokeapi.... \n", + "8 [{'name': 'wartortle', 'url': 'https://pokeapi... \n", + "9 [{'name': 'blastoise', 'url': 'https://pokeapi... \n", + "10 [{'name': 'caterpie', 'url': 'https://pokeapi.... \n", + "\n", + " game_indices height held_items id \\\n", + "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", + "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", + "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", + "4 [{'game_index': 176, 'version': {'name': 'red'... 6 [] 4 \n", + "5 [{'game_index': 178, 'version': {'name': 'red'... 11 [] 5 \n", + "6 [{'game_index': 180, 'version': {'name': 'red'... 17 [] 6 \n", + "7 [{'game_index': 177, 'version': {'name': 'red'... 5 [] 7 \n", + "8 [{'game_index': 179, 'version': {'name': 'red'... 10 [] 8 \n", + "9 [{'game_index': 28, 'version': {'name': 'red',... 16 [] 9 \n", + "10 [{'game_index': 123, 'version': {'name': 'red'... 3 [] 10 \n", + "\n", + " is_default location_area_encounters \\\n", + "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", + "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", + "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", + "4 True https://pokeapi.co/api/v2/pokemon/4/encounters \n", + "5 True https://pokeapi.co/api/v2/pokemon/5/encounters \n", + "6 True https://pokeapi.co/api/v2/pokemon/6/encounters \n", + "7 True https://pokeapi.co/api/v2/pokemon/7/encounters \n", + "8 True https://pokeapi.co/api/v2/pokemon/8/encounters \n", + "9 True https://pokeapi.co/api/v2/pokemon/9/encounters \n", + "10 True https://pokeapi.co/api/v2/pokemon/10/encounters \n", + "\n", + " moves ... \\\n", + "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", + "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "4 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "5 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "6 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "7 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "8 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "9 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", + "10 [{'move': {'name': 'tackle', 'url': 'https://p... ... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 None \n", + "5 None \n", + "6 None \n", + "7 None \n", + "8 None \n", + "9 None \n", + "10 None \n", + "\n", + " sprites.versions.generation-vii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_female \\\n", + "1 None \n", + "2 None \n", + "3 None \n", + "4 None \n", + "5 None \n", + "6 None \n", + "7 None \n", + "8 None \n", + "9 None \n", + "10 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 None \n", + "5 None \n", + "6 None \n", + "7 None \n", + "8 None \n", + "9 None \n", + "10 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 None \n", + "5 None \n", + "6 None \n", + "7 None \n", + "8 None \n", + "9 None \n", + "10 None \n", + "\n", + " sprites.versions.generation-viii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_female \n", + "1 None \n", + "2 None \n", + "3 None \n", + "4 None \n", + "5 None \n", + "6 None \n", + "7 None \n", + "8 None \n", + "9 None \n", + "10 None \n", + "\n", + "[10 rows x 115 columns]" + ] + }, + "execution_count": 171, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 174, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'bulbasaur', 'url': 'https://pokeapi.co/api/v2/pokemon-form/1/'}" + ] + }, + "execution_count": 174, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['forms'][1][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 183, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'charizard', 'url': 'https://pokeapi.co/api/v2/pokemon-form/6/'}" + ] + }, + "execution_count": 183, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['forms'][6][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 206, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + } + ], + "source": [ + "df3=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,11):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " results = response.json()\n", + " \n", + " \n", + " flattened_data = json_normalize(results)\n", + " \n", + " df3 = df3.append(flattened_data)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "metadata": {}, + "outputs": [], + "source": [ + "df3.index = np.arange(1,len(df3)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['form_name', 'form_names', 'form_order', 'id', 'is_battle_only',\n", + " 'is_default', 'is_mega', 'name', 'names', 'order', 'types',\n", + " 'pokemon.name', 'pokemon.url', 'sprites.back_default',\n", + " 'sprites.back_female', 'sprites.back_shiny',\n", + " 'sprites.back_shiny_female', 'sprites.front_default',\n", + " 'sprites.front_female', 'sprites.front_shiny',\n", + " 'sprites.front_shiny_female', 'version_group.name',\n", + " 'version_group.url'],\n", + " dtype='object')" + ] + }, + "execution_count": 211, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df3.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", + "2 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", + "3 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", + "4 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", + "5 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", + "6 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", + "7 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", + "8 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", + "9 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", + "10 [{'slot': 1, 'type': {'name': 'bug', 'url': 'h...\n", + "Name: types, dtype: object" + ] + }, + "execution_count": 212, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df3['types']" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['grass',\n", + " 'grass',\n", + " 'grass',\n", + " 'fire',\n", + " 'fire',\n", + " 'fire',\n", + " 'water',\n", + " 'water',\n", + " 'water',\n", + " 'bug']" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type = [df3['types'][i][0]['type']['name'] for i in range(1,11)]\n", + "type" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + } + ], + "source": [ + "df=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,11):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/6/'\n", + " response = requests.get(url)\n", + " results = response.json()\n", + " \n", + " \n", + " flattened_data = json_normalize(results)\n", + " #flattened_data = flattened_data.set_index('id')\n", + " df = df.append(flattened_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [], + "source": [ + "df.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
\n", + "

3 rows × 115 columns

\n", + "
" + ], + "text/plain": [ + " abilities base_experience \\\n", + "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", + "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", + "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", + "\n", + " forms \\\n", + "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", + "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", + "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", + "\n", + " game_indices height held_items id \\\n", + "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", + "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", + "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", + "\n", + " is_default location_area_encounters \\\n", + "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", + "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", + "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", + "\n", + " moves ... \\\n", + "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", + "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.icons.front_female \\\n", + "1 None \n", + "2 None \n", + "3 None \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.versions.generation-viii.icons.front_female \n", + "1 None \n", + "2 None \n", + "3 None \n", + "\n", + "[3 rows x 115 columns]" + ] + }, + "execution_count": 109, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [], + "source": [ + "nombres = [df['forms'][i][0]['name'] for i in range(1,11)]" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bulbasaur',\n", + " 'ivysaur',\n", + " 'venusaur',\n", + " 'charmander',\n", + " 'charmeleon',\n", + " 'charizard',\n", + " 'squirtle',\n", + " 'wartortle',\n", + " 'blastoise',\n", + " 'caterpie']" + ] + }, + "execution_count": 83, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nombres" + ] + }, + { + "cell_type": "code", + "execution_count": 143, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 143, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ids = [df['id'][i] for i in range(1,11)]\n", + "ids" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [], + "source": [ + "#df['game_indices'][1]" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['razor-wind',\n", + " 'swords-dance',\n", + " 'swords-dance',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'mega-punch',\n", + " 'tackle']" + ] + }, + "execution_count": 115, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,11)]\n", + "attacks" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'}" + ] + }, + "execution_count": 118, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['moves'][1][0]['move']" + ] + }, + { + "cell_type": "code", + "execution_count": 156, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/1.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/2.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/3.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/4.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/5.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/6.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/7.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/8.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/9.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/10.png']" + ] + }, + "execution_count": 156, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links_imagenes = [df['sprites.versions.generation-vi.x-y.front_shiny'][i] for i in range(1,11)]\n", + "links_imagenes" + ] + }, + { + "cell_type": "code", + "execution_count": 160, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://pokeapi.co/api/v2/pokemon-form/10/'" + ] + }, + "execution_count": 160, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links_imagenes_vta = df['forms'][i][0]['url']\n", + "links_imagenes_vta" + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data2 = json_normalize(results)\n" + ] + } + ], + "source": [ + "df2=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,11):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " results = response.json()\n", + " \n", + " \n", + " flattened_data2 = json_normalize(results)\n", + " \n", + " df2 = df2.append(flattened_data2)" + ] + }, + { + "cell_type": "code", + "execution_count": 162, + "metadata": {}, + "outputs": [], + "source": [ + "df2.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 163, + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
form_nameform_namesform_orderidis_battle_onlyis_defaultis_meganamenamesorder...sprites.back_defaultsprites.back_femalesprites.back_shinysprites.back_shiny_femalesprites.front_defaultsprites.front_femalesprites.front_shinysprites.front_shiny_femaleversion_group.nameversion_group.url
1[]11FalseTrueFalsebulbasaur[]1...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
2[]12FalseTrueFalseivysaur[]2...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
3[]13FalseTrueFalsevenusaur[]3...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...red-bluehttps://pokeapi.co/api/v2/version-group/1/
\n", + "

3 rows × 23 columns

\n", + "
" + ], + "text/plain": [ + " form_name form_names form_order id is_battle_only is_default is_mega \\\n", + "1 [] 1 1 False True False \n", + "2 [] 1 2 False True False \n", + "3 [] 1 3 False True False \n", + "\n", + " name names order ... \\\n", + "1 bulbasaur [] 1 ... \n", + "2 ivysaur [] 2 ... \n", + "3 venusaur [] 3 ... \n", + "\n", + " sprites.back_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.back_shiny_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_default \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_female \\\n", + "1 None \n", + "2 None \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_shiny \\\n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " sprites.front_shiny_female version_group.name \\\n", + "1 None red-blue \n", + "2 None red-blue \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... red-blue \n", + "\n", + " version_group.url \n", + "1 https://pokeapi.co/api/v2/version-group/1/ \n", + "2 https://pokeapi.co/api/v2/version-group/1/ \n", + "3 https://pokeapi.co/api/v2/version-group/1/ \n", + "\n", + "[3 rows x 23 columns]" + ] + }, + "execution_count": 163, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df2.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 164, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/2.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/3.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/4.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/5.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/6.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/7.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/8.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/9.png',\n", + " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png']" + ] + }, + "execution_count": 164, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links_pictures = [df2['sprites.back_default'][i] for i in range(1,11)]\n", + "links_pictures" + ] + }, + { + "cell_type": "code", + "execution_count": 165, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'ability': {'name': 'overgrow',\n", + " 'url': 'https://pokeapi.co/api/v2/ability/65/'},\n", + " 'is_hidden': False,\n", + " 'slot': 1}" + ] + }, + "execution_count": 165, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['abilities'][1][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 170, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'move': {'name': 'swords-dance', 'url': 'https://pokeapi.co/api/v2/move/14/'},\n", + " 'version_group_details': [{'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'red-blue',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/1/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'yellow',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/2/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'tutor',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", + " 'version_group': {'name': 'emerald',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/6/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'tutor',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", + " 'version_group': {'name': 'firered-leafgreen',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/7/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'diamond-pearl',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/8/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'platinum',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/9/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'heartgold-soulsilver',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/10/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'black-white',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/11/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'black-2-white-2',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/14/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'x-y',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/15/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'omega-ruby-alpha-sapphire',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/16/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'sun-moon',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/17/'}},\n", + " {'level_learned_at': 0,\n", + " 'move_learn_method': {'name': 'machine',\n", + " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", + " 'version_group': {'name': 'ultra-sun-ultra-moon',\n", + " 'url': 'https://pokeapi.co/api/v2/version-group/18/'}}]}" + ] + }, + "execution_count": 170, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['moves'][1][1]" + ] + }, + { + "cell_type": "code", + "execution_count": 153, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/2.png'" + ] + }, + "execution_count": 153, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/main.ipynb b/main.ipynb new file mode 100644 index 0000000..5b9638f --- /dev/null +++ b/main.ipynb @@ -0,0 +1,957 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import numpy as np\n", + "import pandas as pd\n", + "from pandas.io.json import json_normalize\n", + "from urllib.request import urlopen" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Datos Generales pokemon\n", + "\n", + "df=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " df = df.append(flattened_data)\n", + " \n", + " else:\n", + " print('connection error')\n", + " break\n", + "print('Connecion Successful')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "df.index = np.arange(1,len(df)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "ids = [df['id'][i] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "names = [df['forms'][i][0]['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "links_pictures = [df['sprites.versions.generation-vi.x-y.front_shiny'][i] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":12: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Para obtener el tipo de pokemon\n", + "\n", + "df2=pd.DataFrame()\n", + "\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " df2 = df2.append(flattened_data)\n", + " else:\n", + " print('connection error')\n", + " break\n", + "\n", + "print('Connecion Successful')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [], + "source": [ + "df2.index = np.arange(1,len(df2)+1)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [], + "source": [ + "types = [df2['types'][i][0]['type']['name'] for i in range(1,151)]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":11: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", + " flattened_data = json_normalize(results)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connecion Successful\n" + ] + } + ], + "source": [ + "# Para obtener las fotos de pokemons por la parte de atrás\n", + "\n", + "df3=pd.DataFrame()\n", + "\n", + "for i in range(1,151):\n", + " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " \n", + " results = response.json()\n", + " flattened_data = json_normalize(results)\n", + " flattened_data = flattened_data.set_index('id')\n", + " df3 = df3.append(flattened_data)\n", + " \n", + " else:\n", + " print('connection error')\n", + " break\n", + "print('Connecion Successful')" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [], + "source": [ + "df3.index = np.arange(1,len(df3)+1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [], + "source": [ + "links_pictures_back = [df3['sprites.back_default'][i] for i in range(1,151)]\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [], + "source": [ + "nom_columns = ['Id','Pokemon','Type','Hard Attack','Picture','Back _Picture']" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [], + "source": [ + "df_pokemon = pd.DataFrame(list(zip(ids, names, types, attacks, links_pictures, links_pictures_back )), columns = nom_columns)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [], + "source": [ + "df_pokemon = df_pokemon.set_index('Id')" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/25.png'" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon['Picture'][25]" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/25.png'" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon['Back _Picture'][25]" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "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", + " \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", + " \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", + " \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", + " \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", + "
PokemonTypeHard AttackPictureBack _Picture
Id
1bulbasaurgrassrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
2ivysaurgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
3venusaurgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
4charmanderfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
5charmeleonfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
6charizardfiremega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
7squirtlewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
8wartortlewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
9blastoisewatermega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
10caterpiebugtacklehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
11metapodbugstring-shothttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
12butterfreebugrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
13weedlebugpoison-stinghttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
14kakunabugstring-shothttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
15beedrillbugswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
16pidgeynormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
17pidgeottonormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
18pidgeotnormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
19rattatanormalcuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
20raticatenormalswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
21spearownormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
22fearownormalrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
23ekanspoisonbindhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
24arbokpoisonbindhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
25pikachuelectricmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
26raichuelectricmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
27sandshrewgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
28sandslashgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
29nidoran-fpoisonscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
30nidorinapoisonscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
31nidoqueenpoisonmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
32nidoran-mpoisoncuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
33nidorinopoisoncuthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
34nidokingpoisonmega-punchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
35clefairyfairypoundhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
36clefablefairydouble-slaphttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
37vulpixfireheadbutthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
38ninetalesfireheadbutthttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
39jigglypuffnormalpoundhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
40wigglytuffnormaldouble-slaphttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
41zubatpoisonrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
42golbatpoisonrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
43oddishgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
44gloomgrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
45vileplumegrassswords-dancehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
46parasbugscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
47parasectbugscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
48venonatbugtacklehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
49venomothbugrazor-windhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
50diglettgroundscratchhttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...
\n", + "
" + ], + "text/plain": [ + " Pokemon Type Hard Attack \\\n", + "Id \n", + "1 bulbasaur grass razor-wind \n", + "2 ivysaur grass swords-dance \n", + "3 venusaur grass swords-dance \n", + "4 charmander fire mega-punch \n", + "5 charmeleon fire mega-punch \n", + "6 charizard fire mega-punch \n", + "7 squirtle water mega-punch \n", + "8 wartortle water mega-punch \n", + "9 blastoise water mega-punch \n", + "10 caterpie bug tackle \n", + "11 metapod bug string-shot \n", + "12 butterfree bug razor-wind \n", + "13 weedle bug poison-sting \n", + "14 kakuna bug string-shot \n", + "15 beedrill bug swords-dance \n", + "16 pidgey normal razor-wind \n", + "17 pidgeotto normal razor-wind \n", + "18 pidgeot normal razor-wind \n", + "19 rattata normal cut \n", + "20 raticate normal swords-dance \n", + "21 spearow normal razor-wind \n", + "22 fearow normal razor-wind \n", + "23 ekans poison bind \n", + "24 arbok poison bind \n", + "25 pikachu electric mega-punch \n", + "26 raichu electric mega-punch \n", + "27 sandshrew ground scratch \n", + "28 sandslash ground scratch \n", + "29 nidoran-f poison scratch \n", + "30 nidorina poison scratch \n", + "31 nidoqueen poison mega-punch \n", + "32 nidoran-m poison cut \n", + "33 nidorino poison cut \n", + "34 nidoking poison mega-punch \n", + "35 clefairy fairy pound \n", + "36 clefable fairy double-slap \n", + "37 vulpix fire headbutt \n", + "38 ninetales fire headbutt \n", + "39 jigglypuff normal pound \n", + "40 wigglytuff normal double-slap \n", + "41 zubat poison razor-wind \n", + "42 golbat poison razor-wind \n", + "43 oddish grass swords-dance \n", + "44 gloom grass swords-dance \n", + "45 vileplume grass swords-dance \n", + "46 paras bug scratch \n", + "47 parasect bug scratch \n", + "48 venonat bug tackle \n", + "49 venomoth bug razor-wind \n", + "50 diglett ground scratch \n", + "\n", + " Picture \\\n", + "Id \n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "11 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "12 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "13 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "14 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "15 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "16 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "17 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "18 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "19 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "20 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "21 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "22 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "23 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "24 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "25 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "26 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "27 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "28 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "29 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "30 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "31 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "32 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "33 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "34 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "35 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "36 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "37 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "38 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "39 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "40 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "41 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "42 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "43 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "44 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "45 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "46 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "47 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "48 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "49 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "50 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "\n", + " Back _Picture \n", + "Id \n", + "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "11 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "12 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "13 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "14 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "15 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "16 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "17 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "18 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "19 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "20 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "21 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "22 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "23 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "24 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "25 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "26 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "27 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "28 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "29 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "30 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "31 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "32 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "33 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "34 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "35 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "36 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "37 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "38 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "39 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "40 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "41 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "42 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "43 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "44 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "45 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "46 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "47 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "48 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "49 https://raw.githubusercontent.com/PokeAPI/spri... \n", + "50 https://raw.githubusercontent.com/PokeAPI/spri... " + ] + }, + "execution_count": 77, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_pokemon.head(50)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From f46c5cdb2451bb508f99be93250f401dea97447e Mon Sep 17 00:00:00 2001 From: herguejuan Date: Sat, 22 May 2021 05:35:45 -0500 Subject: [PATCH 2/3] Adding Readme.md file & Export file --- .../README-checkpoint.md | 0 .ipynb_checkpoints/Untitled-checkpoint.ipynb | 6 - .ipynb_checkpoints/Untitled1-checkpoint.ipynb | 1063 ----------- .ipynb_checkpoints/main-checkpoint.ipynb | 4 +- Exports/Pokemons.csv | 151 ++ README .md | 44 + Untitled.ipynb | 139 -- Untitled1.ipynb | 1564 ----------------- main.ipynb | 13 +- 9 files changed, 208 insertions(+), 2776 deletions(-) rename README.md => .ipynb_checkpoints/README-checkpoint.md (100%) delete mode 100644 .ipynb_checkpoints/Untitled-checkpoint.ipynb delete mode 100644 .ipynb_checkpoints/Untitled1-checkpoint.ipynb create mode 100644 Exports/Pokemons.csv create mode 100644 README .md delete mode 100644 Untitled.ipynb delete mode 100644 Untitled1.ipynb diff --git a/README.md b/.ipynb_checkpoints/README-checkpoint.md similarity index 100% rename from README.md rename to .ipynb_checkpoints/README-checkpoint.md diff --git a/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/.ipynb_checkpoints/Untitled-checkpoint.ipynb deleted file mode 100644 index 7fec515..0000000 --- a/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/.ipynb_checkpoints/Untitled1-checkpoint.ipynb b/.ipynb_checkpoints/Untitled1-checkpoint.ipynb deleted file mode 100644 index 58e58ed..0000000 --- a/.ipynb_checkpoints/Untitled1-checkpoint.ipynb +++ /dev/null @@ -1,1063 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "import json\n", - "import requests\n", - "import pandas as pd\n", - "from pandas.io.json import json_normalize\n", - "from urllib.request import urlopen" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "url = 'https://www.zalando.fr/api/catalog/articles?categories=promo-homme&limit=84&offset=60'" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":9: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data = json_normalize(results)\n" - ] - } - ], - "source": [ - "df=pd.DataFrame()\n", - "\n", - "\n", - "url = 'https://pokeapi.co/api/v2/pokemon/1/'\n", - "response = requests.get(url)\n", - "results = response.json()\n", - " \n", - " \n", - "flattened_data = json_normalize(results)\n", - " #flattened_data1 = json_normalize(flattened_data.articles[0])\n", - " #flattened_data1=flattened_data1.set_index('sku')\n", - "df = df.append(flattened_data)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "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", - "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
0[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
\n", - "

1 rows × 115 columns

\n", - "
" - ], - "text/plain": [ - " abilities base_experience \\\n", - "0 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", - "\n", - " forms \\\n", - "0 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", - "\n", - " game_indices height held_items id \\\n", - "0 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", - "\n", - " is_default location_area_encounters \\\n", - "0 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", - "\n", - " moves ... \\\n", - "0 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny \\\n", - "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", - "0 None \n", - "\n", - " sprites.versions.generation-vii.icons.front_default \\\n", - "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_female \\\n", - "0 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", - "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", - "0 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", - "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", - "0 None \n", - "\n", - " sprites.versions.generation-viii.icons.front_default \\\n", - "0 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_female \n", - "0 None \n", - "\n", - "[1 rows x 115 columns]" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'name': 'bulbasaur', 'url': 'https://pokeapi.co/api/v2/pokemon-form/1/'}\n" - ] - } - ], - "source": [ - "print(df['forms'][0][0])" - ] - }, - { - "cell_type": "code", - "execution_count": 93, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data = json_normalize(results)\n" - ] - } - ], - "source": [ - "df=pd.DataFrame()\n", - "\n", - "\n", - "for i in range(1,11):\n", - " url = f'https://pokeapi.co/api/v2/pokemon/{i}/'\n", - " response = requests.get(url)\n", - " results = response.json()\n", - " \n", - " \n", - " flattened_data = json_normalize(results)\n", - " #flattened_data = flattened_data.set_index('id')\n", - " df = df.append(flattened_data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": {}, - "outputs": [], - "source": [ - "df.index = np.arange(1,len(df)+1)" - ] - }, - { - "cell_type": "code", - "execution_count": 109, - "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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
\n", - "

3 rows × 115 columns

\n", - "
" - ], - "text/plain": [ - " abilities base_experience \\\n", - "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", - "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", - "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", - "\n", - " forms \\\n", - "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", - "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", - "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", - "\n", - " game_indices height held_items id \\\n", - "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", - "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", - "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", - "\n", - " is_default location_area_encounters \\\n", - "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", - "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", - "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", - "\n", - " moves ... \\\n", - "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", - "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_female \\\n", - "1 None \n", - "2 None \n", - "3 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_female \n", - "1 None \n", - "2 None \n", - "3 None \n", - "\n", - "[3 rows x 115 columns]" - ] - }, - "execution_count": 109, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": {}, - "outputs": [], - "source": [ - "nombres = [df['forms'][i][0]['name'] for i in range(1,11)]" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['bulbasaur',\n", - " 'ivysaur',\n", - " 'venusaur',\n", - " 'charmander',\n", - " 'charmeleon',\n", - " 'charizard',\n", - " 'squirtle',\n", - " 'wartortle',\n", - " 'blastoise',\n", - " 'caterpie']" - ] - }, - "execution_count": 83, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "nombres" - ] - }, - { - "cell_type": "code", - "execution_count": 143, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" - ] - }, - "execution_count": 143, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ids = [df['id'][i] for i in range(1,11)]\n", - "ids" - ] - }, - { - "cell_type": "code", - "execution_count": 107, - "metadata": {}, - "outputs": [], - "source": [ - "#df['game_indices'][1]" - ] - }, - { - "cell_type": "code", - "execution_count": 115, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['razor-wind',\n", - " 'swords-dance',\n", - " 'swords-dance',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'tackle']" - ] - }, - "execution_count": 115, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,11)]\n", - "attacks" - ] - }, - { - "cell_type": "code", - "execution_count": 118, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'}" - ] - }, - "execution_count": 118, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['moves'][1][0]['move']" - ] - }, - { - "cell_type": "code", - "execution_count": 129, - "metadata": {}, - "outputs": [], - "source": [ - "links_imagenes = [df['forms'][i][0]['url'] for i in range(1,11)]" - ] - }, - { - "cell_type": "code", - "execution_count": 130, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['https://pokeapi.co/api/v2/pokemon-form/1/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/2/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/3/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/4/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/5/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/6/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/7/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/8/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/9/',\n", - " 'https://pokeapi.co/api/v2/pokemon-form/10/']" - ] - }, - "execution_count": 130, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links_imagenes" - ] - }, - { - "cell_type": "code", - "execution_count": 131, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data2 = json_normalize(results)\n" - ] - } - ], - "source": [ - "df2=pd.DataFrame()\n", - "\n", - "\n", - "for i in range(1,11):\n", - " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", - " response = requests.get(url)\n", - " results = response.json()\n", - " \n", - " \n", - " flattened_data2 = json_normalize(results)\n", - " \n", - " df2 = df2.append(flattened_data2)" - ] - }, - { - "cell_type": "code", - "execution_count": 135, - "metadata": {}, - "outputs": [], - "source": [ - "df2.index = np.arange(1,len(df)+1)" - ] - }, - { - "cell_type": "code", - "execution_count": 136, - "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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
form_nameform_namesform_orderidis_battle_onlyis_defaultis_meganamenamesorder...sprites.back_defaultsprites.back_femalesprites.back_shinysprites.back_shiny_femalesprites.front_defaultsprites.front_femalesprites.front_shinysprites.front_shiny_femaleversion_group.nameversion_group.url
1[]11FalseTrueFalsebulbasaur[]1...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
2[]12FalseTrueFalseivysaur[]2...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
3[]13FalseTrueFalsevenusaur[]3...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...red-bluehttps://pokeapi.co/api/v2/version-group/1/
\n", - "

3 rows × 23 columns

\n", - "
" - ], - "text/plain": [ - " form_name form_names form_order id is_battle_only is_default is_mega \\\n", - "1 [] 1 1 False True False \n", - "2 [] 1 2 False True False \n", - "3 [] 1 3 False True False \n", - "\n", - " name names order ... \\\n", - "1 bulbasaur [] 1 ... \n", - "2 ivysaur [] 2 ... \n", - "3 venusaur [] 3 ... \n", - "\n", - " sprites.back_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_shiny_female version_group.name \\\n", - "1 None red-blue \n", - "2 None red-blue \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... red-blue \n", - "\n", - " version_group.url \n", - "1 https://pokeapi.co/api/v2/version-group/1/ \n", - "2 https://pokeapi.co/api/v2/version-group/1/ \n", - "3 https://pokeapi.co/api/v2/version-group/1/ \n", - "\n", - "[3 rows x 23 columns]" - ] - }, - "execution_count": 136, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df2.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 139, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/2.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/3.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/4.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/5.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/6.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/7.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/8.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/9.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png']" - ] - }, - "execution_count": 139, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links_pictures = [df2['sprites.back_default'][i] for i in range(1,11)]\n", - "links_pictures" - ] - }, - { - "cell_type": "code", - "execution_count": 146, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ability': {'name': 'overgrow',\n", - " 'url': 'https://pokeapi.co/api/v2/ability/65/'},\n", - " 'is_hidden': False,\n", - " 'slot': 1}" - ] - }, - "execution_count": 146, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['abilities'][1][0]" - ] - }, - { - "cell_type": "code", - "execution_count": 149, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'move': {'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'},\n", - " 'version_group_details': [{'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'egg',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/2/'},\n", - " 'version_group': {'name': 'gold-silver',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/3/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'egg',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/2/'},\n", - " 'version_group': {'name': 'crystal',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/4/'}}]}" - ] - }, - "execution_count": 149, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['moves'][1][0]" - ] - }, - { - "cell_type": "code", - "execution_count": 150, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'move': {'name': 'swords-dance', 'url': 'https://pokeapi.co/api/v2/move/14/'},\n", - " 'version_group_details': [{'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'red-blue',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/1/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'yellow',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/2/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'tutor',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", - " 'version_group': {'name': 'emerald',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/6/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'tutor',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", - " 'version_group': {'name': 'firered-leafgreen',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/7/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'diamond-pearl',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/8/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'platinum',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/9/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'heartgold-soulsilver',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/10/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'black-white',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/11/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'black-2-white-2',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/14/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'x-y',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/15/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'omega-ruby-alpha-sapphire',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/16/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'sun-moon',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/17/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'ultra-sun-ultra-moon',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/18/'}}]}" - ] - }, - "execution_count": 150, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['moves'][1][1]" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/.ipynb_checkpoints/main-checkpoint.ipynb b/.ipynb_checkpoints/main-checkpoint.ipynb index 5b9638f..248fa73 100644 --- a/.ipynb_checkpoints/main-checkpoint.ipynb +++ b/.ipynb_checkpoints/main-checkpoint.ipynb @@ -271,7 +271,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 79, "metadata": {}, "outputs": [ { @@ -280,7 +280,7 @@ "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/25.png'" ] }, - "execution_count": 75, + "execution_count": 79, "metadata": {}, "output_type": "execute_result" } diff --git a/Exports/Pokemons.csv b/Exports/Pokemons.csv new file mode 100644 index 0000000..d65d35a --- /dev/null +++ b/Exports/Pokemons.csv @@ -0,0 +1,151 @@ +Id,Pokemon,Type,Hard Attack,Picture,Back _Picture +1,bulbasaur,grass,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/1.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png +2,ivysaur,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/2.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/2.png +3,venusaur,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/3.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/3.png +4,charmander,fire,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/4.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/4.png +5,charmeleon,fire,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/5.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/5.png +6,charizard,fire,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/6.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/6.png +7,squirtle,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/7.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/7.png +8,wartortle,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/8.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/8.png +9,blastoise,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/9.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/9.png +10,caterpie,bug,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/10.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png +11,metapod,bug,string-shot,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/11.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/11.png +12,butterfree,bug,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/12.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/12.png +13,weedle,bug,poison-sting,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/13.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/13.png +14,kakuna,bug,string-shot,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/14.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/14.png +15,beedrill,bug,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/15.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/15.png +16,pidgey,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/16.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/16.png +17,pidgeotto,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/17.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/17.png +18,pidgeot,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/18.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/18.png +19,rattata,normal,cut,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/19.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/19.png +20,raticate,normal,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/20.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/20.png +21,spearow,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/21.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/21.png +22,fearow,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/22.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/22.png +23,ekans,poison,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/23.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/23.png +24,arbok,poison,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/24.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/24.png +25,pikachu,electric,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/25.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/25.png +26,raichu,electric,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/26.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/26.png +27,sandshrew,ground,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/27.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/27.png +28,sandslash,ground,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/28.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/28.png +29,nidoran-f,poison,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/29.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/29.png +30,nidorina,poison,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/30.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/30.png +31,nidoqueen,poison,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/31.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/31.png +32,nidoran-m,poison,cut,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/32.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/32.png +33,nidorino,poison,cut,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/33.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/33.png +34,nidoking,poison,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/34.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/34.png +35,clefairy,fairy,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/35.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/35.png +36,clefable,fairy,double-slap,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/36.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/36.png +37,vulpix,fire,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/37.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/37.png +38,ninetales,fire,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/38.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/38.png +39,jigglypuff,normal,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/39.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/39.png +40,wigglytuff,normal,double-slap,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/40.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/40.png +41,zubat,poison,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/41.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/41.png +42,golbat,poison,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/42.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/42.png +43,oddish,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/43.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/43.png +44,gloom,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/44.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/44.png +45,vileplume,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/45.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/45.png +46,paras,bug,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/46.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/46.png +47,parasect,bug,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/47.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/47.png +48,venonat,bug,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/48.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/48.png +49,venomoth,bug,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/49.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/49.png +50,diglett,ground,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/50.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/50.png +51,dugtrio,ground,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/51.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/51.png +52,meowth,normal,pay-day,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/52.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/52.png +53,persian,normal,pay-day,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/53.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/53.png +54,psyduck,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/54.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/54.png +55,golduck,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/55.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/55.png +56,mankey,fighting,karate-chop,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/56.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/56.png +57,primeape,fighting,karate-chop,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/57.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/57.png +58,growlithe,fire,double-kick,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/58.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/58.png +59,arcanine,fire,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/59.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/59.png +60,poliwag,water,double-slap,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/60.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/60.png +61,poliwhirl,water,double-slap,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/61.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/61.png +62,poliwrath,water,double-slap,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/62.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/62.png +63,abra,psychic,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/63.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/63.png +64,kadabra,psychic,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/64.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/64.png +65,alakazam,psychic,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/65.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/65.png +66,machop,fighting,karate-chop,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/66.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/66.png +67,machoke,fighting,karate-chop,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/67.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/67.png +68,machamp,fighting,karate-chop,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/68.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/68.png +69,bellsprout,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/69.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/69.png +70,weepinbell,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/70.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/70.png +71,victreebel,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/71.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/71.png +72,tentacool,water,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/72.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/72.png +73,tentacruel,water,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/73.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/73.png +74,geodude,rock,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/74.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/74.png +75,graveler,rock,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/75.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/75.png +76,golem,rock,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/76.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/76.png +77,ponyta,fire,stomp,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/77.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/77.png +78,rapidash,fire,stomp,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/78.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/78.png +79,slowpoke,water,pay-day,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/79.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/79.png +80,slowbro,water,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/80.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/80.png +81,magnemite,electric,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/81.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/81.png +82,magneton,electric,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/82.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/82.png +83,farfetchd,normal,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/83.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/83.png +84,doduo,normal,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/84.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/84.png +85,dodrio,normal,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/85.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/85.png +86,seel,water,pay-day,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/86.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/86.png +87,dewgong,water,pay-day,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/87.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/87.png +88,grimer,poison,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/88.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/88.png +89,muk,poison,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/89.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/89.png +90,shellder,water,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/90.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/90.png +91,cloyster,water,take-down,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/91.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/91.png +92,gastly,ghost,fire-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/92.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/92.png +93,haunter,ghost,fire-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/93.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/93.png +94,gengar,ghost,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/94.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/94.png +95,onix,rock,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/95.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/95.png +96,drowzee,psychic,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/96.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/96.png +97,hypno,psychic,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/97.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/97.png +98,krabby,water,vise-grip,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/98.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/98.png +99,kingler,water,vise-grip,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/99.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/99.png +100,voltorb,electric,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/100.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/100.png +101,electrode,electric,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/101.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/101.png +102,exeggcute,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/102.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/102.png +103,exeggutor,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/103.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/103.png +104,cubone,ground,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/104.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/104.png +105,marowak,ground,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/105.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/105.png +106,hitmonlee,fighting,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/106.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/106.png +107,hitmonchan,fighting,comet-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/107.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/107.png +108,lickitung,normal,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/108.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/108.png +109,koffing,poison,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/109.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/109.png +110,weezing,poison,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/110.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/110.png +111,rhyhorn,ground,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/111.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/111.png +112,rhydon,ground,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/112.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/112.png +113,chansey,normal,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/113.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/113.png +114,tangela,grass,swords-dance,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/114.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/114.png +115,kangaskhan,normal,comet-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/115.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/115.png +116,horsea,water,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/116.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/116.png +117,seadra,water,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/117.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/117.png +118,goldeen,water,horn-attack,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/118.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/118.png +119,seaking,water,horn-attack,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/119.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/119.png +120,staryu,water,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/120.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/120.png +121,starmie,water,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/121.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/121.png +122,mr-mime,psychic,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/122.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/122.png +123,scyther,bug,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/123.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/123.png +124,jynx,ice,pound,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/124.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/124.png +125,electabuzz,electric,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/125.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/125.png +126,magmar,fire,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/126.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/126.png +127,pinsir,bug,vise-grip,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/127.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/127.png +128,tauros,normal,stomp,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/128.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/128.png +129,magikarp,water,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/129.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/129.png +130,gyarados,water,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/130.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/130.png +131,lapras,water,headbutt,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/131.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/131.png +132,ditto,normal,transform,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/132.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/132.png +133,eevee,normal,sand-attack,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/133.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/133.png +134,vaporeon,water,sand-attack,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/134.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/134.png +135,jolteon,electric,double-kick,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/135.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/135.png +136,flareon,fire,sand-attack,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/136.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/136.png +137,porygon,normal,tackle,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/137.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/137.png +138,omanyte,rock,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/138.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/138.png +139,omastar,rock,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/139.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/139.png +140,kabuto,rock,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/140.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/140.png +141,kabutops,rock,scratch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/141.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/141.png +142,aerodactyl,rock,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/142.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/142.png +143,snorlax,normal,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/143.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/143.png +144,articuno,ice,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/144.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/144.png +145,zapdos,electric,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/145.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/145.png +146,moltres,fire,razor-wind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/146.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/146.png +147,dratini,dragon,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/147.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/147.png +148,dragonair,dragon,bind,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/148.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/148.png +149,dragonite,dragon,fire-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/149.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/149.png +150,mewtwo,psychic,mega-punch,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/150.png,https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/150.png diff --git a/README .md b/README .md new file mode 100644 index 0000000..cc905d9 --- /dev/null +++ b/README .md @@ -0,0 +1,44 @@ +![IronHack Logo](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_d5c5793015fec3be28a63c4fa3dd4d55.png) + +# Project: API and Web Data Scraping + +## Overview: Data Extraction of PokeAPI + +Para este proyecto se consultó una API basada en la serie de televisión "Pokemon" donde se realizó +la busqueda de información a travéz de diferentes archivos JSON para obtener los datos precisos +que ocupabamos en el DataFrame para despues exportar los datos a un archovo de csv. + +La búsqueda de los pokemons fué complicada pero se lograron capturar a todos con todo y fotografías!! + +--- + +## Deliverables + +**A Jupyter Notebook (.ipynb) file** +**An output folder** +**A README.md file (it's this File)** + + +--- + +## Detailed Explanation + +En éste archivo Jupyter Notebook encontramos un código que nos permiten navegar a travéz de +diferentes URL almacenadas en un archivo JSON para posterior crear un DataFrame de la +información específica que necesitamos acerca nuestros Pokemons, datos como: Número de Pokemon, Nombre,Tipo, Ataque poderoso e imagenes de referencia. + +Despues de correr el código obtenemos en la carpeta "Exports" un archivo CSV con datos de nuestros pokemons para ser utilizados en otra aplicación si es requerido. + +--- + +# Thanks for staying until the end :D + +--- + +## Useful Resources + +* [PokeAPI: Quickstart](https://pokeapi.co/) +* [Requests Library Documentation: Quickstart](http://docs.python-requests.org/en/master/user/quickstart/) +* [BeautifulSoup Documentation](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) +* [Stack Overflow Python Requests Questions](https://stackoverflow.com/questions/tagged/python-requests) +* [StackOverflow BeautifulSoup Questions](https://stackoverflow.com/questions/tagged/beautifulsoup) diff --git a/Untitled.ipynb b/Untitled.ipynb deleted file mode 100644 index 7f0300b..0000000 --- a/Untitled.ipynb +++ /dev/null @@ -1,139 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "import requests" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "url = 'https://pokeapi.co/api/v2/pokemon-form/'" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "response = requests.get(url)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def get_pokemons(url='https://pokeapi.co/api/v2/pokemon-form/', offset = 0):\n", - " args = {'offset': offset} if offset else[]\n", - " response.status_code == 200" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "bulbasaur\n", - "ivysaur\n", - "venusaur\n", - "charmander\n", - "charmeleon\n", - "charizard\n", - "squirtle\n", - "wartortle\n", - "blastoise\n", - "caterpie\n", - "metapod\n", - "butterfree\n", - "weedle\n", - "kakuna\n", - "beedrill\n", - "pidgey\n", - "pidgeotto\n", - "pidgeot\n", - "rattata\n", - "raticate\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Continua? y\n" - ] - }, - { - "ename": "NameError", - "evalue": "name 'offset' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[0msiguiente\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Continua?'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0msiguiente\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'y'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 16\u001b[1;33m \u001b[0mget_pokemons\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0moffset\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0moffset\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m20\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;31mNameError\u001b[0m: name 'offset' is not defined" - ] - } - ], - "source": [ - "def get_pokemons(url='https://pokeapi.co/api/v2/pokemon-form/', offset = 0):\n", - " args = {'offset': offset} if offset else[]\n", - " \n", - " response = requests.get(url, params=args)\n", - "\n", - "if response.status_code == 200:\n", - " payload = response.json()\n", - " results = payload.get('results', [])\n", - " \n", - " if results:\n", - " for pokemon in results:\n", - " name = pokemon['name']\n", - " print(name)\n", - " siguiente = input('Continua?')\n", - " if siguiente == 'y':\n", - " get_pokemons(offset= offset+20)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/Untitled1.ipynb b/Untitled1.ipynb deleted file mode 100644 index 1b6b682..0000000 --- a/Untitled1.ipynb +++ /dev/null @@ -1,1564 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "import json\n", - "import requests\n", - "import pandas as pd\n", - "from pandas.io.json import json_normalize\n", - "from urllib.request import urlopen" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "url = 'https://www.zalando.fr/api/catalog/articles?categories=promo-homme&limit=84&offset=60'" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":9: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data = json_normalize(results)\n" - ] - } - ], - "source": [ - "df=pd.DataFrame()\n", - "\n", - "\n", - "url = 'https://pokeapi.co/api/v2/pokemon/1/'\n", - "response = requests.get(url)\n", - "results = response.json()\n", - " \n", - " \n", - "flattened_data = json_normalize(results)\n", - " #flattened_data1 = json_normalize(flattened_data.articles[0])\n", - " #flattened_data1=flattened_data1.set_index('sku')\n", - "df = df.append(flattened_data)" - ] - }, - { - "cell_type": "code", - "execution_count": 171, - "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", - " \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", - " \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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
4[{'ability': {'name': 'blaze', 'url': 'https:/...62[{'name': 'charmander', 'url': 'https://pokeap...[{'game_index': 176, 'version': {'name': 'red'...6[]4Truehttps://pokeapi.co/api/v2/pokemon/4/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
5[{'ability': {'name': 'blaze', 'url': 'https:/...142[{'name': 'charmeleon', 'url': 'https://pokeap...[{'game_index': 178, 'version': {'name': 'red'...11[]5Truehttps://pokeapi.co/api/v2/pokemon/5/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
6[{'ability': {'name': 'blaze', 'url': 'https:/...240[{'name': 'charizard', 'url': 'https://pokeapi...[{'game_index': 180, 'version': {'name': 'red'...17[]6Truehttps://pokeapi.co/api/v2/pokemon/6/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
7[{'ability': {'name': 'torrent', 'url': 'https...63[{'name': 'squirtle', 'url': 'https://pokeapi....[{'game_index': 177, 'version': {'name': 'red'...5[]7Truehttps://pokeapi.co/api/v2/pokemon/7/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
8[{'ability': {'name': 'torrent', 'url': 'https...142[{'name': 'wartortle', 'url': 'https://pokeapi...[{'game_index': 179, 'version': {'name': 'red'...10[]8Truehttps://pokeapi.co/api/v2/pokemon/8/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
9[{'ability': {'name': 'torrent', 'url': 'https...239[{'name': 'blastoise', 'url': 'https://pokeapi...[{'game_index': 28, 'version': {'name': 'red',...16[]9Truehttps://pokeapi.co/api/v2/pokemon/9/encounters[{'move': {'name': 'mega-punch', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
10[{'ability': {'name': 'shield-dust', 'url': 'h...39[{'name': 'caterpie', 'url': 'https://pokeapi....[{'game_index': 123, 'version': {'name': 'red'...3[]10Truehttps://pokeapi.co/api/v2/pokemon/10/encounters[{'move': {'name': 'tackle', 'url': 'https://p......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
\n", - "

10 rows × 115 columns

\n", - "
" - ], - "text/plain": [ - " abilities base_experience \\\n", - "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", - "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", - "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", - "4 [{'ability': {'name': 'blaze', 'url': 'https:/... 62 \n", - "5 [{'ability': {'name': 'blaze', 'url': 'https:/... 142 \n", - "6 [{'ability': {'name': 'blaze', 'url': 'https:/... 240 \n", - "7 [{'ability': {'name': 'torrent', 'url': 'https... 63 \n", - "8 [{'ability': {'name': 'torrent', 'url': 'https... 142 \n", - "9 [{'ability': {'name': 'torrent', 'url': 'https... 239 \n", - "10 [{'ability': {'name': 'shield-dust', 'url': 'h... 39 \n", - "\n", - " forms \\\n", - "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", - "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", - "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", - "4 [{'name': 'charmander', 'url': 'https://pokeap... \n", - "5 [{'name': 'charmeleon', 'url': 'https://pokeap... \n", - "6 [{'name': 'charizard', 'url': 'https://pokeapi... \n", - "7 [{'name': 'squirtle', 'url': 'https://pokeapi.... \n", - "8 [{'name': 'wartortle', 'url': 'https://pokeapi... \n", - "9 [{'name': 'blastoise', 'url': 'https://pokeapi... \n", - "10 [{'name': 'caterpie', 'url': 'https://pokeapi.... \n", - "\n", - " game_indices height held_items id \\\n", - "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", - "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", - "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", - "4 [{'game_index': 176, 'version': {'name': 'red'... 6 [] 4 \n", - "5 [{'game_index': 178, 'version': {'name': 'red'... 11 [] 5 \n", - "6 [{'game_index': 180, 'version': {'name': 'red'... 17 [] 6 \n", - "7 [{'game_index': 177, 'version': {'name': 'red'... 5 [] 7 \n", - "8 [{'game_index': 179, 'version': {'name': 'red'... 10 [] 8 \n", - "9 [{'game_index': 28, 'version': {'name': 'red',... 16 [] 9 \n", - "10 [{'game_index': 123, 'version': {'name': 'red'... 3 [] 10 \n", - "\n", - " is_default location_area_encounters \\\n", - "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", - "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", - "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", - "4 True https://pokeapi.co/api/v2/pokemon/4/encounters \n", - "5 True https://pokeapi.co/api/v2/pokemon/5/encounters \n", - "6 True https://pokeapi.co/api/v2/pokemon/6/encounters \n", - "7 True https://pokeapi.co/api/v2/pokemon/7/encounters \n", - "8 True https://pokeapi.co/api/v2/pokemon/8/encounters \n", - "9 True https://pokeapi.co/api/v2/pokemon/9/encounters \n", - "10 True https://pokeapi.co/api/v2/pokemon/10/encounters \n", - "\n", - " moves ... \\\n", - "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", - "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "4 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "5 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "6 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "7 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "8 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "9 [{'move': {'name': 'mega-punch', 'url': 'https... ... \n", - "10 [{'move': {'name': 'tackle', 'url': 'https://p... ... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 None \n", - "5 None \n", - "6 None \n", - "7 None \n", - "8 None \n", - "9 None \n", - "10 None \n", - "\n", - " sprites.versions.generation-vii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_female \\\n", - "1 None \n", - "2 None \n", - "3 None \n", - "4 None \n", - "5 None \n", - "6 None \n", - "7 None \n", - "8 None \n", - "9 None \n", - "10 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 None \n", - "5 None \n", - "6 None \n", - "7 None \n", - "8 None \n", - "9 None \n", - "10 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 None \n", - "5 None \n", - "6 None \n", - "7 None \n", - "8 None \n", - "9 None \n", - "10 None \n", - "\n", - " sprites.versions.generation-viii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "4 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "5 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "6 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "7 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "8 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "9 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "10 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_female \n", - "1 None \n", - "2 None \n", - "3 None \n", - "4 None \n", - "5 None \n", - "6 None \n", - "7 None \n", - "8 None \n", - "9 None \n", - "10 None \n", - "\n", - "[10 rows x 115 columns]" - ] - }, - "execution_count": 171, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df" - ] - }, - { - "cell_type": "code", - "execution_count": 174, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'name': 'bulbasaur', 'url': 'https://pokeapi.co/api/v2/pokemon-form/1/'}" - ] - }, - "execution_count": 174, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['forms'][1][0]" - ] - }, - { - "cell_type": "code", - "execution_count": 183, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'name': 'charizard', 'url': 'https://pokeapi.co/api/v2/pokemon-form/6/'}" - ] - }, - "execution_count": 183, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['forms'][6][0]" - ] - }, - { - "cell_type": "code", - "execution_count": 206, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data = json_normalize(results)\n" - ] - } - ], - "source": [ - "df3=pd.DataFrame()\n", - "\n", - "\n", - "for i in range(1,11):\n", - " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", - " response = requests.get(url)\n", - " results = response.json()\n", - " \n", - " \n", - " flattened_data = json_normalize(results)\n", - " \n", - " df3 = df3.append(flattened_data)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 210, - "metadata": {}, - "outputs": [], - "source": [ - "df3.index = np.arange(1,len(df3)+1)" - ] - }, - { - "cell_type": "code", - "execution_count": 211, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['form_name', 'form_names', 'form_order', 'id', 'is_battle_only',\n", - " 'is_default', 'is_mega', 'name', 'names', 'order', 'types',\n", - " 'pokemon.name', 'pokemon.url', 'sprites.back_default',\n", - " 'sprites.back_female', 'sprites.back_shiny',\n", - " 'sprites.back_shiny_female', 'sprites.front_default',\n", - " 'sprites.front_female', 'sprites.front_shiny',\n", - " 'sprites.front_shiny_female', 'version_group.name',\n", - " 'version_group.url'],\n", - " dtype='object')" - ] - }, - "execution_count": 211, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df3.columns" - ] - }, - { - "cell_type": "code", - "execution_count": 212, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", - "2 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", - "3 [{'slot': 1, 'type': {'name': 'grass', 'url': ...\n", - "4 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", - "5 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", - "6 [{'slot': 1, 'type': {'name': 'fire', 'url': '...\n", - "7 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", - "8 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", - "9 [{'slot': 1, 'type': {'name': 'water', 'url': ...\n", - "10 [{'slot': 1, 'type': {'name': 'bug', 'url': 'h...\n", - "Name: types, dtype: object" - ] - }, - "execution_count": 212, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df3['types']" - ] - }, - { - "cell_type": "code", - "execution_count": 215, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['grass',\n", - " 'grass',\n", - " 'grass',\n", - " 'fire',\n", - " 'fire',\n", - " 'fire',\n", - " 'water',\n", - " 'water',\n", - " 'water',\n", - " 'bug']" - ] - }, - "execution_count": 215, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "type = [df3['types'][i][0]['type']['name'] for i in range(1,11)]\n", - "type" - ] - }, - { - "cell_type": "code", - "execution_count": 93, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data = json_normalize(results)\n" - ] - } - ], - "source": [ - "df=pd.DataFrame()\n", - "\n", - "\n", - "for i in range(1,11):\n", - " url = f'https://pokeapi.co/api/v2/pokemon-form/6/'\n", - " response = requests.get(url)\n", - " results = response.json()\n", - " \n", - " \n", - " flattened_data = json_normalize(results)\n", - " #flattened_data = flattened_data.set_index('id')\n", - " df = df.append(flattened_data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": {}, - "outputs": [], - "source": [ - "df.index = np.arange(1,len(df)+1)" - ] - }, - { - "cell_type": "code", - "execution_count": 109, - "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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
abilitiesbase_experienceformsgame_indicesheightheld_itemsidis_defaultlocation_area_encountersmoves...sprites.versions.generation-vi.x-y.front_shinysprites.versions.generation-vi.x-y.front_shiny_femalesprites.versions.generation-vii.icons.front_defaultsprites.versions.generation-vii.icons.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_defaultsprites.versions.generation-vii.ultra-sun-ultra-moon.front_femalesprites.versions.generation-vii.ultra-sun-ultra-moon.front_shinysprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_femalesprites.versions.generation-viii.icons.front_defaultsprites.versions.generation-viii.icons.front_female
1[{'ability': {'name': 'overgrow', 'url': 'http...64[{'name': 'bulbasaur', 'url': 'https://pokeapi...[{'game_index': 153, 'version': {'name': 'red'...7[]1Truehttps://pokeapi.co/api/v2/pokemon/1/encounters[{'move': {'name': 'razor-wind', 'url': 'https......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
2[{'ability': {'name': 'overgrow', 'url': 'http...142[{'name': 'ivysaur', 'url': 'https://pokeapi.c...[{'game_index': 9, 'version': {'name': 'red', ...10[]2Truehttps://pokeapi.co/api/v2/pokemon/2/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...None
3[{'ability': {'name': 'overgrow', 'url': 'http...236[{'name': 'venusaur', 'url': 'https://pokeapi....[{'game_index': 154, 'version': {'name': 'red'...20[]3Truehttps://pokeapi.co/api/v2/pokemon/3/encounters[{'move': {'name': 'swords-dance', 'url': 'htt......https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...None
\n", - "

3 rows × 115 columns

\n", - "
" - ], - "text/plain": [ - " abilities base_experience \\\n", - "1 [{'ability': {'name': 'overgrow', 'url': 'http... 64 \n", - "2 [{'ability': {'name': 'overgrow', 'url': 'http... 142 \n", - "3 [{'ability': {'name': 'overgrow', 'url': 'http... 236 \n", - "\n", - " forms \\\n", - "1 [{'name': 'bulbasaur', 'url': 'https://pokeapi... \n", - "2 [{'name': 'ivysaur', 'url': 'https://pokeapi.c... \n", - "3 [{'name': 'venusaur', 'url': 'https://pokeapi.... \n", - "\n", - " game_indices height held_items id \\\n", - "1 [{'game_index': 153, 'version': {'name': 'red'... 7 [] 1 \n", - "2 [{'game_index': 9, 'version': {'name': 'red', ... 10 [] 2 \n", - "3 [{'game_index': 154, 'version': {'name': 'red'... 20 [] 3 \n", - "\n", - " is_default location_area_encounters \\\n", - "1 True https://pokeapi.co/api/v2/pokemon/1/encounters \n", - "2 True https://pokeapi.co/api/v2/pokemon/2/encounters \n", - "3 True https://pokeapi.co/api/v2/pokemon/3/encounters \n", - "\n", - " moves ... \\\n", - "1 [{'move': {'name': 'razor-wind', 'url': 'https... ... \n", - "2 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "3 [{'move': {'name': 'swords-dance', 'url': 'htt... ... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vi.x-y.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.icons.front_female \\\n", - "1 None \n", - "2 None \n", - "3 None \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-vii.ultra-sun-ultra-moon.front_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.versions.generation-viii.icons.front_female \n", - "1 None \n", - "2 None \n", - "3 None \n", - "\n", - "[3 rows x 115 columns]" - ] - }, - "execution_count": 109, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": {}, - "outputs": [], - "source": [ - "nombres = [df['forms'][i][0]['name'] for i in range(1,11)]" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['bulbasaur',\n", - " 'ivysaur',\n", - " 'venusaur',\n", - " 'charmander',\n", - " 'charmeleon',\n", - " 'charizard',\n", - " 'squirtle',\n", - " 'wartortle',\n", - " 'blastoise',\n", - " 'caterpie']" - ] - }, - "execution_count": 83, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "nombres" - ] - }, - { - "cell_type": "code", - "execution_count": 143, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" - ] - }, - "execution_count": 143, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ids = [df['id'][i] for i in range(1,11)]\n", - "ids" - ] - }, - { - "cell_type": "code", - "execution_count": 107, - "metadata": {}, - "outputs": [], - "source": [ - "#df['game_indices'][1]" - ] - }, - { - "cell_type": "code", - "execution_count": 115, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['razor-wind',\n", - " 'swords-dance',\n", - " 'swords-dance',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'mega-punch',\n", - " 'tackle']" - ] - }, - "execution_count": 115, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "attacks = [df['moves'][i][0]['move']['name'] for i in range(1,11)]\n", - "attacks" - ] - }, - { - "cell_type": "code", - "execution_count": 118, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'name': 'razor-wind', 'url': 'https://pokeapi.co/api/v2/move/13/'}" - ] - }, - "execution_count": 118, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['moves'][1][0]['move']" - ] - }, - { - "cell_type": "code", - "execution_count": 156, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/1.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/2.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/3.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/4.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/5.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/6.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/7.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/8.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/9.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/10.png']" - ] - }, - "execution_count": 156, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links_imagenes = [df['sprites.versions.generation-vi.x-y.front_shiny'][i] for i in range(1,11)]\n", - "links_imagenes" - ] - }, - { - "cell_type": "code", - "execution_count": 160, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'https://pokeapi.co/api/v2/pokemon-form/10/'" - ] - }, - "execution_count": 160, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links_imagenes_vta = df['forms'][i][0]['url']\n", - "links_imagenes_vta" - ] - }, - { - "cell_type": "code", - "execution_count": 161, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":10: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead\n", - " flattened_data2 = json_normalize(results)\n" - ] - } - ], - "source": [ - "df2=pd.DataFrame()\n", - "\n", - "\n", - "for i in range(1,11):\n", - " url = f'https://pokeapi.co/api/v2/pokemon-form/{i}/'\n", - " response = requests.get(url)\n", - " results = response.json()\n", - " \n", - " \n", - " flattened_data2 = json_normalize(results)\n", - " \n", - " df2 = df2.append(flattened_data2)" - ] - }, - { - "cell_type": "code", - "execution_count": 162, - "metadata": {}, - "outputs": [], - "source": [ - "df2.index = np.arange(1,len(df)+1)" - ] - }, - { - "cell_type": "code", - "execution_count": 163, - "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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
form_nameform_namesform_orderidis_battle_onlyis_defaultis_meganamenamesorder...sprites.back_defaultsprites.back_femalesprites.back_shinysprites.back_shiny_femalesprites.front_defaultsprites.front_femalesprites.front_shinysprites.front_shiny_femaleversion_group.nameversion_group.url
1[]11FalseTrueFalsebulbasaur[]1...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
2[]12FalseTrueFalseivysaur[]2...https://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonehttps://raw.githubusercontent.com/PokeAPI/spri...Nonered-bluehttps://pokeapi.co/api/v2/version-group/1/
3[]13FalseTrueFalsevenusaur[]3...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...https://raw.githubusercontent.com/PokeAPI/spri...red-bluehttps://pokeapi.co/api/v2/version-group/1/
\n", - "

3 rows × 23 columns

\n", - "
" - ], - "text/plain": [ - " form_name form_names form_order id is_battle_only is_default is_mega \\\n", - "1 [] 1 1 False True False \n", - "2 [] 1 2 False True False \n", - "3 [] 1 3 False True False \n", - "\n", - " name names order ... \\\n", - "1 bulbasaur [] 1 ... \n", - "2 ivysaur [] 2 ... \n", - "3 venusaur [] 3 ... \n", - "\n", - " sprites.back_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.back_shiny_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_default \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_female \\\n", - "1 None \n", - "2 None \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_shiny \\\n", - "1 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "2 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... \n", - "\n", - " sprites.front_shiny_female version_group.name \\\n", - "1 None red-blue \n", - "2 None red-blue \n", - "3 https://raw.githubusercontent.com/PokeAPI/spri... red-blue \n", - "\n", - " version_group.url \n", - "1 https://pokeapi.co/api/v2/version-group/1/ \n", - "2 https://pokeapi.co/api/v2/version-group/1/ \n", - "3 https://pokeapi.co/api/v2/version-group/1/ \n", - "\n", - "[3 rows x 23 columns]" - ] - }, - "execution_count": 163, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df2.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 164, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/2.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/3.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/4.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/5.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/6.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/7.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/8.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/9.png',\n", - " 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png']" - ] - }, - "execution_count": 164, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links_pictures = [df2['sprites.back_default'][i] for i in range(1,11)]\n", - "links_pictures" - ] - }, - { - "cell_type": "code", - "execution_count": 165, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ability': {'name': 'overgrow',\n", - " 'url': 'https://pokeapi.co/api/v2/ability/65/'},\n", - " 'is_hidden': False,\n", - " 'slot': 1}" - ] - }, - "execution_count": 165, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['abilities'][1][0]" - ] - }, - { - "cell_type": "code", - "execution_count": 170, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'move': {'name': 'swords-dance', 'url': 'https://pokeapi.co/api/v2/move/14/'},\n", - " 'version_group_details': [{'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'red-blue',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/1/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'yellow',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/2/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'tutor',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", - " 'version_group': {'name': 'emerald',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/6/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'tutor',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/3/'},\n", - " 'version_group': {'name': 'firered-leafgreen',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/7/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'diamond-pearl',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/8/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'platinum',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/9/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'heartgold-soulsilver',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/10/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'black-white',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/11/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'black-2-white-2',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/14/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'x-y',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/15/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'omega-ruby-alpha-sapphire',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/16/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'sun-moon',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/17/'}},\n", - " {'level_learned_at': 0,\n", - " 'move_learn_method': {'name': 'machine',\n", - " 'url': 'https://pokeapi.co/api/v2/move-learn-method/4/'},\n", - " 'version_group': {'name': 'ultra-sun-ultra-moon',\n", - " 'url': 'https://pokeapi.co/api/v2/version-group/18/'}}]}" - ] - }, - "execution_count": 170, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df['moves'][1][1]" - ] - }, - { - "cell_type": "code", - "execution_count": 153, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/2.png'" - ] - }, - "execution_count": 153, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/main.ipynb b/main.ipynb index 5b9638f..f6997b5 100644 --- a/main.ipynb +++ b/main.ipynb @@ -271,7 +271,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 79, "metadata": {}, "outputs": [ { @@ -280,7 +280,7 @@ "'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/25.png'" ] }, - "execution_count": 75, + "execution_count": 79, "metadata": {}, "output_type": "execute_result" } @@ -925,6 +925,15 @@ "df_pokemon.head(50)" ] }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [], + "source": [ + "df_pokemon.to_csv('Pokemons.csv')" + ] + }, { "cell_type": "code", "execution_count": null, From 65224ff5fdbb2c3bf0618b1f97081fed612559a8 Mon Sep 17 00:00:00 2001 From: herguejuan Date: Sat, 22 May 2021 05:56:35 -0500 Subject: [PATCH 3/3] Updating README.md file --- README .md | 23 +++++++++++------------ main.ipynb | 4 ++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README .md b/README .md index cc905d9..7f5c6e5 100644 --- a/README .md +++ b/README .md @@ -4,34 +4,33 @@ ## Overview: Data Extraction of PokeAPI -Para este proyecto se consultó una API basada en la serie de televisión "Pokemon" donde se realizó -la busqueda de información a travéz de diferentes archivos JSON para obtener los datos precisos -que ocupabamos en el DataFrame para despues exportar los datos a un archovo de csv. +Para este proyecto se consultó una API basada en la serie de televisión "Pokemon" donde el objetivo era encontrar información de: Número de Pokemon, Nombre,Tipo, Ataque poderoso e imagenes de referencia. -La búsqueda de los pokemons fué complicada pero se lograron capturar a todos con todo y fotografías!! +La busqueda de información se llevó acabo a travéz de diferentes archivos JSON para reunirla todo en un DataFrame y despues poder exportar los datos. Por ejemplo en un archivo .csv +La búsqueda de los pokemons fué complicada ;) ... pero se lograron capturar a todos!! :D --- ## Deliverables -**A Jupyter Notebook (.ipynb) file** -**An output folder** -**A README.md file (it's this File)** +* **A Jupyter Notebook (.ipynb) file** +* **An output folder** +* **A README.md file (it's this File)** --- ## Detailed Explanation -En éste archivo Jupyter Notebook encontramos un código que nos permiten navegar a travéz de -diferentes URL almacenadas en un archivo JSON para posterior crear un DataFrame de la -información específica que necesitamos acerca nuestros Pokemons, datos como: Número de Pokemon, Nombre,Tipo, Ataque poderoso e imagenes de referencia. +En el archivo Jupyter Notebook hacemos uso de librerías como: requests, json, numpy, pandas, etc. +para timbrar diferentes URL de la PokeAPI, realizando métodos de extracción y usando listas de comprensión para almacenar los datos y con ayuda de un DataFrame reunir todas las listas obtenidas. + +Por último, ya que tenemos el DataFrame final se exportaron los archivos a un archivo .csv en la carpeta Exports del repositorio. -Despues de correr el código obtenemos en la carpeta "Exports" un archivo CSV con datos de nuestros pokemons para ser utilizados en otra aplicación si es requerido. --- -# Thanks for staying until the end :D +# Thanks for watching to the end :D --- diff --git a/main.ipynb b/main.ipynb index f6997b5..f8a2bad 100644 --- a/main.ipynb +++ b/main.ipynb @@ -927,11 +927,11 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 83, "metadata": {}, "outputs": [], "source": [ - "df_pokemon.to_csv('Pokemons.csv')" + "df_pokemon.to_csv('Exports/Pokemons.csv')" ] }, {