{ "cells": [ { "cell_type": "code", "execution_count": 27, "id": "decreased-eight", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: kaggle in /home/maciej/.local/lib/python3.8/site-packages (1.5.12)\n", "Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from kaggle) (2019.11.28)\n", "Requirement already satisfied: six>=1.10 in /usr/lib/python3/dist-packages (from kaggle) (1.14.0)\n", "Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from kaggle) (2.22.0)\n", "Requirement already satisfied: tqdm in /home/maciej/.local/lib/python3.8/site-packages (from kaggle) (4.59.0)\n", "Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from kaggle) (1.25.8)\n", "Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from kaggle) (2.7.3)\n", "Requirement already satisfied: python-slugify in /home/maciej/.local/lib/python3.8/site-packages (from kaggle) (4.0.1)\n", "Requirement already satisfied: text-unidecode>=1.3 in /home/maciej/.local/lib/python3.8/site-packages (from python-slugify->kaggle) (1.3)\n", "Requirement already satisfied: pandas in /home/maciej/.local/lib/python3.8/site-packages (1.2.3)\n", "Requirement already satisfied: numpy>=1.16.5 in /home/maciej/.local/lib/python3.8/site-packages (from pandas) (1.20.1)\n", "Requirement already satisfied: pytz>=2017.3 in /usr/lib/python3/dist-packages (from pandas) (2019.3)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/lib/python3/dist-packages (from pandas) (2.7.3)\n", "Requirement already satisfied: sklearn in /home/maciej/.local/lib/python3.8/site-packages (0.0)\n", "Requirement already satisfied: scikit-learn in /home/maciej/.local/lib/python3.8/site-packages (from sklearn) (0.24.1)\n", "Requirement already satisfied: threadpoolctl>=2.0.0 in /home/maciej/.local/lib/python3.8/site-packages (from scikit-learn->sklearn) (2.1.0)\n", "Requirement already satisfied: joblib>=0.11 in /home/maciej/.local/lib/python3.8/site-packages (from scikit-learn->sklearn) (1.0.1)\n", "Requirement already satisfied: numpy>=1.13.3 in /home/maciej/.local/lib/python3.8/site-packages (from scikit-learn->sklearn) (1.20.1)\n", "Requirement already satisfied: scipy>=0.19.1 in /home/maciej/.local/lib/python3.8/site-packages (from scikit-learn->sklearn) (1.6.1)\n", "Collecting matplotlib\n", " Downloading matplotlib-3.3.4-cp38-cp38-manylinux1_x86_64.whl (11.6 MB)\n", "\u001b[K |████████████████████████████████| 11.6 MB 39 kB/s eta 0:00:01 |██████████▏ | 3.7 MB 5.2 MB/s eta 0:00:02 |██████████████▏ | 5.1 MB 5.2 MB/s eta 0:00:02 |██████████████▋ | 5.3 MB 5.2 MB/s eta 0:00:02 |████████████████████████▏ | 8.7 MB 2.1 MB/s eta 0:00:02 |████████████████████████████ | 10.1 MB 2.1 MB/s eta 0:00:01\n", "\u001b[?25hCollecting cycler>=0.10\n", " Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n", "Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from matplotlib) (2.7.3)\n", "Collecting kiwisolver>=1.0.1\n", " Downloading kiwisolver-1.3.1-cp38-cp38-manylinux1_x86_64.whl (1.2 MB)\n", "\u001b[K |████████████████████████████████| 1.2 MB 9.9 MB/s eta 0:00:01\n", "\u001b[?25hRequirement already satisfied: pillow>=6.2.0 in /usr/lib/python3/dist-packages (from matplotlib) (7.0.0)\n", "Requirement already satisfied: numpy>=1.15 in /home/maciej/.local/lib/python3.8/site-packages (from matplotlib) (1.20.1)\n", "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/maciej/.local/lib/python3.8/site-packages (from matplotlib) (2.4.7)\n", "Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cycler>=0.10->matplotlib) (1.14.0)\n", "Installing collected packages: cycler, kiwisolver, matplotlib\n", "Successfully installed cycler-0.10.0 kiwisolver-1.3.1 matplotlib-3.3.4\n" ] } ], "source": [ "import sys\n", "!{sys.executable} -m pip install kaggle\n", "!{sys.executable} -m pip install pandas\n", "!{sys.executable} -m pip install sklearn\n", "!{sys.executable} -m pip install matplotlib" ] }, { "cell_type": "code", "execution_count": 5, "id": "sharp-september", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading who-suicide-statistics.zip to /home/maciej/Desktop/INZ/ium_434784\r\n", "\r", " 0%| | 0.00/304k [00:00, ?B/s]\r\n", "\r", "100%|████████████████████████████████████████| 304k/304k [00:00<00:00, 17.9MB/s]\r\n" ] } ], "source": [ "# Zadanie 1\n", "!kaggle datasets download -d szamil/who-suicide-statistics" ] }, { "cell_type": "code", "execution_count": 6, "id": "different-stack", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | country | \n", "year | \n", "sex | \n", "age | \n", "suicides_no | \n", "population | \n", "
---|---|---|---|---|---|---|
0 | \n", "Albania | \n", "1985 | \n", "female | \n", "15-24 years | \n", "NaN | \n", "277900.0 | \n", "
1 | \n", "Albania | \n", "1985 | \n", "female | \n", "25-34 years | \n", "NaN | \n", "246800.0 | \n", "
2 | \n", "Albania | \n", "1985 | \n", "female | \n", "35-54 years | \n", "NaN | \n", "267500.0 | \n", "
3 | \n", "Albania | \n", "1985 | \n", "female | \n", "5-14 years | \n", "NaN | \n", "298300.0 | \n", "
4 | \n", "Albania | \n", "1985 | \n", "female | \n", "55-74 years | \n", "NaN | \n", "138700.0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
43771 | \n", "Zimbabwe | \n", "1990 | \n", "male | \n", "25-34 years | \n", "150.0 | \n", "NaN | \n", "
43772 | \n", "Zimbabwe | \n", "1990 | \n", "male | \n", "35-54 years | \n", "132.0 | \n", "NaN | \n", "
43773 | \n", "Zimbabwe | \n", "1990 | \n", "male | \n", "5-14 years | \n", "6.0 | \n", "NaN | \n", "
43774 | \n", "Zimbabwe | \n", "1990 | \n", "male | \n", "55-74 years | \n", "74.0 | \n", "NaN | \n", "
43775 | \n", "Zimbabwe | \n", "1990 | \n", "male | \n", "75+ years | \n", "13.0 | \n", "NaN | \n", "
43776 rows × 6 columns
\n", "\n", " | country | \n", "year | \n", "sex | \n", "age | \n", "suicides_no | \n", "population | \n", "
---|---|---|---|---|---|---|
10289 | \n", "Cuba | \n", "1993 | \n", "female | \n", "75+ years | \n", "84.0 | \n", "208800.0 | \n", "
18495 | \n", "Hungary | \n", "2004 | \n", "female | \n", "5-14 years | \n", "2.0 | \n", "544457.0 | \n", "
1930 | \n", "Aruba | \n", "1987 | \n", "male | \n", "55-74 years | \n", "0.0 | \n", "3118.0 | \n", "
20315 | \n", "Italy | \n", "2001 | \n", "male | \n", "75+ years | \n", "560.0 | \n", "1675192.0 | \n", "
15269 | \n", "Georgia | \n", "1993 | \n", "female | \n", "75+ years | \n", "NaN | \n", "133600.0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
35206 | \n", "Singapore | \n", "1981 | \n", "male | \n", "55-74 years | \n", "18.0 | \n", "108600.0 | \n", "
33416 | \n", "Saint Kitts and Nevis | \n", "1987 | \n", "male | \n", "35-54 years | \n", "0.0 | \n", "NaN | \n", "
7622 | \n", "Bulgaria | \n", "2011 | \n", "female | \n", "35-54 years | \n", "41.0 | \n", "1036483.0 | \n", "
37277 | \n", "Suriname | \n", "1982 | \n", "female | \n", "75+ years | \n", "1.0 | \n", "3100.0 | \n", "
13448 | \n", "El Salvador | \n", "2014 | \n", "male | \n", "35-54 years | \n", "85.0 | \n", "586412.0 | \n", "
26265 rows × 6 columns
\n", "