{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Descarga de datos"
      ],
      "metadata": {
        "id": "LrkD-O27_uMb"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from google.colab import output\n",
        "!pip install gdown\n",
        "!gdown https://drive.google.com/uc?id=1L5kNJEwRRlNtBvXVt4KZB0EiTQk23iaV # pokedex_processed.csv\n",
        "!gdown https://drive.google.com/uc?id=19dw2vVgF6pht_-GF5_IvxrVLOSkT8kCQ # pokedex_processed.json\n",
        "output.clear()"
      ],
      "metadata": {
        "id": "49NvaucrxgAx"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Datos\n",
        "\n",
        "Los datos corresponden al mundo de _Pokémon_ separado en dos bases de datos: Una relacional SQL (PostgreSQL) y otra de documentos NoSQL (MongoDB). Ambas son levantadas dentro del entorno de ejecución del notebook en Google Colab.\n",
        "\n",
        "A continuación se crea y describe a cada una:"
      ],
      "metadata": {
        "id": "91HdJj2_njyA"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# PostgreSQL\n",
        "\n",
        "Cada columna de la tabla de pokedex se describe a continuación:\n",
        "\n",
        "```text\n",
        "###################\n",
        "## Tabla pokedex ##\n",
        "###################\n",
        "\n",
        "Id           : (int) Identificador único en el Pokédex\n",
        "Name         : (str) Nombre del Pokémon\n",
        "Category     : (str) La \"especie\" del Pokémon (en Pokémon Sol y Luna)\n",
        "Height (m)   : (int) Altura en metros\n",
        "Weight (kg)  : (int) Masa en kilogramos\n",
        "Capture Rate : (int) Cuantifica la probabilidad de capturar al Pokémon (a mayor valor, más probable).\n",
        "Egg Steps    : (int) Cuantifica el número de pasos que requiere en el juego para salir de un huevo.\n",
        "Exp Group    : (str) Categoría que determina cuanta experiencia necesita para subir de nivel.\n",
        "HP           : (int) Vida\n",
        "Attack       : (int) Ataque\n",
        "Defense      : (int) Defensa\n",
        "Sp. Attack   : (int) Ataque Especial\n",
        "Sp. Defense  : (int) Defensa Especial\n",
        "Speed        : (int) Velocidad\n",
        "\n",
        "```"
      ],
      "metadata": {
        "id": "rzyH3vy1vmAr"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "id": "Gy0QSzg_nLyx"
      },
      "outputs": [],
      "source": [
        "# install\n",
        "!apt update\n",
        "!apt install postgresql postgresql-contrib &>log\n",
        "!service postgresql start\n",
        "!sudo -u postgres psql -c \"CREATE USER root WITH SUPERUSER\"\n",
        "# pin package versions for google colab compatibility\n",
        "!pip install SQLAlchemy==1.4.46\n",
        "!pip install ipython-sql==0.4.1\n",
        "# set connection\n",
        "%load_ext sql\n",
        "%config SqlMagic.feedback=False\n",
        "%config SqlMagic.autopandas=True\n",
        "%config SqlMagic.displaycon = False\n",
        "%sql postgresql+psycopg2://@/postgres\n",
        "output.clear()"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd\n",
        "from sqlalchemy import create_engine\n",
        "engine = create_engine(\"postgresql+psycopg2://@/postgres\", echo=False)\n",
        "df_pokedex = pd.read_csv(\"pokedex_processed.csv\", index_col=False)\n",
        "df_pokedex.to_sql(\"pokedex\", con=engine, if_exists=\"replace\", index=False)"
      ],
      "metadata": {
        "id": "5vJcpsIhT3NL"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "%%sql\n",
        "SELECT *\n",
        "FROM pokedex\n",
        "LIMIT 10"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 407
        },
        "id": "L_3X_BE4Rr0q",
        "outputId": "e50d918a-8a39-4c93-c7c8-fdf83b080374"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "   Id        Name             Category  Height (m)  Weight (kg)  Capture Rate  \\\n",
              "0   1   Bulbasaur         Seed Pokémon         0.7          6.9            45   \n",
              "1   2     Ivysaur         Seed Pokémon         1.0         13.0            45   \n",
              "2   3    Venusaur         Seed Pokémon         2.0        100.0            45   \n",
              "3   4  Charmander       Lizard Pokémon         0.6          8.5            45   \n",
              "4   5  Charmeleon        Flame Pokémon         1.1         19.0            45   \n",
              "5   6   Charizard        Flame Pokémon         1.7         90.5            45   \n",
              "6   7    Squirtle  Tiny Turtle Pokémon         0.5          9.0            45   \n",
              "7   8   Wartortle       Turtle Pokémon         1.0         22.5            45   \n",
              "8   9   Blastoise    Shellfish Pokémon         1.6         85.5            45   \n",
              "9  10    Caterpie         Worm Pokémon         0.3          2.9           255   \n",
              "\n",
              "   Egg Steps    Exp Group  HP  Attack  Defense  Sp. Attack  Sp. Defense  Speed  \n",
              "0       5120  Medium Slow  45      49       49          65           65     45  \n",
              "1       5120  Medium Slow  60      62       63          80           80     60  \n",
              "2       5120  Medium Slow  80      82       83         100          100     80  \n",
              "3       5120  Medium Slow  39      52       43          60           50     65  \n",
              "4       5120  Medium Slow  58      64       58          80           65     80  \n",
              "5       5120  Medium Slow  78      84       78         109           85    100  \n",
              "6       5120  Medium Slow  44      48       65          50           64     43  \n",
              "7       5120  Medium Slow  59      63       80          65           80     58  \n",
              "8       5120  Medium Slow  79      83      100          85          105     78  \n",
              "9       3840  Medium Fast  45      30       35          20           20     45  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-85129ba8-352d-49dc-929b-51c0947f5cf0\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Id</th>\n",
              "      <th>Name</th>\n",
              "      <th>Category</th>\n",
              "      <th>Height (m)</th>\n",
              "      <th>Weight (kg)</th>\n",
              "      <th>Capture Rate</th>\n",
              "      <th>Egg Steps</th>\n",
              "      <th>Exp Group</th>\n",
              "      <th>HP</th>\n",
              "      <th>Attack</th>\n",
              "      <th>Defense</th>\n",
              "      <th>Sp. Attack</th>\n",
              "      <th>Sp. Defense</th>\n",
              "      <th>Speed</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>Bulbasaur</td>\n",
              "      <td>Seed Pokémon</td>\n",
              "      <td>0.7</td>\n",
              "      <td>6.9</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>45</td>\n",
              "      <td>49</td>\n",
              "      <td>49</td>\n",
              "      <td>65</td>\n",
              "      <td>65</td>\n",
              "      <td>45</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2</td>\n",
              "      <td>Ivysaur</td>\n",
              "      <td>Seed Pokémon</td>\n",
              "      <td>1.0</td>\n",
              "      <td>13.0</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>60</td>\n",
              "      <td>62</td>\n",
              "      <td>63</td>\n",
              "      <td>80</td>\n",
              "      <td>80</td>\n",
              "      <td>60</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>3</td>\n",
              "      <td>Venusaur</td>\n",
              "      <td>Seed Pokémon</td>\n",
              "      <td>2.0</td>\n",
              "      <td>100.0</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>80</td>\n",
              "      <td>82</td>\n",
              "      <td>83</td>\n",
              "      <td>100</td>\n",
              "      <td>100</td>\n",
              "      <td>80</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>4</td>\n",
              "      <td>Charmander</td>\n",
              "      <td>Lizard Pokémon</td>\n",
              "      <td>0.6</td>\n",
              "      <td>8.5</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>39</td>\n",
              "      <td>52</td>\n",
              "      <td>43</td>\n",
              "      <td>60</td>\n",
              "      <td>50</td>\n",
              "      <td>65</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>5</td>\n",
              "      <td>Charmeleon</td>\n",
              "      <td>Flame Pokémon</td>\n",
              "      <td>1.1</td>\n",
              "      <td>19.0</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>58</td>\n",
              "      <td>64</td>\n",
              "      <td>58</td>\n",
              "      <td>80</td>\n",
              "      <td>65</td>\n",
              "      <td>80</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>6</td>\n",
              "      <td>Charizard</td>\n",
              "      <td>Flame Pokémon</td>\n",
              "      <td>1.7</td>\n",
              "      <td>90.5</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>78</td>\n",
              "      <td>84</td>\n",
              "      <td>78</td>\n",
              "      <td>109</td>\n",
              "      <td>85</td>\n",
              "      <td>100</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>7</td>\n",
              "      <td>Squirtle</td>\n",
              "      <td>Tiny Turtle Pokémon</td>\n",
              "      <td>0.5</td>\n",
              "      <td>9.0</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>44</td>\n",
              "      <td>48</td>\n",
              "      <td>65</td>\n",
              "      <td>50</td>\n",
              "      <td>64</td>\n",
              "      <td>43</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>8</td>\n",
              "      <td>Wartortle</td>\n",
              "      <td>Turtle Pokémon</td>\n",
              "      <td>1.0</td>\n",
              "      <td>22.5</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>59</td>\n",
              "      <td>63</td>\n",
              "      <td>80</td>\n",
              "      <td>65</td>\n",
              "      <td>80</td>\n",
              "      <td>58</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>9</td>\n",
              "      <td>Blastoise</td>\n",
              "      <td>Shellfish Pokémon</td>\n",
              "      <td>1.6</td>\n",
              "      <td>85.5</td>\n",
              "      <td>45</td>\n",
              "      <td>5120</td>\n",
              "      <td>Medium Slow</td>\n",
              "      <td>79</td>\n",
              "      <td>83</td>\n",
              "      <td>100</td>\n",
              "      <td>85</td>\n",
              "      <td>105</td>\n",
              "      <td>78</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>10</td>\n",
              "      <td>Caterpie</td>\n",
              "      <td>Worm Pokémon</td>\n",
              "      <td>0.3</td>\n",
              "      <td>2.9</td>\n",
              "      <td>255</td>\n",
              "      <td>3840</td>\n",
              "      <td>Medium Fast</td>\n",
              "      <td>45</td>\n",
              "      <td>30</td>\n",
              "      <td>35</td>\n",
              "      <td>20</td>\n",
              "      <td>20</td>\n",
              "      <td>45</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-85129ba8-352d-49dc-929b-51c0947f5cf0')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-85129ba8-352d-49dc-929b-51c0947f5cf0 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-85129ba8-352d-49dc-929b-51c0947f5cf0');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## MongoDB\n",
        "\n",
        "La colección pokedex tiene documentos con 4 entradas: Un identificador único del pokémon y arreglos con información acerca del mismo. A continuación se detalla cada uno:\n",
        "\n",
        "```text\n",
        "#######################\n",
        "## Colección pokedex ##\n",
        "#######################\n",
        "\n",
        "\"pokemon_id\": : (int)       Número identificador único en el Pokédex\n",
        "\"abilities\"   : (List[str]) Lista de las habilidades del Pokémon\n",
        "\"moves\"       : (List[str]) Lista de los movimientos del Pokémon\n",
        "\"types\"       : (List[str]) Lista de los tipos del Pokémon\n",
        "```"
      ],
      "metadata": {
        "id": "2eJi_0kxYgZ5"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!apt install mongodb\n",
        "!service mongodb start\n",
        "!pip install pymongo\n",
        "!mongoimport --db local --collection pokedex --jsonArray < 'pokedex_processed.json'\n",
        "output.clear()"
      ],
      "metadata": {
        "id": "t1x82tUDbzFP"
      },
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from pymongo import MongoClient\n",
        "client = MongoClient()\n",
        "client.list_database_names() # ['admin', 'local']\n",
        "db = client['local']\n",
        "collection = db['pokedex']"
      ],
      "metadata": {
        "id": "nsfUhP4tdbjG"
      },
      "execution_count": 7,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Para tener una idea de cómo se ven los datos en la colección, aquí les dejamos impresión del primer Pokemon en la colección:"
      ],
      "metadata": {
        "id": "NVePaOEVbVXN"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import pprint\n",
        "for pokemon in collection.find({}).limit(1):\n",
        "    pprint.pprint(pokemon)"
      ],
      "metadata": {
        "id": "hbvueZMVva62",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "8df6b60b-8738-4854-c67d-85bb2e5cc5b5"
      },
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{'_id': ObjectId('648a420b82e29c2db100d267'),\n",
            " 'abilities': ['Overgrow', 'Chlorophyll'],\n",
            " 'moves': ['Tackle is described as A physical attack in which the user charges '\n",
            "           'and slams into the target with its whole body.',\n",
            "           'Growl is described as The user growls in an endearing way, making '\n",
            "           'opposing Pokémon less wary. This lowers their Attack stat.',\n",
            "           'Vine Whip is described as The target is struck with slender, '\n",
            "           'whiplike vines to inflict damage.',\n",
            "           'Poison Powder is described as The user scatters a cloud of '\n",
            "           'poisonous dust that poisons the target.',\n",
            "           'Sleep Powder is described as The user scatters a big cloud of '\n",
            "           'sleep-inducing dust around the target.',\n",
            "           'Take Down is described as A reckless, full-body charge attack for '\n",
            "           'slamming into the target. This also damages the user a little.',\n",
            "           'Razor Leaf is described as Sharp-edged leaves are launched to '\n",
            "           'slash at the opposing Pokémon. Critical hits land more easily.',\n",
            "           'Sweet Scent is described as A sweet scent that harshly lowers '\n",
            "           \"opposing Pokémon's evasiveness.\",\n",
            "           \"Growth is described as The user's body grows all at once, raising \"\n",
            "           'the Attack and Sp. Atk stats.',\n",
            "           'Double-Edge is described as A reckless, life-risking tackle. This '\n",
            "           'also damages the user quite a lot.',\n",
            "           'Worry Seed is described as A seed that causes worry is planted on '\n",
            "           \"the target. It prevents sleep by making the target's Ability \"\n",
            "           'Insomnia.',\n",
            "           'Synthesis is described as The user restores its own HP. The amount '\n",
            "           'of HP regained varies with the weather.',\n",
            "           'Seed Bomb is described as The user slams a barrage of hard-shelled '\n",
            "           'seeds down on the target from above.'],\n",
            " 'pokemon_id': 1,\n",
            " 'types': ['Grass', 'Poison']}\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Preguntas\n",
        "\n",
        "Para resolver estas preguntas será necesario que consultes a `PostgreSQL` y/o `MongoDB`.\n",
        "\n",
        "En este `notebook` puedes almacenar el resultado de una consulta `PostgreSQL` en una variable como un `pandas.DataFrame` de la siguiente forma:\n",
        "\n",
        "```python\n",
        "df = %sql SELECT \"Name\" FROM pokedex WHERE \"Id\" = 99;\n",
        "```"
      ],
      "metadata": {
        "id": "oT0-dqCCqset"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 1\n",
        "Entregue el nombre (name) y la cantidad de habilidades (abilites) de los 10 pokemones más pesados en kilogramos"
      ],
      "metadata": {
        "id": "bhpyZHJkqpU-"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "E8jIPueoqqb-"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 2\n",
        "\n",
        "Nombre los 3 pokemones con más movimientos. Se recomienda revisar la documentación de MongoDB, particularmente de [`$sort`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/) y [`$limit`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/)."
      ],
      "metadata": {
        "id": "kkCvJbF7quNQ"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "6dDaoE1HqvFC"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 3\n",
        "\n",
        "Cuál es el elemento de los pokemones más densos? Indique los 5 elementos de pokemones más densos. Asuma que la densidad es el peso dividido en la altura, y que los pokemones tienen un solo tipo (ignore todos los elementos de cada pokemon excepto uno)."
      ],
      "metadata": {
        "id": "byZJFhmOyUDf"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "OM8TSVJeyVQE"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 4\n",
        "\n",
        "Vea si existe alguna correlación entre algún atributo (ataque, defensa, ataque especial, defensa especial, velocidad y HP) y la cantidad de movimientos que tienen los pokemones.\n",
        "\n",
        "Hay algun otro par de variables (de las mencionadas anteriormente) que tengan mayor correlación entre sí? Indique el par de atributos que tengan la mayor correlación entre sí y haga un gráfico de dispersión para visualizar la correlación."
      ],
      "metadata": {
        "id": "2SrvuCWlyYwG"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "kBimnR_hE1xy"
      },
      "execution_count": 1,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Los atributos con mayor correlación son YY y ZZ."
      ],
      "metadata": {
        "id": "OOKCMGPGI0gV"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "FZmGvze__Ytj"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Importante:\n",
        "Para las últimas preguntas será necesario que crees y consultes un índice de texto para el arreglo de strings `moves`."
      ],
      "metadata": {
        "id": "iX3rGsPhx0L9"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Aquí escribe el código para crear el índice de texto\n"
      ],
      "metadata": {
        "id": "sGsiV5cux195"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 5\n",
        "Entregue el nombre de todos los pokemones los cuales en sus movimientos contengan las palabras `fire` y `thunder` y tengan un Ataque Especial (Sp. Attack) entre `110` y `130` (ambos valores incluidos)"
      ],
      "metadata": {
        "id": "RuQdiWyNyarx"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "CiYsZtaiybPR"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Pregunta 6\n",
        "Entregue el nombre junto con la suma de las estadísticas de combate (HP, Attack, Defense, Sp. Attack, Sp. Defense y Speed) de los pokemones que en sus movimientos contengan las palabras `ice`, `freeze`, `snow` o `cold`, **pero no** las palabras `water` y `wind`. Deben estar ordenado alfabéticamente por su nombre."
      ],
      "metadata": {
        "id": "Xh15tdKwyby1"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "Uwssos-aycNj"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}