2024-programowanie-w-python.../zajecia2/zad_3.ipynb
2024-11-22 14:27:51 +01:00

445 lines
22 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Python: Drugie zadanie domowe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Drugie zadanie domowe będzie polegać na opracowaniu danych zawartych w pliku `gapminder.csv`, który znajduje się w tym katalogu (proszę wykorzystać ten plik, a nie ten w katalogu labs04). Ten arkusz poprowadzi Cię krok po kroku po zadaniu domowym."
]
},
{
"cell_type": "code",
"execution_count": 97,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 1** Wczytaj dane do zmiennej `data`, w taki sposób, żeby nazwa Państwa była kluczem."
]
},
{
"cell_type": "code",
"execution_count": 86,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 2** Znajdź najbardziej i najmniej zaludnione państwa na świecie."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 3** W ilu państwach współczynnik `female_BMI` jest większy od `male_BMI`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 4**\n",
" 1. Zainstaluj bibliotekę `pycountry_convert` i zaimportuj ją.\n",
" 1. Dodaj do danych kolumnę `continent`, która będzie zawierać nazwę kontynentu, na którym jest położone dane państwo. Wykorzystaj bibliotekę `pycountry_convert`. *Uwaga*: trzeba najpierw uzystać kod państwa w fomacie ISO-2, następnie uzystkać kod kontynentu, a na końcu uzyskać nazwę kontynentu."
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Afghanistan Asia\n",
"Albania Europe\n",
"Algeria Africa\n",
"Angola Africa\n",
"Antigua and Barbuda North America\n",
"Argentina South America\n",
"Armenia Asia\n",
"Australia Oceania\n",
"Austria Europe\n",
"Azerbaijan Asia\n",
"Bahamas North America\n",
"Bahrain Asia\n",
"Bangladesh Asia\n",
"Barbados North America\n",
"Belarus Europe\n",
"Belgium Europe\n",
"Belize North America\n",
"Benin Africa\n",
"Bhutan Asia\n",
"Bolivia South America\n",
"Bosnia and Herzegovina Europe\n",
"Botswana Africa\n",
"Brazil South America\n",
"Brunei Asia\n",
"Bulgaria Europe\n",
"Burkina Faso Africa\n",
"Burundi Africa\n",
"Cambodia Asia\n",
"Cameroon Africa\n",
"Canada North America\n",
" ... \n",
"Spain Europe\n",
"Sri Lanka Asia\n",
"Sudan Africa\n",
"Suriname South America\n",
"Swaziland Africa\n",
"Sweden Europe\n",
"Switzerland Europe\n",
"Syria Asia\n",
"Tajikistan Asia\n",
"Tanzania Africa\n",
"Thailand Asia\n",
"Togo Africa\n",
"Tonga Oceania\n",
"Trinidad and Tobago North America\n",
"Tunisia Africa\n",
"Turkey Asia\n",
"Turkmenistan Asia\n",
"Uganda Africa\n",
"Ukraine Europe\n",
"United Arab Emirates Asia\n",
"United Kingdom Europe\n",
"United States North America\n",
"Uruguay South America\n",
"Uzbekistan Asia\n",
"Vanuatu Oceania\n",
"Venezuela South America\n",
"Vietnam Asia\n",
"Palestine Asia\n",
"Zambia Africa\n",
"Zimbabwe Africa\n",
"Name: continent, Length: 175, dtype: object"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 5**\n",
"Oblicz ile osób mieszka na każdym z kontynentów."
]
},
{
"cell_type": "code",
"execution_count": 103,
"metadata": {},
"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>female_BMI</th>\n",
" <th>male_BMI</th>\n",
" <th>gdp</th>\n",
" <th>population</th>\n",
" <th>under5mortality</th>\n",
" <th>life_expectancy</th>\n",
" <th>fertility</th>\n",
" </tr>\n",
" <tr>\n",
" <th>continent</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Africa</th>\n",
" <td>1259.33213</td>\n",
" <td>1181.44512</td>\n",
" <td>280335.0</td>\n",
" <td>9.772803e+08</td>\n",
" <td>4763.00</td>\n",
" <td>3136.10</td>\n",
" <td>246.50</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Asia</th>\n",
" <td>1114.28765</td>\n",
" <td>1084.74598</td>\n",
" <td>1038232.0</td>\n",
" <td>3.949400e+09</td>\n",
" <td>1302.98</td>\n",
" <td>3201.41</td>\n",
" <td>108.48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Europe</th>\n",
" <td>980.30978</td>\n",
" <td>1009.60877</td>\n",
" <td>1173410.0</td>\n",
" <td>7.219954e+08</td>\n",
" <td>273.60</td>\n",
" <td>2929.30</td>\n",
" <td>59.56</td>\n",
" </tr>\n",
" <tr>\n",
" <th>North America</th>\n",
" <td>526.06040</td>\n",
" <td>497.74034</td>\n",
" <td>338430.0</td>\n",
" <td>5.235798e+08</td>\n",
" <td>392.38</td>\n",
" <td>1412.20</td>\n",
" <td>45.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Oceania</th>\n",
" <td>297.20093</td>\n",
" <td>279.58957</td>\n",
" <td>102803.0</td>\n",
" <td>3.425711e+07</td>\n",
" <td>310.00</td>\n",
" <td>683.20</td>\n",
" <td>34.02</td>\n",
" </tr>\n",
" <tr>\n",
" <th>South America</th>\n",
" <td>322.37322</td>\n",
" <td>308.59791</td>\n",
" <td>139888.0</td>\n",
" <td>3.881582e+08</td>\n",
" <td>288.70</td>\n",
" <td>886.80</td>\n",
" <td>30.10</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" female_BMI male_BMI gdp population \\\n",
"continent \n",
"Africa 1259.33213 1181.44512 280335.0 9.772803e+08 \n",
"Asia 1114.28765 1084.74598 1038232.0 3.949400e+09 \n",
"Europe 980.30978 1009.60877 1173410.0 7.219954e+08 \n",
"North America 526.06040 497.74034 338430.0 5.235798e+08 \n",
"Oceania 297.20093 279.58957 102803.0 3.425711e+07 \n",
"South America 322.37322 308.59791 139888.0 3.881582e+08 \n",
"\n",
" under5mortality life_expectancy fertility \n",
"continent \n",
"Africa 4763.00 3136.10 246.50 \n",
"Asia 1302.98 3201.41 108.48 \n",
"Europe 273.60 2929.30 59.56 \n",
"North America 392.38 1412.20 45.00 \n",
"Oceania 310.00 683.20 34.02 \n",
"South America 288.70 886.80 30.10 "
]
},
"execution_count": 103,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 6** Narysyj wykres słupkowy pokazujący ile państw leży na każdym z kontynentów."
]
},
{
"cell_type": "code",
"execution_count": 102,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f7cceba78d0>"
]
},
"execution_count": 102,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAE7CAYAAADNbXrqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREB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7T7iksUlyH+AR/e61VXX3z3u/Rs9AlyYkyf2AU+nC/EzgjVV167BVLU6SxwLfqKpv9vu/Q3fb/43An1XVd4esb7lxlos0Zkn2TvJa4Cq6Yc4jquqV0x7mvbcDPwZI8iTg9cB7gO8B6wasa1lyDF0aoyR/ARxPF26HVNX3By5p1HacdRb+HGBdVZ0NnJ3kygHrWpYccpHGKMm9wN10t8PP/mEL3UXRPQYpbESSfAk4rKo2JbkGWFtVn5p5raoePWyFy4tn6NIYVVXrw5rvBz6Z5NvAD+nWqCHJw+iGXTRBnqFLWpQkRwL7ARdU1V1928OB3avq8kGLW2YMdElqROu/DkrSsmGgS1IjDHRJaoSBLkmNMNAlqRH/H0B3xVUsRwwUAAAAAElFTkSuQmCC",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 7** \n",
" * Kolumna `gdp` zawiera informacje o PKB na obywatela. Stwórz nową kolumnę `gdp_total`, która będzie informować o PKB danego kraju.\n",
" * Oblicz ile wynosi suma światowego PKB (kolumna `gdp_total`).\n",
" * Oblicz ile krajów jest odpowiedzialnych za wytworzenie 80% światego PKB."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 8** Wyświetl wszystkie europejskie państwa, w których oczekiwana długość życia wynosi conajmniej 80 lat. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 9** Znajdź państwo, które ma najbardziej zbliżone PKB do Polski. Spróbuj rozwiązać to zadanie w jednej linijce."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**zad. 10 (ostatnie)**\n",
" * Zobacz czy masz zainstalowaną bibliotekę `requests`, która sluży do wykonywania zapytań HTTP. Jeżeli nie, to zainstaluj ją. \n",
" * Uruchom z funkcję `requests.get` podając jako argument link: `https://aws.random.cat/meow`. Wynik zapisz do zmiennej response.\n",
" * Wykonaj metodę `json()` na zmiennej `response` która zwróci Ci słownik, w którym będzie klucz `file`. Zapisz wartość `file` do zmiennej `url`.\n",
" * Zaimportuj `Image` i `display` z biblioteki `from IPython.core.display`.\n",
" * Stwórz obiekt Image podając w konstruktorze zmienną `url`,a wynik zapisz do `image`.\n",
" * Wykonaj funkcję `display` na obiekcie `image`.\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}