ium_434695/.ipynb_checkpoints/Zadanie1-checkpoint.ipynb

943 lines
89 KiB
Plaintext
Raw Normal View History

2021-03-21 23:00:03 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "hNYAM1jr8P8v",
"outputId": "318f51a0-e7a8-4d69-86f3-3412ca800459"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/bin/sh: 1: wget: not found\r\n"
]
}
],
"source": [
"!wget -c https://git.wmi.amu.edu.pl/s434695/ium_434695/raw/commit/2301fb86e434734376f73503307a8f3255a75cc6/vgsales.csv\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "l6wJKCw7iqQ8",
"outputId": "91fcfedc-4cdf-4208-9a9e-a02b56b6db83"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pandas in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (1.2.3)\n",
"Requirement already satisfied: pytz>=2017.3 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from pandas) (2021.1)\n",
"Requirement already satisfied: numpy>=1.16.5 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from pandas) (1.20.1)\n",
"Requirement already satisfied: python-dateutil>=2.7.3 in /snap/jupyter/6/lib/python3.7/site-packages (from pandas) (2.8.0)\n",
"Requirement already satisfied: six>=1.5 in /snap/jupyter/6/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas) (1.12.0)\n",
"Requirement already satisfied: scikit-learn in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (0.24.1)\n",
"Requirement already satisfied: numpy>=1.13.3 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from scikit-learn) (1.20.1)\n",
"Requirement already satisfied: joblib>=0.11 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from scikit-learn) (1.0.1)\n",
"Requirement already satisfied: threadpoolctl>=2.0.0 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from scikit-learn) (2.1.0)\n",
"Requirement already satisfied: scipy>=0.19.1 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from scikit-learn) (1.6.1)\n",
"Collecting matplotlib\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/23/3d/db9a6b3c83c9511301152dbb64a029c3a4313c86eaef12c237b13ecf91d6/matplotlib-3.3.4-cp37-cp37m-manylinux1_x86_64.whl (11.5MB)\n",
"\u001b[K |████████████████████████████████| 11.6MB 4.9MB/s eta 0:00:01 |██████████▊ | 3.9MB 1.7MB/s eta 0:00:05\n",
"\u001b[?25hCollecting cycler>=0.10 (from matplotlib)\n",
" Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl\n",
"Collecting kiwisolver>=1.0.1 (from matplotlib)\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/d2/46/231de802ade4225b76b96cffe419cf3ce52bbe92e3b092cf12db7d11c207/kiwisolver-1.3.1-cp37-cp37m-manylinux1_x86_64.whl (1.1MB)\n",
"\u001b[K |████████████████████████████████| 1.1MB 6.1MB/s eta 0:00:01\n",
"\u001b[?25hRequirement already satisfied: numpy>=1.15 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from matplotlib) (1.20.1)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /snap/jupyter/6/lib/python3.7/site-packages (from matplotlib) (2.8.0)\n",
"Requirement already satisfied: pillow>=6.2.0 in /home/tomasz/snap/jupyter/common/lib/python3.7/site-packages (from matplotlib) (8.1.2)\n",
"Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 (from matplotlib)\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67kB)\n",
"\u001b[K |████████████████████████████████| 71kB 5.5MB/s eta 0:00:01\n",
"\u001b[?25hRequirement already satisfied: six in /snap/jupyter/6/lib/python3.7/site-packages (from cycler>=0.10->matplotlib) (1.12.0)\n",
"Installing collected packages: cycler, kiwisolver, pyparsing, matplotlib\n",
"Successfully installed cycler-0.10.0 kiwisolver-1.3.1 matplotlib-3.3.4 pyparsing-2.4.7\n"
]
}
],
"source": [
"!pip install --user pandas\n",
"!pip install --user scikit-learn\n",
"!pip install --user matplotlib"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 493
},
"id": "uXRk5Z4tixiJ",
"outputId": "ed788406-9f0f-418c-93ef-54398dc4613d"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Rank</th>\n",
" <th>Name</th>\n",
" <th>Platform</th>\n",
" <th>Year</th>\n",
" <th>Genre</th>\n",
" <th>Publisher</th>\n",
" <th>NA_Sales</th>\n",
" <th>EU_Sales</th>\n",
" <th>JP_Sales</th>\n",
" <th>Other_Sales</th>\n",
" <th>Global_Sales</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>Wii Sports</td>\n",
" <td>Wii</td>\n",
" <td>2006.0</td>\n",
" <td>Sports</td>\n",
" <td>Nintendo</td>\n",
" <td>41.49</td>\n",
" <td>29.02</td>\n",
" <td>3.77</td>\n",
" <td>8.46</td>\n",
" <td>82.74</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Super Mario Bros.</td>\n",
" <td>NES</td>\n",
" <td>1985.0</td>\n",
" <td>Platform</td>\n",
" <td>Nintendo</td>\n",
" <td>29.08</td>\n",
" <td>3.58</td>\n",
" <td>6.81</td>\n",
" <td>0.77</td>\n",
" <td>40.24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>Mario Kart Wii</td>\n",
" <td>Wii</td>\n",
" <td>2008.0</td>\n",
" <td>Racing</td>\n",
" <td>Nintendo</td>\n",
" <td>15.85</td>\n",
" <td>12.88</td>\n",
" <td>3.79</td>\n",
" <td>3.31</td>\n",
" <td>35.82</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>Wii Sports Resort</td>\n",
" <td>Wii</td>\n",
" <td>2009.0</td>\n",
" <td>Sports</td>\n",
" <td>Nintendo</td>\n",
" <td>15.75</td>\n",
" <td>11.01</td>\n",
" <td>3.28</td>\n",
" <td>2.96</td>\n",
" <td>33.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Pokemon Red/Pokemon Blue</td>\n",
" <td>GB</td>\n",
" <td>1996.0</td>\n",
" <td>Role-Playing</td>\n",
" <td>Nintendo</td>\n",
" <td>11.27</td>\n",
" <td>8.89</td>\n",
" <td>10.22</td>\n",
" <td>1.00</td>\n",
" <td>31.37</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16593</th>\n",
" <td>16596</td>\n",
" <td>Woody Woodpecker in Crazy Castle 5</td>\n",
" <td>GBA</td>\n",
" <td>2002.0</td>\n",
" <td>Platform</td>\n",
" <td>Kemco</td>\n",
" <td>0.01</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16594</th>\n",
" <td>16597</td>\n",
" <td>Men in Black II: Alien Escape</td>\n",
" <td>GC</td>\n",
" <td>2003.0</td>\n",
" <td>Shooter</td>\n",
" <td>Infogrames</td>\n",
" <td>0.01</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16595</th>\n",
" <td>16598</td>\n",
" <td>SCORE International Baja 1000: The Official Game</td>\n",
" <td>PS2</td>\n",
" <td>2008.0</td>\n",
" <td>Racing</td>\n",
" <td>Activision</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16596</th>\n",
" <td>16599</td>\n",
" <td>Know How 2</td>\n",
" <td>DS</td>\n",
" <td>2010.0</td>\n",
" <td>Puzzle</td>\n",
" <td>7G//AMES</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16597</th>\n",
" <td>16600</td>\n",
" <td>Spirits &amp; Spells</td>\n",
" <td>GBA</td>\n",
" <td>2003.0</td>\n",
" <td>Platform</td>\n",
" <td>Wanadoo</td>\n",
" <td>0.01</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.01</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>16598 rows × 11 columns</p>\n",
"</div>"
],
"text/plain": [
" Rank Name Platform \\\n",
"0 1 Wii Sports Wii \n",
"1 2 Super Mario Bros. NES \n",
"2 3 Mario Kart Wii Wii \n",
"3 4 Wii Sports Resort Wii \n",
"4 5 Pokemon Red/Pokemon Blue GB \n",
"... ... ... ... \n",
"16593 16596 Woody Woodpecker in Crazy Castle 5 GBA \n",
"16594 16597 Men in Black II: Alien Escape GC \n",
"16595 16598 SCORE International Baja 1000: The Official Game PS2 \n",
"16596 16599 Know How 2 DS \n",
"16597 16600 Spirits & Spells GBA \n",
"\n",
" Year Genre Publisher NA_Sales EU_Sales JP_Sales \\\n",
"0 2006.0 Sports Nintendo 41.49 29.02 3.77 \n",
"1 1985.0 Platform Nintendo 29.08 3.58 6.81 \n",
"2 2008.0 Racing Nintendo 15.85 12.88 3.79 \n",
"3 2009.0 Sports Nintendo 15.75 11.01 3.28 \n",
"4 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 \n",
"... ... ... ... ... ... ... \n",
"16593 2002.0 Platform Kemco 0.01 0.00 0.00 \n",
"16594 2003.0 Shooter Infogrames 0.01 0.00 0.00 \n",
"16595 2008.0 Racing Activision 0.00 0.00 0.00 \n",
"16596 2010.0 Puzzle 7G//AMES 0.00 0.01 0.00 \n",
"16597 2003.0 Platform Wanadoo 0.01 0.00 0.00 \n",
"\n",
" Other_Sales Global_Sales \n",
"0 8.46 82.74 \n",
"1 0.77 40.24 \n",
"2 3.31 35.82 \n",
"3 2.96 33.00 \n",
"4 1.00 31.37 \n",
"... ... ... \n",
"16593 0.00 0.01 \n",
"16594 0.00 0.01 \n",
"16595 0.00 0.01 \n",
"16596 0.00 0.01 \n",
"16597 0.00 0.01 \n",
"\n",
"[16598 rows x 11 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"vgsales = pd.read_csv('vgsales.csv')\n",
"vgsales"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 484
},
"id": "Ymp2F4Cdj9XP",
"outputId": "9096c32c-1392-4817-fdd8-035dc4a0176a"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Rank</th>\n",
" <th>Name</th>\n",
" <th>Platform</th>\n",
" <th>Year</th>\n",
" <th>Genre</th>\n",
" <th>Publisher</th>\n",
" <th>NA_Sales</th>\n",
" <th>EU_Sales</th>\n",
" <th>JP_Sales</th>\n",
" <th>Other_Sales</th>\n",
" <th>Global_Sales</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>16598.000000</td>\n",
" <td>16598</td>\n",
" <td>16598</td>\n",
" <td>16327.000000</td>\n",
" <td>16598</td>\n",
" <td>16540</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" <td>16598.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>unique</th>\n",
" <td>NaN</td>\n",
" <td>11493</td>\n",
" <td>31</td>\n",
" <td>NaN</td>\n",
" <td>12</td>\n",
" <td>578</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>top</th>\n",
" <td>NaN</td>\n",
" <td>Need for Speed: Most Wanted</td>\n",
" <td>DS</td>\n",
" <td>NaN</td>\n",
" <td>Action</td>\n",
" <td>Electronic Arts</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>freq</th>\n",
" <td>NaN</td>\n",
" <td>12</td>\n",
" <td>2163</td>\n",
" <td>NaN</td>\n",
" <td>3316</td>\n",
" <td>1351</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>8300.605254</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2006.406443</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.264667</td>\n",
" <td>0.146652</td>\n",
" <td>0.077782</td>\n",
" <td>0.048063</td>\n",
" <td>0.537441</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>4791.853933</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>5.828981</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.816683</td>\n",
" <td>0.505351</td>\n",
" <td>0.309291</td>\n",
" <td>0.188588</td>\n",
" <td>1.555028</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1980.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.010000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>4151.250000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2003.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.060000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>8300.500000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2007.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.080000</td>\n",
" <td>0.020000</td>\n",
" <td>0.000000</td>\n",
" <td>0.010000</td>\n",
" <td>0.170000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>12449.750000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2010.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.240000</td>\n",
" <td>0.110000</td>\n",
" <td>0.040000</td>\n",
" <td>0.040000</td>\n",
" <td>0.470000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>16600.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2020.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>41.490000</td>\n",
" <td>29.020000</td>\n",
" <td>10.220000</td>\n",
" <td>10.570000</td>\n",
" <td>82.740000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Rank Name Platform Year \\\n",
"count 16598.000000 16598 16598 16327.000000 \n",
"unique NaN 11493 31 NaN \n",
"top NaN Need for Speed: Most Wanted DS NaN \n",
"freq NaN 12 2163 NaN \n",
"mean 8300.605254 NaN NaN 2006.406443 \n",
"std 4791.853933 NaN NaN 5.828981 \n",
"min 1.000000 NaN NaN 1980.000000 \n",
"25% 4151.250000 NaN NaN 2003.000000 \n",
"50% 8300.500000 NaN NaN 2007.000000 \n",
"75% 12449.750000 NaN NaN 2010.000000 \n",
"max 16600.000000 NaN NaN 2020.000000 \n",
"\n",
" Genre Publisher NA_Sales EU_Sales JP_Sales \\\n",
"count 16598 16540 16598.000000 16598.000000 16598.000000 \n",
"unique 12 578 NaN NaN NaN \n",
"top Action Electronic Arts NaN NaN NaN \n",
"freq 3316 1351 NaN NaN NaN \n",
"mean NaN NaN 0.264667 0.146652 0.077782 \n",
"std NaN NaN 0.816683 0.505351 0.309291 \n",
"min NaN NaN 0.000000 0.000000 0.000000 \n",
"25% NaN NaN 0.000000 0.000000 0.000000 \n",
"50% NaN NaN 0.080000 0.020000 0.000000 \n",
"75% NaN NaN 0.240000 0.110000 0.040000 \n",
"max NaN NaN 41.490000 29.020000 10.220000 \n",
"\n",
" Other_Sales Global_Sales \n",
"count 16598.000000 16598.000000 \n",
"unique NaN NaN \n",
"top NaN NaN \n",
"freq NaN NaN \n",
"mean 0.048063 0.537441 \n",
"std 0.188588 1.555028 \n",
"min 0.000000 0.010000 \n",
"25% 0.000000 0.060000 \n",
"50% 0.010000 0.170000 \n",
"75% 0.040000 0.470000 \n",
"max 10.570000 82.740000 "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vgsales.describe(include='all')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "U9B1rGuPkXYe",
"outputId": "36c46aa5-b84d-49ba-f00b-bbcdae4d5efb"
},
"outputs": [
{
"data": {
"text/plain": [
"Electronic Arts 1351\n",
"Activision 975\n",
"Namco Bandai Games 932\n",
"Ubisoft 921\n",
"Konami Digital Entertainment 832\n",
" ... \n",
"Phantagram 1\n",
"989 Sports 1\n",
"Illusion Softworks 1\n",
"TYO 1\n",
"General Entertainment 1\n",
"Name: Publisher, Length: 578, dtype: int64"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vgsales[\"Publisher\"].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "fOODoGBDuNVN",
"outputId": "88220e61-99a8-4d7a-fc84-91601c4844e4"
},
"outputs": [
{
"data": {
"text/plain": [
"DS 2163\n",
"PS2 2161\n",
"PS3 1329\n",
"Wii 1325\n",
"X360 1265\n",
"PSP 1213\n",
"PS 1196\n",
"PC 960\n",
"XB 824\n",
"GBA 822\n",
"GC 556\n",
"3DS 509\n",
"PSV 413\n",
"PS4 336\n",
"N64 319\n",
"SNES 239\n",
"XOne 213\n",
"SAT 173\n",
"WiiU 143\n",
"2600 133\n",
"NES 98\n",
"GB 98\n",
"DC 52\n",
"GEN 27\n",
"NG 12\n",
"SCD 6\n",
"WS 6\n",
"3DO 3\n",
"TG16 2\n",
"GG 1\n",
"PCFX 1\n",
"Name: Platform, dtype: int64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vgsales[\"Platform\"].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 299
},
"id": "rjfY8oCdlw19",
"outputId": "c16b5900-3c45-4ab4-c892-5b0be7bbdd7d"
},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vgsales[\"Platform\"].value_counts().plot(kind=\"bar\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 313
},
"id": "FrKOc5OxvicT",
"outputId": "04d5fe12-92e8-4e72-cb36-adbdbbb230d3"
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f668577e690>"
]
},
"execution_count": 8,
"metadata": {
"tags": []
},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEXCAYAAAC9A7+nAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deZwcRd3H8c8vB1nOECCcm7iBRCEQTMISgSiGgM+TgA9RBCUKCHKIBuXyiIqgHIKIUU4FFYOoQESBIOHQcKhoSEIImwORgBzLGYLKZQiB3/NH1bC9vT27PbuzmU3n+3695rXT3TXVNT29v66urq42d0dERNZ+vWpdABERqQ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3sClwERgODDZzIZnpNsYOBG4r9qFFBGRjuWpoY8Blrn7Y+6+CrgWmJSR7izgu8DKKpZPRERyyhPQtwOeSkw3x3nvMLPRwCB3zx7JXkREul2XL4qaWS9gGnBqjrTHmdl8M5u/fPnyrq5aREQS8gT0p4FBien6OK9kY2AX4G4zexzYA5iZdWHU3a9w90Z3bxw4cGDnSy0iIm3kCejzgGFmNsTM1gMOBWaWFrr7f9x9C3dvcPcGYA5woLvP75YSi4hIpg4DuruvBk4AbgceAma4+xIzO9PMDuzuAoqISD598iRy91nArNS808ukHdf1YomISKV0p6iISEEooIuIFIQCuohIQSigi4gUhAK6iEhBKKCLiBSEArqISEEooIuIFIQCuohIQSigi4g
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light",
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"vgsales[[\"Platform\",\"JP_Sales\"]].groupby(\"Platform\").mean().plot(kind=\"bar\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 399
},
"id": "t-3fmcjiv9Cd",
"outputId": "ab2be9c6-2cab-4e9c-d2c5-60e672137d92"
},
"outputs": [
{
"data": {
"text/plain": [
"<seaborn.axisgrid.FacetGrid at 0x7f6676f85790>"
]
},
"execution_count": 9,
"metadata": {
"tags": []
},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAdUAAAFtCAYAAABRIPDvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeVxU9f7H8deZGQYYFgEXNFc0RXFDM81dsZsbilomLf4qy0orszJN7Wqp2UVt0zK1LG/mzXJBc83cKw1LccvdyBVRQJRtYJbz+4McJVAZOCyDn+fj0eM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ORgzUxMRGDwYCfnx8AiqIQEpJzzODgYF544QU2bdqE2Wzm1VdfdVSx2b59O++//z42m42AgAAmTZpE7dq1iYmJYcqUKTRp0oRDhw7x0ksvsXnzZnbs2MGSJUt46qmnaNasGWPHjiUzMxO73U7//v15+umnizSOklQioVqpUiW+++67fLfVq1ePJUuWlEQ3hLgjuF2NI3Xrx46vbUl/Yd42C7cHJmPBWIo9E8XBunb79UC9xmLFunZ7kUO1YcOGNGvWjC5dutCmTRtatmxJREQE/v7+AOh0OlauXMmff/7JI4884qh5Onr0aL7++mvuvvtulixZwqhRoxw/50+cOMGkSZNo0aIFgGOm+vjjjwMwZcoUwsLCeO655wC4cuVKkcZQ0mRFJSHKGfXq+Txt2XG7MFjTSqE3othdvupcuxN0Oh2zZ89m4cKFtGnThm3bttG3b19SUlI
"text/plain": [
"<Figure size 467.6x360 with 1 Axes>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"import seaborn as sns\n",
"sns.set_theme()\n",
"sns.relplot(data=vgsales, x=\"JP_Sales\", y=\"NA_Sales\", hue=\"Genre\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "3dKPNi2loZvE",
"outputId": "ef08ce5e-9c4c-49b0-90ff-7bf74f578339"
},
"outputs": [
{
"data": {
"text/plain": [
"PS2 873\n",
"DS 829\n",
"Wii 530\n",
"X360 507\n",
"PSP 503\n",
"PS3 488\n",
"PS 471\n",
"PC 396\n",
"XB 339\n",
"GBA 337\n",
"GC 237\n",
"3DS 205\n",
"PSV 166\n",
"PS4 143\n",
"N64 126\n",
"XOne 95\n",
"SNES 95\n",
"SAT 65\n",
"WiiU 55\n",
"2600 49\n",
"NES 43\n",
"GB 38\n",
"DC 25\n",
"GEN 10\n",
"NG 8\n",
"3DO 2\n",
"WS 2\n",
"GG 1\n",
"SCD 1\n",
"Name: Platform, dtype: int64"
]
},
"execution_count": 10,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"from sklearn.model_selection import train_test_split\n",
"vgsales_train, vgsales_test = train_test_split(vgsales, test_size = 0.6, random_state = 1)\n",
"vgsales_train[\"Platform\"].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "O0aSynxruXwH",
"outputId": "2512716a-4909-4a49-cf58-c74ae4433f8b"
},
"outputs": [
{
"data": {
"text/plain": [
"DS 1334\n",
"PS2 1288\n",
"PS3 841\n",
"Wii 795\n",
"X360 758\n",
"PS 725\n",
"PSP 710\n",
"PC 564\n",
"GBA 485\n",
"XB 485\n",
"GC 319\n",
"3DS 304\n",
"PSV 247\n",
"N64 193\n",
"PS4 193\n",
"SNES 144\n",
"XOne 118\n",
"SAT 108\n",
"WiiU 88\n",
"2600 84\n",
"GB 60\n",
"NES 55\n",
"DC 27\n",
"GEN 17\n",
"SCD 5\n",
"WS 4\n",
"NG 4\n",
"TG16 2\n",
"3DO 1\n",
"PCFX 1\n",
"Name: Platform, dtype: int64"
]
},
"execution_count": 11,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"vgsales_test[\"Platform\"].value_counts()"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "Zadanie1.ipynb",
"provenance": []
},
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
}