Compare commits

...

17 Commits

Author SHA1 Message Date
Maksymilian Stachowiak
d506707eb8 update 2023-11-26 11:14:05 +01:00
Maksymilian Stachowiak
adb6adf1ba Merge branch 'master' of https://git.wmi.amu.edu.pl/kubapok/2023-programowanie-w-pythonie 2023-11-26 09:12:52 +01:00
Maksymilian Stachowiak
92dca8796c rozwiazanka 2023-11-26 09:12:43 +01:00
Jakub Pokrywka
f494ff6634 add kontener 2023-11-25 20:51:44 +01:00
Jakub Pokrywka
798a3384de add zajecia 4 2023-11-25 20:37:12 +01:00
Maksymilian Stachowiak
c37b42a4f4 Merge branch 'master' of https://git.wmi.amu.edu.pl/kubapok/2023-programowanie-w-pythonie 2023-11-25 11:57:13 +01:00
Jakub Pokrywka
fc774f482e update 2023-11-25 09:36:56 +01:00
Jakub Pokrywka
c34117338e add sklearn cz 2 2023-11-24 20:52:41 +01:00
Jakub Pokrywka
d3e4075017 update sklearn part 1 2023-11-24 20:16:47 +01:00
Jakub Pokrywka
56fdb84a38 update sklearn part 1 2023-11-24 20:16:16 +01:00
Jakub Pokrywka
7ea008db1f move file 2023-11-19 12:43:33 +01:00
Jakub Pokrywka
cd07404449 add sklearn 2023-11-19 12:33:16 +01:00
Jakub Pokrywka
8d76aaeb54 add odpowiedzi 2023-11-19 12:10:37 +01:00
Jakub Pokrywka
04a34249d2 update README 2023-11-19 11:25:42 +01:00
Jakub Pokrywka
29a39d35dd Merge branch 'master' of git.wmi.amu.edu.pl:kubapok/2023-programowanie-w-pythonie 2023-11-19 09:50:30 +01:00
Jakub Pokrywka
c68dd971b1 hide answers in zajecia 2 zad 02 2023-11-19 09:50:25 +01:00
8fd4add80b Update 'zajecia1/zadania/zadanie_3.py'
fix zadanie 3
2023-11-18 16:23:58 +01:00
27 changed files with 6263 additions and 329 deletions

View File

@ -53,4 +53,22 @@ Skala ocen
W celu prezentacji projektu należy umowić sie z prowadzącym na prezentacje zdalną lub na wydziale (tylko w dni pracujące).
Termin oddania zadań do koniec stycznia 2024. Dodatkowo można zgłosić prezentacje do końca 2023- wtedy prowadzący proponuje ocenę i zespół może albo ją przyjąć lub nie i spróbować jeszcze raz w styczniu.
Termin oddania zadań do koniec stycznia 2024. Dodatkowo można zgłosić prezentacje do końca 2023- wtedy prowadzący proponuje ocenę i zespół może albo ją przyjąć lub nie i spróbować jeszcze raz w styczniu.
## Dodatkowe materiały
### jupyter notebook
- https://noteable.io/blog/jupyter-notebook-shortcuts-boost-productivity/
### bash
- https://www.earthdatascience.org/courses/intro-to-earth-data-science/open-reproducible-science/bash/
- https://www.educative.io/blog/bash-shell-command-cheat-sheet
### git
- https://git.wmi.amu.edu.pl/
- https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/
- https://git-scm.com/docs/gittutorial
- https://git-scm.com/book/en/v2
### pycharm tutorial:
- https://www.jetbrains.com/guide/python/tutorials/getting-started-pycharm/

655
zajecia1/odpowiedzi.ipynb Normal file
View File

@ -0,0 +1,655 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"Sprawdź czy tekst 'aAaAaA' znajduje się w tablicy passwords.\n",
"W zależności czy znajduje się czy też nie, wyświetl na ekranie odpowiedni komunikat.\n",
"\"\"\"\n",
"\n",
"passwords = ['aaAaa', 'aAAAaa', 'aaaaaaA', 'aaaAAAAA', 'aaAAAaa', 'aAaAaA', 'aAaAaAA']"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"napisaAaAaAznajduje sie w tablicy passwords\n"
]
}
],
"source": [
"if 'aAaAaA' in passwords:\n",
" print('napis ' + 'aAaAaA' + ' znajduje sie w tablicy passwords')\n",
"else:\n",
" print(' napis' + 'aAaAaA' + ' nie znajduje sie w tablicy passwords')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"Niech x oznacza liczbę uzyskanych punktów. Standardowa skala ocen jest następująca:\n",
"* x >= 90 -- 5.0\n",
"* 90 > x >= 80 -- 4.5\n",
"* 80 > x >= 70 -- 4.0\n",
"* 70 > x >= 60 -- 3.5\n",
"* 60 > x >= 50 -- 3.0\n",
"* x < 50 -- 2.0\n",
"\n",
"Zmienna `points` zawiera liczbę uzyskanych punktów przez studenta.\n",
"Napisz instrukcję warunką, która wyświetli ocenę studenta w zależności od liczby punktów.\n",
"\"\"\"\n",
"\n",
"points = 85\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Twoja ocena to: 4.5\n",
"Twoja ocena to: 4.5\n"
]
}
],
"source": [
"def print_grade(grade):\n",
" print('Twoja ocena to: ',grade)\n",
" \n",
" \n",
"# te rozwiązanie korzysta z ciekawej możliwości zawarcia dwóch warunków a<x<b w jednej lini\n",
"if points >= 90:\n",
" print_grade(5.0)\n",
"elif 90 > points >= 80:\n",
" print_grade(4.5)\n",
"elif 80 > points >= 70:\n",
" print_grade(4.0)\n",
"elif 70 > points >= 60:\n",
" print_grade(3.5)\n",
"elif 60 > points >= 50:\n",
" print_grade(3.0)\n",
"else:\n",
" print_grade(2.0)\n",
" \n",
"# albo można tak:\n",
"if points >= 90:\n",
" print_grade(5.0)\n",
"elif 90 > points:\n",
" print_grade(4.5)\n",
"elif 80 > points:\n",
" print_grade(4.0)\n",
"elif 70 > points:\n",
" print_grade(3.5)\n",
"elif 60 > points:\n",
" print_grade(3.0)\n",
"else:\n",
" print_grade(2.0)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"230181"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"\n",
"Oblicz sumę liczb od 1 do 678.\n",
"\"\"\"\n",
"# te dodanie 1 jest ważne, bo python nie włącza końca przedziału\n",
"sum(list(range(1,678+1)))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\"\"\"\n",
"Słownik `oceny` zawiera oceny kilku osób. Kluczami są imiona dzieci, a wartosciami -- ich oceny.\n",
"Uzupełnij słownik `rozklad`, którego kluczami są oceny, a wartosciami -- listy... \n",
"\"\"\"\n",
"\n",
"oceny = {\n",
" 'Albert': 4.5,\n",
" 'Beata': 5,\n",
" 'Cecylia': 4,\n",
" 'Dariusz': 4,\n",
" 'Eliza': 3,\n",
" 'Feliks': 5,\n",
" 'Grzegorz': 4.5,\n",
" 'Izabela': 4.5\n",
"}\n",
"\n",
"rozklad = {\n",
" 5: [],\n",
" 4.5: [],\n",
" 4: [],\n",
" 3: []\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{5: ['Beata', 'Feliks'],\n",
" 4.5: ['Albert', 'Grzegorz', 'Izabela'],\n",
" 4: ['Cecylia', 'Dariusz'],\n",
" 3: ['Eliza']}"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for key, value in oceny.items():\n",
" rozklad[value].append(key)\n",
"rozklad\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\"\"\"\n",
"Poniżej znajdują się 2 słowniki z danymi o liczbie przejazdów rowerami miejskimi w Montrealu w 2018 z podziałem na miesiące (od kwietnia do listopada).\n",
"Pierwszy słownik zawiera informacje o przejazdach wykonanych przez posiadaczy abonamentu, a drugi przez ludzi, którzy\n",
"nie mają wykupionego abonamentu. Dane pochodzą ze strony https://montreal.bixi.com/en/open-data. \n",
"\n",
"a) Stwórz trzeci słownik `all_rides`, w którym zliczysz łączną liczbę przejazdów w każdym z podanych miesięcy.\n",
"b) Oblicz sumę zarejestrowanych przejazdów od kwietnia do listopada.\n",
"c) Wyswietl jaki procent wszystkich przejazdów odbyło się w sierpniu (August).\n",
"\n",
"\"\"\"\n",
"\n",
"members = {\n",
" 'April': 211819,\n",
" 'May': 682758,\n",
" 'June': 737011,\n",
" 'July': 779511,\n",
" 'August': 673790,\n",
" 'September': 673790,\n",
" 'October': 444177,\n",
" 'November': 136791,\n",
"}\n",
"\n",
"occasionals = {\n",
" 'April': 32058,\n",
" 'May': 147898,\n",
" 'June': 171494,\n",
" 'July': 194316,\n",
" 'August': 206809,\n",
" 'September': 140492,\n",
" 'October': 53596,\n",
" 'November': 10516,\n",
"}\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'April': 243877, 'May': 830656, 'June': 908505, 'July': 973827, 'August': 880599, 'September': 814282, 'October': 497773, 'November': 147307}\n",
"5296826\n",
"16.62503166990949 %\n",
"16.63 %\n"
]
}
],
"source": [
"all_rides = dict()\n",
"for key,value in members.items():\n",
" all_rides[key] = value\n",
"\n",
"for key,value in occasionals.items():\n",
" all_rides[key] += value\n",
"\n",
"print(all_rides)\n",
"# można też to zrobić szybciej korzystająć z list comprehensions, albo np biblioteki copy\n",
"\n",
"print(sum(all_rides.values()))\n",
"\n",
"print(100 * all_rides['August'] / sum(all_rides.values()), '%')\n",
"print(round(100 * all_rides['August'] / sum(all_rides.values()),2), '%') # zaokrąglenie"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"Napisz kod, który zwraci tzw. \"Big 'NO!'\" (zob. http://tvtropes.org/pmwiki/pmwiki.php/Main/BigNo)\n",
"dla zadanej liczby tj. napis typu \"NOOOOOOOOOOOOO!\", gdzie liczba 'O' ma być\n",
"równa wartości zmniennej `number_of_o`. Jeśli argument jest mniejszy niż 5, ma być zwracany napis \"It's not a Big 'No!'\".\n",
"Wyświetl ten napis na ekran.\n",
"\"\"\"\n",
"\n",
"number_of_o = 6"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"NOOOOOO!\n"
]
}
],
"source": [
"if number_of_o < 5:\n",
" print(\"It's not a Big 'No!'\")\n",
"else:\n",
" print(\"N\"+\"O\"*number_of_o+'!')"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
" * Podziel zmienną `text` na słowa, korzystając z metody split.\n",
" * Dodaj do listy `oov`, wszystkie słowa (bez powtórzeń), które nie są zawarte w liście `vocab`.\n",
"\"\"\"\n",
"\n",
"\n",
"text = \"this is a string , which i will use for string testing\"\n",
"vocab = [',', 'this', 'is', 'a', 'which', 'for', 'will', 'i']\n",
"\n",
"oov = []\n"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['string', 'use', 'testing']"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text_splitted = text.split()\n",
"text_splitted_no_repeats = set(text_splitted)\n",
"\n",
"for item in text_splitted_no_repeats:\n",
" if item not in vocab:\n",
" oov.append(item)\n",
" \n",
"oov"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\n1. Napisz rekurencyjną funkcję, która zwróci n-ty wyraz ciągu Fibonacciego.\\n2. Napisz funkcję, która obliczy n-ty wyroz ciągu Fibonacciego nie korzystając z rekurencji.\\nNp. możesz wykorzystać listę do obliczania kolejnych wartości ciągu.\\n\\nCiąg Fibonacciego:\\na[0] = 1, a[1] = 1, a[n] = a[n-1] + a[n-2] dla n>=2\\n\\n'"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"\n",
"1. Napisz rekurencyjną funkcję, która zwróci n-ty wyraz ciągu Fibonacciego.\n",
"2. Napisz funkcję, która obliczy n-ty wyroz ciągu Fibonacciego nie korzystając z rekurencji.\n",
"Np. możesz wykorzystać listę do obliczania kolejnych wartości ciągu.\n",
"\n",
"Ciąg Fibonacciego:\n",
"a[0] = 1, a[1] = 1, a[n] = a[n-1] + a[n-2] dla n>=2\n",
"\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"89"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fib(n):\n",
" if n == 0:\n",
" return 1\n",
" elif n == 1:\n",
" return 1\n",
" else:\n",
" return fib(n-1) + fib(n-2)\n",
"fib(10)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\"\"\"\n",
"Napisz funkcję sum_div35(n), która zwraca sumę wszystkich liczb podzielnych\n",
"przez 3 lub 5 mniejszych niż n.\n",
"\"\"\"\n",
"\n",
"def sum_div35(n):\n",
" pass\n",
"\n",
"input = 100\n",
"# dla n =100 poprawna odpowiedź to 2318\n"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2318"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def sum_div35(n):\n",
" all_numbers = []\n",
" for i in range(n):\n",
" if i % 3 == 0 or i % 5 == 0:\n",
" all_numbers.append(i)\n",
" return sum(all_numbers)\n",
"\n",
"sum_div35(100)\n",
"\n",
"# alternatywnie:\n",
"def sum_div35(n):\n",
" return sum([i for i in range(n) if i % 3 == 0 or i % 5 == 0 ])\n",
"sum_div35(100)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\nOtwórz plik `zen_of_python.txt` i zlicz liczbę linii i słów w tym pliku. \\nNastępnie przerób kod na funkcję, która jako argument będzie przyjmować ściężkę do pliku i będzie zwracać \\nsłownik z dwoma kluczami: `liczba_linii` i `liczba_slow`.\\n'"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"\n",
"Otwórz plik `zen_of_python.txt` i zlicz liczbę linii i słów w tym pliku. \n",
"Następnie przerób kod na funkcję, która jako argument będzie przyjmować ściężkę do pliku i będzie zwracać \n",
"słownik z dwoma kluczami: `liczba_linii` i `liczba_slow`.\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"19\n"
]
},
{
"data": {
"text/plain": [
"(19, 137)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(len(open('zen_of_python.txt').readlines()))\n",
"\n",
"def count_lines_and_words(path):\n",
" lines = 0\n",
" words = 0\n",
" with open(path) as f:\n",
" for line in f:\n",
" lines += 1\n",
" words += len(line.split())\n",
" return lines, words\n",
"\n",
"count_lines_and_words('zen_of_python.txt')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"Zadania: Zaimportuj bibliotekę statistics, która zawiera funckje do obliczenia podstawych wielkości statystycznych (średnia, mediana, moda):\n",
" statistics.mean -- obliczenie średniej\n",
" statistics.median -- obliczenie mediany\n",
" statistics.variance -- obliczenie wariancji\n",
" statistics.stdev -- obliczenie odchylenia standardowego Oblicz te wielkości dla wartości z poniższego słownika.\n",
"Każda z tych funkcji przyjmuje jeden argument: listę wartości.\n",
"\"\"\"\n",
"\n",
"members = {\n",
" 'April': 211819,\n",
" 'May': 682758,\n",
" 'June': 737011,\n",
" 'July': 779511,\n",
" 'August': 673790,\n",
" 'September': 673790,\n",
" 'October': 444177,\n",
" 'November': 136791,\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"542455.875\n",
"673790.0\n",
"61681755885.83929\n",
"248358.12023334226\n"
]
}
],
"source": [
"import statistics\n",
"\n",
"values = members.values()\n",
"\n",
"print(statistics.mean(values))\n",
"print(statistics.median(values))\n",
"print(statistics.variance(values))\n",
"print(statistics.stdev(values))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"Biblioteka random posiada funkcję random, która zwraca losową licznę z przedziału [0, 1) (nie przyjmuje żadnych argumentów).\n",
"Biblioteka math posiada funkcję hypot, która oblicza odległość punktu od środka układu współrzędnych (punktu [0, 0]) i przyjmuje dwa argumenty: współrzędne punktu.\n",
"* Zaimportuj biblioteki random i math\n",
"* korzystając z funkcji random wylosuj dwie liczby i przypisz wyniki do zmniennych x i y.\n",
"* Korzystając z funkcji hypot oblicz odległość punktu o współrzednych (x,y).\n",
"* Dodaj pętlę, która będzie wykonywać te czynności n = 10 razy i będzie zliczać ile razy obliczona odległość jest mniejsza od 1.\n",
"* Oblicz stosunek liczby punktów, dla których odległość wynosiła mniej niż 1 do całkowitej liczby punktów. Pomnóż tę wartocść przez 4.\n",
"* Podstaw za n wartości 100, 1000, 1000000. Do jakiej wartości zbiegają wartości?\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.023482041105784\n",
"785667\n",
"3.142668\n"
]
}
],
"source": [
"import random\n",
"import math\n",
"\n",
"x,y = random.random(), random.random()\n",
"print(math.hypot(x,y))\n",
"\n",
"n = 1000000\n",
"lower_than_1_number = 0\n",
"for i in range(n):\n",
" x,y = random.random(), random.random()\n",
" if math.hypot(x,y) < 1 :\n",
" lower_than_1_number +=1\n",
"print(lower_than_1_number)\n",
"\n",
"print((lower_than_1_number / n )*4)\n",
"\n",
"# zmierza do stałej PI"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"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.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

60
zajecia2/customers.csv Normal file
View File

@ -0,0 +1,60 @@
,CustomerId,FirstName,LastName,Company,Address,City,State,Country,PostalCode,Phone,Fax,Email,SupportRepId
0,1,Luís,Gonçalves,Embraer - Empresa Brasileira de Aeronáutica S.A.,"Av. Brigadeiro Faria Lima, 2170",São José dos Campos,SP,Brazil,12227-000,+55 (12) 3923-5555,+55 (12) 3923-5566,luisg@embraer.com.br,3
1,2,Leonie,Köhler,,Theodor-Heuss-Straße 34,Stuttgart,,Germany,70174,+49 0711 2842222,,leonekohler@surfeu.de,5
2,3,François,Tremblay,,1498 rue Bélanger,Montréal,QC,Canada,H2G 1A7,+1 (514) 721-4711,,ftremblay@gmail.com,3
3,4,Bjørn,Hansen,,Ullevålsveien 14,Oslo,,Norway,0171,+47 22 44 22 22,,bjorn.hansen@yahoo.no,4
4,5,František,Wichterlová,JetBrains s.r.o.,Klanova 9/506,Prague,,Czech Republic,14700,+420 2 4172 5555,+420 2 4172 5555,frantisekw@jetbrains.com,4
5,6,Helena,Holý,,Rilská 3174/6,Prague,,Czech Republic,14300,+420 2 4177 0449,,hholy@gmail.com,5
6,7,Astrid,Gruber,,"Rotenturmstraße 4, 1010 Innere Stadt",Vienne,,Austria,1010,+43 01 5134505,,astrid.gruber@apple.at,5
7,8,Daan,Peeters,,Grétrystraat 63,Brussels,,Belgium,1000,+32 02 219 03 03,,daan_peeters@apple.be,4
8,9,Kara,Nielsen,,Sønder Boulevard 51,Copenhagen,,Denmark,1720,+453 3331 9991,,kara.nielsen@jubii.dk,4
9,10,Eduardo,Martins,Woodstock Discos,"Rua Dr. Falcão Filho, 155",São Paulo,SP,Brazil,01007-010,+55 (11) 3033-5446,+55 (11) 3033-4564,eduardo@woodstock.com.br,4
10,11,Alexandre,Rocha,Banco do Brasil S.A.,"Av. Paulista, 2022",São Paulo,SP,Brazil,01310-200,+55 (11) 3055-3278,+55 (11) 3055-8131,alero@uol.com.br,5
11,12,Roberto,Almeida,Riotur,"Praça Pio X, 119",Rio de Janeiro,RJ,Brazil,20040-020,+55 (21) 2271-7000,+55 (21) 2271-7070,roberto.almeida@riotur.gov.br,3
12,13,Fernanda,Ramos,,Qe 7 Bloco G,Brasília,DF,Brazil,71020-677,+55 (61) 3363-5547,+55 (61) 3363-7855,fernadaramos4@uol.com.br,4
13,14,Mark,Philips,Telus,8210 111 ST NW,Edmonton,AB,Canada,T6G 2C7,+1 (780) 434-4554,+1 (780) 434-5565,mphilips12@shaw.ca,5
14,15,Jennifer,Peterson,Rogers Canada,700 W Pender Street,Vancouver,BC,Canada,V6C 1G8,+1 (604) 688-2255,+1 (604) 688-8756,jenniferp@rogers.ca,3
15,16,Frank,Harris,Google Inc.,1600 Amphitheatre Parkway,Mountain View,CA,USA,94043-1351,+1 (650) 253-0000,+1 (650) 253-0000,fharris@google.com,4
16,17,Jack,Smith,Microsoft Corporation,1 Microsoft Way,Redmond,WA,USA,98052-8300,+1 (425) 882-8080,+1 (425) 882-8081,jacksmith@microsoft.com,5
17,18,Michelle,Brooks,,627 Broadway,New York,NY,USA,10012-2612,+1 (212) 221-3546,+1 (212) 221-4679,michelleb@aol.com,3
18,19,Tim,Goyer,Apple Inc.,1 Infinite Loop,Cupertino,CA,USA,95014,+1 (408) 996-1010,+1 (408) 996-1011,tgoyer@apple.com,3
19,20,Dan,Miller,,541 Del Medio Avenue,Mountain View,CA,USA,94040-111,+1 (650) 644-3358,,dmiller@comcast.com,4
20,21,Kathy,Chase,,801 W 4th Street,Reno,NV,USA,89503,+1 (775) 223-7665,,kachase@hotmail.com,5
21,22,Heather,Leacock,,120 S Orange Ave,Orlando,FL,USA,32801,+1 (407) 999-7788,,hleacock@gmail.com,4
22,23,John,Gordon,,69 Salem Street,Boston,MA,USA,2113,+1 (617) 522-1333,,johngordon22@yahoo.com,4
23,24,Frank,Ralston,,162 E Superior Street,Chicago,IL,USA,60611,+1 (312) 332-3232,,fralston@gmail.com,3
24,25,Victor,Stevens,,319 N. Frances Street,Madison,WI,USA,53703,+1 (608) 257-0597,,vstevens@yahoo.com,5
25,26,Richard,Cunningham,,2211 W Berry Street,Fort Worth,TX,USA,76110,+1 (817) 924-7272,,ricunningham@hotmail.com,4
26,27,Patrick,Gray,,1033 N Park Ave,Tucson,AZ,USA,85719,+1 (520) 622-4200,,patrick.gray@aol.com,4
27,28,Julia,Barnett,,302 S 700 E,Salt Lake City,UT,USA,84102,+1 (801) 531-7272,,jubarnett@gmail.com,5
28,29,Robert,Brown,,796 Dundas Street West,Toronto,ON,Canada,M6J 1V1,+1 (416) 363-8888,,robbrown@shaw.ca,3
29,30,Edward,Francis,,230 Elgin Street,Ottawa,ON,Canada,K2P 1L7,+1 (613) 234-3322,,edfrancis@yachoo.ca,3
30,31,Martha,Silk,,194A Chain Lake Drive,Halifax,NS,Canada,B3S 1C5,+1 (902) 450-0450,,marthasilk@gmail.com,5
31,32,Aaron,Mitchell,,696 Osborne Street,Winnipeg,MB,Canada,R3L 2B9,+1 (204) 452-6452,,aaronmitchell@yahoo.ca,4
32,33,Ellie,Sullivan,,5112 48 Street,Yellowknife,NT,Canada,X1A 1N6,+1 (867) 920-2233,,ellie.sullivan@shaw.ca,3
33,34,João,Fernandes,,Rua da Assunção 53,Lisbon,,Portugal,,+351 (213) 466-111,,jfernandes@yahoo.pt,4
34,35,Madalena,Sampaio,,"Rua dos Campeões Europeus de Viena, 4350",Porto,,Portugal,,+351 (225) 022-448,,masampaio@sapo.pt,4
35,36,Hannah,Schneider,,Tauentzienstraße 8,Berlin,,Germany,10789,+49 030 26550280,,hannah.schneider@yahoo.de,5
36,37,Fynn,Zimmermann,,Berger Straße 10,Frankfurt,,Germany,60316,+49 069 40598889,,fzimmermann@yahoo.de,3
37,38,Niklas,Schröder,,Barbarossastraße 19,Berlin,,Germany,10779,+49 030 2141444,,nschroder@surfeu.de,3
38,39,Camille,Bernard,,"4, Rue Milton",Paris,,France,75009,+33 01 49 70 65 65,,camille.bernard@yahoo.fr,4
39,40,Dominique,Lefebvre,,"8, Rue Hanovre",Paris,,France,75002,+33 01 47 42 71 71,,dominiquelefebvre@gmail.com,4
40,41,Marc,Dubois,,"11, Place Bellecour",Lyon,,France,69002,+33 04 78 30 30 30,,marc.dubois@hotmail.com,5
41,42,Wyatt,Girard,,"9, Place Louis Barthou",Bordeaux,,France,33000,+33 05 56 96 96 96,,wyatt.girard@yahoo.fr,3
42,43,Isabelle,Mercier,,"68, Rue Jouvence",Dijon,,France,21000,+33 03 80 73 66 99,,isabelle_mercier@apple.fr,3
43,44,Terhi,Hämäläinen,,Porthaninkatu 9,Helsinki,,Finland,00530,+358 09 870 2000,,terhi.hamalainen@apple.fi,3
44,45,Ladislav,Kovács,,Erzsébet krt. 58.,Budapest,,Hungary,H-1073,,,ladislav_kovacs@apple.hu,3
45,46,Hugh,O'Reilly,,3 Chatham Street,Dublin,Dublin,Ireland,,+353 01 6792424,,hughoreilly@apple.ie,3
46,47,Lucas,Mancini,,"Via Degli Scipioni, 43",Rome,RM,Italy,00192,+39 06 39733434,,lucas.mancini@yahoo.it,5
47,48,Johannes,Van der Berg,,Lijnbaansgracht 120bg,Amsterdam,VV,Netherlands,1016,+31 020 6223130,,johavanderberg@yahoo.nl,5
48,49,Stanisław,Wójcik,,Ordynacka 10,Warsaw,,Poland,00-358,+48 22 828 37 39,,stanisław.wójcik@wp.pl,4
49,50,Enrique,Muñoz,,C/ San Bernardo 85,Madrid,,Spain,28015,+34 914 454 454,,enrique_munoz@yahoo.es,5
50,51,Joakim,Johansson,,Celsiusg. 9,Stockholm,,Sweden,11230,+46 08-651 52 52,,joakim.johansson@yahoo.se,5
51,52,Emma,Jones,,202 Hoxton Street,London,,United Kingdom,N1 5LH,+44 020 7707 0707,,emma_jones@hotmail.com,3
52,53,Phil,Hughes,,113 Lupus St,London,,United Kingdom,SW1V 3EN,+44 020 7976 5722,,phil.hughes@gmail.com,3
53,54,Steve,Murray,,110 Raeburn Pl,Edinburgh ,,United Kingdom,EH4 1HH,+44 0131 315 3300,,steve.murray@yahoo.uk,5
54,55,Mark,Taylor,,421 Bourke Street,Sidney,NSW,Australia,2010,+61 (02) 9332 3633,,mark.taylor@yahoo.au,4
55,56,Diego,Gutiérrez,,307 Macacha Güemes,Buenos Aires,,Argentina,1106,+54 (0)11 4311 4333,,diego.gutierrez@yahoo.ar,4
56,57,Luis,Rojas,,"Calle Lira, 198",Santiago,,Chile,,+56 (0)2 635 4444,,luisrojas@yahoo.cl,5
57,58,Manoj,Pareek,,"12,Community Centre",Delhi,,India,110017,+91 0124 39883988,,manoj.pareek@rediff.com,3
58,59,Puja,Srivastava,,"3,Raj Bhavan Road",Bangalore,,India,560001,+91 080 22289999,,puja_srivastava@yahoo.in,3
1 CustomerId FirstName LastName Company Address City State Country PostalCode Phone Fax Email SupportRepId
2 0 1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 luisg@embraer.com.br 3
3 1 2 Leonie Köhler Theodor-Heuss-Straße 34 Stuttgart Germany 70174 +49 0711 2842222 leonekohler@surfeu.de 5
4 2 3 François Tremblay 1498 rue Bélanger Montréal QC Canada H2G 1A7 +1 (514) 721-4711 ftremblay@gmail.com 3
5 3 4 Bjørn Hansen Ullevålsveien 14 Oslo Norway 0171 +47 22 44 22 22 bjorn.hansen@yahoo.no 4
6 4 5 František Wichterlová JetBrains s.r.o. Klanova 9/506 Prague Czech Republic 14700 +420 2 4172 5555 +420 2 4172 5555 frantisekw@jetbrains.com 4
7 5 6 Helena Holý Rilská 3174/6 Prague Czech Republic 14300 +420 2 4177 0449 hholy@gmail.com 5
8 6 7 Astrid Gruber Rotenturmstraße 4, 1010 Innere Stadt Vienne Austria 1010 +43 01 5134505 astrid.gruber@apple.at 5
9 7 8 Daan Peeters Grétrystraat 63 Brussels Belgium 1000 +32 02 219 03 03 daan_peeters@apple.be 4
10 8 9 Kara Nielsen Sønder Boulevard 51 Copenhagen Denmark 1720 +453 3331 9991 kara.nielsen@jubii.dk 4
11 9 10 Eduardo Martins Woodstock Discos Rua Dr. Falcão Filho, 155 São Paulo SP Brazil 01007-010 +55 (11) 3033-5446 +55 (11) 3033-4564 eduardo@woodstock.com.br 4
12 10 11 Alexandre Rocha Banco do Brasil S.A. Av. Paulista, 2022 São Paulo SP Brazil 01310-200 +55 (11) 3055-3278 +55 (11) 3055-8131 alero@uol.com.br 5
13 11 12 Roberto Almeida Riotur Praça Pio X, 119 Rio de Janeiro RJ Brazil 20040-020 +55 (21) 2271-7000 +55 (21) 2271-7070 roberto.almeida@riotur.gov.br 3
14 12 13 Fernanda Ramos Qe 7 Bloco G Brasília DF Brazil 71020-677 +55 (61) 3363-5547 +55 (61) 3363-7855 fernadaramos4@uol.com.br 4
15 13 14 Mark Philips Telus 8210 111 ST NW Edmonton AB Canada T6G 2C7 +1 (780) 434-4554 +1 (780) 434-5565 mphilips12@shaw.ca 5
16 14 15 Jennifer Peterson Rogers Canada 700 W Pender Street Vancouver BC Canada V6C 1G8 +1 (604) 688-2255 +1 (604) 688-8756 jenniferp@rogers.ca 3
17 15 16 Frank Harris Google Inc. 1600 Amphitheatre Parkway Mountain View CA USA 94043-1351 +1 (650) 253-0000 +1 (650) 253-0000 fharris@google.com 4
18 16 17 Jack Smith Microsoft Corporation 1 Microsoft Way Redmond WA USA 98052-8300 +1 (425) 882-8080 +1 (425) 882-8081 jacksmith@microsoft.com 5
19 17 18 Michelle Brooks 627 Broadway New York NY USA 10012-2612 +1 (212) 221-3546 +1 (212) 221-4679 michelleb@aol.com 3
20 18 19 Tim Goyer Apple Inc. 1 Infinite Loop Cupertino CA USA 95014 +1 (408) 996-1010 +1 (408) 996-1011 tgoyer@apple.com 3
21 19 20 Dan Miller 541 Del Medio Avenue Mountain View CA USA 94040-111 +1 (650) 644-3358 dmiller@comcast.com 4
22 20 21 Kathy Chase 801 W 4th Street Reno NV USA 89503 +1 (775) 223-7665 kachase@hotmail.com 5
23 21 22 Heather Leacock 120 S Orange Ave Orlando FL USA 32801 +1 (407) 999-7788 hleacock@gmail.com 4
24 22 23 John Gordon 69 Salem Street Boston MA USA 2113 +1 (617) 522-1333 johngordon22@yahoo.com 4
25 23 24 Frank Ralston 162 E Superior Street Chicago IL USA 60611 +1 (312) 332-3232 fralston@gmail.com 3
26 24 25 Victor Stevens 319 N. Frances Street Madison WI USA 53703 +1 (608) 257-0597 vstevens@yahoo.com 5
27 25 26 Richard Cunningham 2211 W Berry Street Fort Worth TX USA 76110 +1 (817) 924-7272 ricunningham@hotmail.com 4
28 26 27 Patrick Gray 1033 N Park Ave Tucson AZ USA 85719 +1 (520) 622-4200 patrick.gray@aol.com 4
29 27 28 Julia Barnett 302 S 700 E Salt Lake City UT USA 84102 +1 (801) 531-7272 jubarnett@gmail.com 5
30 28 29 Robert Brown 796 Dundas Street West Toronto ON Canada M6J 1V1 +1 (416) 363-8888 robbrown@shaw.ca 3
31 29 30 Edward Francis 230 Elgin Street Ottawa ON Canada K2P 1L7 +1 (613) 234-3322 edfrancis@yachoo.ca 3
32 30 31 Martha Silk 194A Chain Lake Drive Halifax NS Canada B3S 1C5 +1 (902) 450-0450 marthasilk@gmail.com 5
33 31 32 Aaron Mitchell 696 Osborne Street Winnipeg MB Canada R3L 2B9 +1 (204) 452-6452 aaronmitchell@yahoo.ca 4
34 32 33 Ellie Sullivan 5112 48 Street Yellowknife NT Canada X1A 1N6 +1 (867) 920-2233 ellie.sullivan@shaw.ca 3
35 33 34 João Fernandes Rua da Assunção 53 Lisbon Portugal +351 (213) 466-111 jfernandes@yahoo.pt 4
36 34 35 Madalena Sampaio Rua dos Campeões Europeus de Viena, 4350 Porto Portugal +351 (225) 022-448 masampaio@sapo.pt 4
37 35 36 Hannah Schneider Tauentzienstraße 8 Berlin Germany 10789 +49 030 26550280 hannah.schneider@yahoo.de 5
38 36 37 Fynn Zimmermann Berger Straße 10 Frankfurt Germany 60316 +49 069 40598889 fzimmermann@yahoo.de 3
39 37 38 Niklas Schröder Barbarossastraße 19 Berlin Germany 10779 +49 030 2141444 nschroder@surfeu.de 3
40 38 39 Camille Bernard 4, Rue Milton Paris France 75009 +33 01 49 70 65 65 camille.bernard@yahoo.fr 4
41 39 40 Dominique Lefebvre 8, Rue Hanovre Paris France 75002 +33 01 47 42 71 71 dominiquelefebvre@gmail.com 4
42 40 41 Marc Dubois 11, Place Bellecour Lyon France 69002 +33 04 78 30 30 30 marc.dubois@hotmail.com 5
43 41 42 Wyatt Girard 9, Place Louis Barthou Bordeaux France 33000 +33 05 56 96 96 96 wyatt.girard@yahoo.fr 3
44 42 43 Isabelle Mercier 68, Rue Jouvence Dijon France 21000 +33 03 80 73 66 99 isabelle_mercier@apple.fr 3
45 43 44 Terhi Hämäläinen Porthaninkatu 9 Helsinki Finland 00530 +358 09 870 2000 terhi.hamalainen@apple.fi 3
46 44 45 Ladislav Kovács Erzsébet krt. 58. Budapest Hungary H-1073 ladislav_kovacs@apple.hu 3
47 45 46 Hugh O'Reilly 3 Chatham Street Dublin Dublin Ireland +353 01 6792424 hughoreilly@apple.ie 3
48 46 47 Lucas Mancini Via Degli Scipioni, 43 Rome RM Italy 00192 +39 06 39733434 lucas.mancini@yahoo.it 5
49 47 48 Johannes Van der Berg Lijnbaansgracht 120bg Amsterdam VV Netherlands 1016 +31 020 6223130 johavanderberg@yahoo.nl 5
50 48 49 Stanisław Wójcik Ordynacka 10 Warsaw Poland 00-358 +48 22 828 37 39 stanisław.wójcik@wp.pl 4
51 49 50 Enrique Muñoz C/ San Bernardo 85 Madrid Spain 28015 +34 914 454 454 enrique_munoz@yahoo.es 5
52 50 51 Joakim Johansson Celsiusg. 9 Stockholm Sweden 11230 +46 08-651 52 52 joakim.johansson@yahoo.se 5
53 51 52 Emma Jones 202 Hoxton Street London United Kingdom N1 5LH +44 020 7707 0707 emma_jones@hotmail.com 3
54 52 53 Phil Hughes 113 Lupus St London United Kingdom SW1V 3EN +44 020 7976 5722 phil.hughes@gmail.com 3
55 53 54 Steve Murray 110 Raeburn Pl Edinburgh United Kingdom EH4 1HH +44 0131 315 3300 steve.murray@yahoo.uk 5
56 54 55 Mark Taylor 421 Bourke Street Sidney NSW Australia 2010 +61 (02) 9332 3633 mark.taylor@yahoo.au 4
57 55 56 Diego Gutiérrez 307 Macacha Güemes Buenos Aires Argentina 1106 +54 (0)11 4311 4333 diego.gutierrez@yahoo.ar 4
58 56 57 Luis Rojas Calle Lira, 198 Santiago Chile +56 (0)2 635 4444 luisrojas@yahoo.cl 5
59 57 58 Manoj Pareek 12,Community Centre Delhi India 110017 +91 0124 39883988 manoj.pareek@rediff.com 3
60 58 59 Puja Srivastava 3,Raj Bhavan Road Bangalore India 560001 +91 080 22289999 puja_srivastava@yahoo.in 3

View File

@ -478,14 +478,60 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 0\n",
"1 1\n",
"2 2\n",
"3 3\n",
"4 4\n",
"5 5\n",
"6 6\n",
"7 7\n",
"8 8\n",
"9 9\n",
"10 10\n",
"dtype: int64 0 0\n",
"1 1\n",
"2 4\n",
"3 9\n",
"4 16\n",
"5 25\n",
"6 36\n",
"7 49\n",
"8 64\n",
"9 81\n",
"10 100\n",
"dtype: int64 0 0.0\n",
"1 1.5\n",
"2 4.0\n",
"3 7.5\n",
"4 12.0\n",
"5 17.5\n",
"6 24.0\n",
"7 31.5\n",
"8 40.0\n",
"9 49.5\n",
"10 60.0\n",
"dtype: float64\n"
]
}
],
"source": [
"n = pd.Series(range(0, 11))\n",
"n2 = n * n\n",
"trojkatne = n + n2 / 2\n",
"print(n, n2, trojkatne)"
]
},
{
"cell_type": "markdown",
@ -522,7 +568,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 14,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -581,7 +627,7 @@
"July 779511 194316"
]
},
"execution_count": 9,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@ -607,7 +653,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 15,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -666,7 +712,7 @@
"2 779511 194316"
]
},
"execution_count": 10,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@ -696,7 +742,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 16,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -780,7 +826,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 17,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -975,7 +1021,7 @@
"[175 rows x 8 columns]"
]
},
"execution_count": 12,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
@ -988,7 +1034,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 18,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1144,7 +1190,7 @@
"5 0 0 373450 8.0500 NaN S "
]
},
"execution_count": 13,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@ -1167,7 +1213,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 19,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1175,103 +1221,27 @@
},
"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>start_date</th>\n",
" <th>start_station_code</th>\n",
" <th>end_date</th>\n",
" <th>end_station_code</th>\n",
" <th>duration_sec</th>\n",
" <th>is_member</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2019-04-14 07:55:22</td>\n",
" <td>6001</td>\n",
" <td>2019-04-14 08:07:16</td>\n",
" <td>6132</td>\n",
" <td>713</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2019-04-14 07:59:31</td>\n",
" <td>6411</td>\n",
" <td>2019-04-14 08:09:18</td>\n",
" <td>6411</td>\n",
" <td>587</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2019-04-14 07:59:55</td>\n",
" <td>6097</td>\n",
" <td>2019-04-14 08:12:11</td>\n",
" <td>6036</td>\n",
" <td>736</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2019-04-14 07:59:57</td>\n",
" <td>6310</td>\n",
" <td>2019-04-14 08:27:58</td>\n",
" <td>6345</td>\n",
" <td>1680</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2019-04-14 08:00:37</td>\n",
" <td>7029</td>\n",
" <td>2019-04-14 08:14:12</td>\n",
" <td>6250</td>\n",
" <td>814</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" start_date start_station_code end_date \\\n",
"0 2019-04-14 07:55:22 6001 2019-04-14 08:07:16 \n",
"1 2019-04-14 07:59:31 6411 2019-04-14 08:09:18 \n",
"2 2019-04-14 07:59:55 6097 2019-04-14 08:12:11 \n",
"3 2019-04-14 07:59:57 6310 2019-04-14 08:27:58 \n",
"4 2019-04-14 08:00:37 7029 2019-04-14 08:14:12 \n",
"\n",
" end_station_code duration_sec is_member \n",
"0 6132 713 1 \n",
"1 6411 587 1 \n",
"2 6036 736 1 \n",
"3 6345 1680 1 \n",
"4 6250 814 0 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
"ename": "ImportError",
"evalue": "Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl.",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\compat\\_optional.py:142\u001b[0m, in \u001b[0;36mimport_optional_dependency\u001b[1;34m(name, extra, errors, min_version)\u001b[0m\n\u001b[0;32m 141\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m module \u001b[39m=\u001b[39m importlib\u001b[39m.\u001b[39;49mimport_module(name)\n\u001b[0;32m 143\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mImportError\u001b[39;00m:\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\importlib\\__init__.py:126\u001b[0m, in \u001b[0;36mimport_module\u001b[1;34m(name, package)\u001b[0m\n\u001b[0;32m 125\u001b[0m level \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m \u001b[39m1\u001b[39m\n\u001b[1;32m--> 126\u001b[0m \u001b[39mreturn\u001b[39;00m _bootstrap\u001b[39m.\u001b[39;49m_gcd_import(name[level:], package, level)\n",
"File \u001b[1;32m<frozen importlib._bootstrap>:1050\u001b[0m, in \u001b[0;36m_gcd_import\u001b[1;34m(name, package, level)\u001b[0m\n",
"File \u001b[1;32m<frozen importlib._bootstrap>:1027\u001b[0m, in \u001b[0;36m_find_and_load\u001b[1;34m(name, import_)\u001b[0m\n",
"File \u001b[1;32m<frozen importlib._bootstrap>:1004\u001b[0m, in \u001b[0;36m_find_and_load_unlocked\u001b[1;34m(name, import_)\u001b[0m\n",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'openpyxl'",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mj:\\Python\\2023-programowanie-w-pythonie\\zajecia2\\data_analysis.ipynb Cell 39\u001b[0m line \u001b[0;36m1\n\u001b[1;32m----> <a href='vscode-notebook-cell:/j%3A/Python/2023-programowanie-w-pythonie/zajecia2/data_analysis.ipynb#X53sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m df \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39;49mread_excel(\u001b[39m'\u001b[39;49m\u001b[39m./bikes.xlsx\u001b[39;49m\u001b[39m'\u001b[39;49m, engine\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mopenpyxl\u001b[39;49m\u001b[39m'\u001b[39;49m, nrows\u001b[39m=\u001b[39;49m\u001b[39m5\u001b[39;49m)\n\u001b[0;32m <a href='vscode-notebook-cell:/j%3A/Python/2023-programowanie-w-pythonie/zajecia2/data_analysis.ipynb#X53sZmlsZQ%3D%3D?line=1'>2</a>\u001b[0m df\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\io\\excel\\_base.py:478\u001b[0m, in \u001b[0;36mread_excel\u001b[1;34m(io, sheet_name, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, date_format, thousands, decimal, comment, skipfooter, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m 476\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39misinstance\u001b[39m(io, ExcelFile):\n\u001b[0;32m 477\u001b[0m should_close \u001b[39m=\u001b[39m \u001b[39mTrue\u001b[39;00m\n\u001b[1;32m--> 478\u001b[0m io \u001b[39m=\u001b[39m ExcelFile(io, storage_options\u001b[39m=\u001b[39;49mstorage_options, engine\u001b[39m=\u001b[39;49mengine)\n\u001b[0;32m 479\u001b[0m \u001b[39melif\u001b[39;00m engine \u001b[39mand\u001b[39;00m engine \u001b[39m!=\u001b[39m io\u001b[39m.\u001b[39mengine:\n\u001b[0;32m 480\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 481\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mEngine should not be specified when passing \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 482\u001b[0m \u001b[39m\"\u001b[39m\u001b[39man ExcelFile - ExcelFile already has the engine set\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 483\u001b[0m )\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\io\\excel\\_base.py:1513\u001b[0m, in \u001b[0;36mExcelFile.__init__\u001b[1;34m(self, path_or_buffer, engine, storage_options)\u001b[0m\n\u001b[0;32m 1510\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mengine \u001b[39m=\u001b[39m engine\n\u001b[0;32m 1511\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mstorage_options \u001b[39m=\u001b[39m storage_options\n\u001b[1;32m-> 1513\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_reader \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_engines[engine](\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_io, storage_options\u001b[39m=\u001b[39;49mstorage_options)\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\io\\excel\\_openpyxl.py:548\u001b[0m, in \u001b[0;36mOpenpyxlReader.__init__\u001b[1;34m(self, filepath_or_buffer, storage_options)\u001b[0m\n\u001b[0;32m 533\u001b[0m \u001b[39m@doc\u001b[39m(storage_options\u001b[39m=\u001b[39m_shared_docs[\u001b[39m\"\u001b[39m\u001b[39mstorage_options\u001b[39m\u001b[39m\"\u001b[39m])\n\u001b[0;32m 534\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__init__\u001b[39m(\n\u001b[0;32m 535\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[0;32m 536\u001b[0m filepath_or_buffer: FilePath \u001b[39m|\u001b[39m ReadBuffer[\u001b[39mbytes\u001b[39m],\n\u001b[0;32m 537\u001b[0m storage_options: StorageOptions \u001b[39m=\u001b[39m \u001b[39mNone\u001b[39;00m,\n\u001b[0;32m 538\u001b[0m ) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 539\u001b[0m \u001b[39m \u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 540\u001b[0m \u001b[39m Reader using openpyxl engine.\u001b[39;00m\n\u001b[0;32m 541\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 546\u001b[0m \u001b[39m {storage_options}\u001b[39;00m\n\u001b[0;32m 547\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 548\u001b[0m import_optional_dependency(\u001b[39m\"\u001b[39;49m\u001b[39mopenpyxl\u001b[39;49m\u001b[39m\"\u001b[39;49m)\n\u001b[0;32m 549\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__init__\u001b[39m(filepath_or_buffer, storage_options\u001b[39m=\u001b[39mstorage_options)\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\compat\\_optional.py:145\u001b[0m, in \u001b[0;36mimport_optional_dependency\u001b[1;34m(name, extra, errors, min_version)\u001b[0m\n\u001b[0;32m 143\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mImportError\u001b[39;00m:\n\u001b[0;32m 144\u001b[0m \u001b[39mif\u001b[39;00m errors \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mraise\u001b[39m\u001b[39m\"\u001b[39m:\n\u001b[1;32m--> 145\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mImportError\u001b[39;00m(msg)\n\u001b[0;32m 146\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mNone\u001b[39;00m\n\u001b[0;32m 148\u001b[0m \u001b[39m# Handle submodules: if we have submodule, grab parent module from sys.modules\u001b[39;00m\n",
"\u001b[1;31mImportError\u001b[0m: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl."
]
}
],
"source": [
@ -1293,7 +1263,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 20,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1409,7 +1379,7 @@
"[347 rows x 2 columns]"
]
},
"execution_count": 15,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
@ -1422,23 +1392,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 21,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-11-17 15:53:28,542 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1\n",
"2023-11-17 15:53:28,543 INFO sqlalchemy.engine.base.Engine ()\n",
"2023-11-17 15:53:28,544 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1\n",
"2023-11-17 15:53:28,545 INFO sqlalchemy.engine.base.Engine ()\n"
]
},
{
"data": {
"text/html": [
@ -1548,7 +1508,7 @@
"[347 rows x 2 columns]"
]
},
"execution_count": 16,
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
@ -1602,7 +1562,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 22,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1618,14 +1578,30 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 27,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'openpyxl'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mj:\\Python\\2023-programowanie-w-pythonie\\zajecia2\\data_analysis.ipynb Cell 47\u001b[0m line \u001b[0;36m4\n\u001b[0;32m <a href='vscode-notebook-cell:/j%3A/Python/2023-programowanie-w-pythonie/zajecia2/data_analysis.ipynb#X64sZmlsZQ%3D%3D?line=1'>2</a>\u001b[0m df\u001b[39m.\u001b[39mto_csv(\u001b[39m'\u001b[39m\u001b[39mtmp.csv\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m <a href='vscode-notebook-cell:/j%3A/Python/2023-programowanie-w-pythonie/zajecia2/data_analysis.ipynb#X64sZmlsZQ%3D%3D?line=2'>3</a>\u001b[0m \u001b[39m# zapis do arkusza kalkulacyjnego \u001b[39;00m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/j%3A/Python/2023-programowanie-w-pythonie/zajecia2/data_analysis.ipynb#X64sZmlsZQ%3D%3D?line=3'>4</a>\u001b[0m df\u001b[39m.\u001b[39;49mto_excel(\u001b[39m'\u001b[39;49m\u001b[39mtmp.xlsx\u001b[39;49m\u001b[39m'\u001b[39;49m)\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\core\\generic.py:2252\u001b[0m, in \u001b[0;36mNDFrame.to_excel\u001b[1;34m(self, excel_writer, sheet_name, na_rep, float_format, columns, header, index, index_label, startrow, startcol, engine, merge_cells, inf_rep, freeze_panes, storage_options)\u001b[0m\n\u001b[0;32m 2239\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mpandas\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mio\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mformats\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mexcel\u001b[39;00m \u001b[39mimport\u001b[39;00m ExcelFormatter\n\u001b[0;32m 2241\u001b[0m formatter \u001b[39m=\u001b[39m ExcelFormatter(\n\u001b[0;32m 2242\u001b[0m df,\n\u001b[0;32m 2243\u001b[0m na_rep\u001b[39m=\u001b[39mna_rep,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 2250\u001b[0m inf_rep\u001b[39m=\u001b[39minf_rep,\n\u001b[0;32m 2251\u001b[0m )\n\u001b[1;32m-> 2252\u001b[0m formatter\u001b[39m.\u001b[39;49mwrite(\n\u001b[0;32m 2253\u001b[0m excel_writer,\n\u001b[0;32m 2254\u001b[0m sheet_name\u001b[39m=\u001b[39;49msheet_name,\n\u001b[0;32m 2255\u001b[0m startrow\u001b[39m=\u001b[39;49mstartrow,\n\u001b[0;32m 2256\u001b[0m startcol\u001b[39m=\u001b[39;49mstartcol,\n\u001b[0;32m 2257\u001b[0m freeze_panes\u001b[39m=\u001b[39;49mfreeze_panes,\n\u001b[0;32m 2258\u001b[0m engine\u001b[39m=\u001b[39;49mengine,\n\u001b[0;32m 2259\u001b[0m storage_options\u001b[39m=\u001b[39;49mstorage_options,\n\u001b[0;32m 2260\u001b[0m )\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\io\\formats\\excel.py:934\u001b[0m, in \u001b[0;36mExcelFormatter.write\u001b[1;34m(self, writer, sheet_name, startrow, startcol, freeze_panes, engine, storage_options)\u001b[0m\n\u001b[0;32m 930\u001b[0m need_save \u001b[39m=\u001b[39m \u001b[39mFalse\u001b[39;00m\n\u001b[0;32m 931\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 932\u001b[0m \u001b[39m# error: Cannot instantiate abstract class 'ExcelWriter' with abstract\u001b[39;00m\n\u001b[0;32m 933\u001b[0m \u001b[39m# attributes 'engine', 'save', 'supported_extensions' and 'write_cells'\u001b[39;00m\n\u001b[1;32m--> 934\u001b[0m writer \u001b[39m=\u001b[39m ExcelWriter( \u001b[39m# type: ignore[abstract]\u001b[39;49;00m\n\u001b[0;32m 935\u001b[0m writer, engine\u001b[39m=\u001b[39;49mengine, storage_options\u001b[39m=\u001b[39;49mstorage_options\n\u001b[0;32m 936\u001b[0m )\n\u001b[0;32m 937\u001b[0m need_save \u001b[39m=\u001b[39m \u001b[39mTrue\u001b[39;00m\n\u001b[0;32m 939\u001b[0m \u001b[39mtry\u001b[39;00m:\n",
"File \u001b[1;32mc:\\software\\python3\\lib\\site-packages\\pandas\\io\\excel\\_openpyxl.py:56\u001b[0m, in \u001b[0;36mOpenpyxlWriter.__init__\u001b[1;34m(self, path, engine, date_format, datetime_format, mode, storage_options, if_sheet_exists, engine_kwargs, **kwargs)\u001b[0m\n\u001b[0;32m 43\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__init__\u001b[39m(\n\u001b[0;32m 44\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[0;32m 45\u001b[0m path: FilePath \u001b[39m|\u001b[39m WriteExcelBuffer \u001b[39m|\u001b[39m ExcelWriter,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 54\u001b[0m ) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 55\u001b[0m \u001b[39m# Use the openpyxl module as the Excel writer.\u001b[39;00m\n\u001b[1;32m---> 56\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mopenpyxl\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mworkbook\u001b[39;00m \u001b[39mimport\u001b[39;00m Workbook\n\u001b[0;32m 58\u001b[0m engine_kwargs \u001b[39m=\u001b[39m combine_kwargs(engine_kwargs, kwargs)\n\u001b[0;32m 60\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__init__\u001b[39m(\n\u001b[0;32m 61\u001b[0m path,\n\u001b[0;32m 62\u001b[0m mode\u001b[39m=\u001b[39mmode,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 65\u001b[0m engine_kwargs\u001b[39m=\u001b[39mengine_kwargs,\n\u001b[0;32m 66\u001b[0m )\n",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'openpyxl'"
]
}
],
"source": [
"\n",
"# zapis do formatu CSV\n",
"df.to_csv('tmp.csv')\n",
"# zapis do arkusza kalkulacyjnego \n",
@ -1645,7 +1621,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 28,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1666,7 +1642,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 29,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1698,7 +1674,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 30,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1739,14 +1715,450 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 38,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"{0: 'Germany',\n",
" 1: 'Norway',\n",
" 2: 'Belgium',\n",
" 3: 'Canada',\n",
" 4: 'USA',\n",
" 5: 'Germany',\n",
" 6: 'Germany',\n",
" 7: 'France',\n",
" 8: 'France',\n",
" 9: 'Ireland',\n",
" 10: 'United Kingdom',\n",
" 11: 'Germany',\n",
" 12: 'USA',\n",
" 13: 'USA',\n",
" 14: 'USA',\n",
" 15: 'USA',\n",
" 16: 'USA',\n",
" 17: 'Canada',\n",
" 18: 'France',\n",
" 19: 'United Kingdom',\n",
" 20: 'Australia',\n",
" 21: 'Chile',\n",
" 22: 'India',\n",
" 23: 'Norway',\n",
" 24: 'Brazil',\n",
" 25: 'USA',\n",
" 26: 'Canada',\n",
" 27: 'Portugal',\n",
" 28: 'Germany',\n",
" 29: 'Germany',\n",
" 30: 'France',\n",
" 31: 'Netherlands',\n",
" 32: 'Chile',\n",
" 33: 'Brazil',\n",
" 34: 'Brazil',\n",
" 35: 'Canada',\n",
" 36: 'USA',\n",
" 37: 'USA',\n",
" 38: 'USA',\n",
" 39: 'Germany',\n",
" 40: 'Spain',\n",
" 41: 'Sweden',\n",
" 42: 'United Kingdom',\n",
" 43: 'Australia',\n",
" 44: 'India',\n",
" 45: 'Czech Republic',\n",
" 46: 'Canada',\n",
" 47: 'Canada',\n",
" 48: 'Canada',\n",
" 49: 'Canada',\n",
" 50: 'Portugal',\n",
" 51: 'Germany',\n",
" 52: 'Finland',\n",
" 53: 'United Kingdom',\n",
" 54: 'Belgium',\n",
" 55: 'Denmark',\n",
" 56: 'Brazil',\n",
" 57: 'Brazil',\n",
" 58: 'USA',\n",
" 59: 'USA',\n",
" 60: 'Canada',\n",
" 61: 'Ireland',\n",
" 62: 'Italy',\n",
" 63: 'Poland',\n",
" 64: 'Sweden',\n",
" 65: 'Australia',\n",
" 66: 'Germany',\n",
" 67: 'Brazil',\n",
" 68: 'USA',\n",
" 69: 'USA',\n",
" 70: 'USA',\n",
" 71: 'Canada',\n",
" 72: 'Portugal',\n",
" 73: 'France',\n",
" 74: 'Poland',\n",
" 75: 'Norway',\n",
" 76: 'Czech Republic',\n",
" 77: 'Austria',\n",
" 78: 'Denmark',\n",
" 79: 'Brazil',\n",
" 80: 'USA',\n",
" 81: 'USA',\n",
" 82: 'France',\n",
" 83: 'France',\n",
" 84: 'Hungary',\n",
" 85: 'Italy',\n",
" 86: 'Sweden',\n",
" 87: 'Chile',\n",
" 88: 'Austria',\n",
" 89: 'USA',\n",
" 90: 'USA',\n",
" 91: 'USA',\n",
" 92: 'USA',\n",
" 93: 'Canada',\n",
" 94: 'Germany',\n",
" 95: 'Hungary',\n",
" 96: 'India',\n",
" 97: 'Brazil',\n",
" 98: 'Canada',\n",
" 99: 'Czech Republic',\n",
" 100: 'Denmark',\n",
" 101: 'Canada',\n",
" 102: 'USA',\n",
" 103: 'Germany',\n",
" 104: 'France',\n",
" 105: 'France',\n",
" 106: 'France',\n",
" 107: 'Italy',\n",
" 108: 'United Kingdom',\n",
" 109: 'Canada',\n",
" 110: 'USA',\n",
" 111: 'USA',\n",
" 112: 'USA',\n",
" 113: 'USA',\n",
" 114: 'USA',\n",
" 115: 'Canada',\n",
" 116: 'France',\n",
" 117: 'Australia',\n",
" 118: 'Argentina',\n",
" 119: 'India',\n",
" 120: 'Brazil',\n",
" 121: 'Czech Republic',\n",
" 122: 'Brazil',\n",
" 123: 'USA',\n",
" 124: 'Portugal',\n",
" 125: 'Portugal',\n",
" 126: 'Germany',\n",
" 127: 'France',\n",
" 128: 'France',\n",
" 129: 'Poland',\n",
" 130: 'India',\n",
" 131: 'Brazil',\n",
" 132: 'Canada',\n",
" 133: 'USA',\n",
" 134: 'USA',\n",
" 135: 'USA',\n",
" 136: 'USA',\n",
" 137: 'Germany',\n",
" 138: 'Sweden',\n",
" 139: 'United Kingdom',\n",
" 140: 'United Kingdom',\n",
" 141: 'Argentina',\n",
" 142: 'Brazil',\n",
" 143: 'Austria',\n",
" 144: 'USA',\n",
" 145: 'Canada',\n",
" 146: 'Canada',\n",
" 147: 'Canada',\n",
" 148: 'Portugal',\n",
" 149: 'France',\n",
" 150: 'Hungary',\n",
" 151: 'United Kingdom',\n",
" 152: 'Denmark',\n",
" 153: 'Brazil',\n",
" 154: 'Brazil',\n",
" 155: 'Canada',\n",
" 156: 'USA',\n",
" 157: 'USA',\n",
" 158: 'Canada',\n",
" 159: 'Italy',\n",
" 160: 'Netherlands',\n",
" 161: 'Spain',\n",
" 162: 'United Kingdom',\n",
" 163: 'Argentina',\n",
" 164: 'Canada',\n",
" 165: 'Brazil',\n",
" 166: 'USA',\n",
" 167: 'USA',\n",
" 168: 'Canada',\n",
" 169: 'Canada',\n",
" 170: 'Portugal',\n",
" 171: 'France',\n",
" 172: 'Spain',\n",
" 173: 'Czech Republic',\n",
" 174: 'Czech Republic',\n",
" 175: 'Belgium',\n",
" 176: 'Brazil',\n",
" 177: 'Canada',\n",
" 178: 'USA',\n",
" 179: 'Canada',\n",
" 180: 'France',\n",
" 181: 'Finland',\n",
" 182: 'Ireland',\n",
" 183: 'Netherlands',\n",
" 184: 'United Kingdom',\n",
" 185: 'India',\n",
" 186: 'Belgium',\n",
" 187: 'USA',\n",
" 188: 'USA',\n",
" 189: 'USA',\n",
" 190: 'USA',\n",
" 191: 'Canada',\n",
" 192: 'Germany',\n",
" 193: 'Ireland',\n",
" 194: 'Brazil',\n",
" 195: 'Germany',\n",
" 196: 'Norway',\n",
" 197: 'Czech Republic',\n",
" 198: 'Brazil',\n",
" 199: 'USA',\n",
" 200: 'USA',\n",
" 201: 'France',\n",
" 202: 'France',\n",
" 203: 'France',\n",
" 204: 'Finland',\n",
" 205: 'Netherlands',\n",
" 206: 'United Kingdom',\n",
" 207: 'Norway',\n",
" 208: 'USA',\n",
" 209: 'USA',\n",
" 210: 'USA',\n",
" 211: 'USA',\n",
" 212: 'USA',\n",
" 213: 'Canada',\n",
" 214: 'France',\n",
" 215: 'Argentina',\n",
" 216: 'Chile',\n",
" 217: 'India',\n",
" 218: 'Germany',\n",
" 219: 'Czech Republic',\n",
" 220: 'Brazil',\n",
" 221: 'USA',\n",
" 222: 'Portugal',\n",
" 223: 'Germany',\n",
" 224: 'Germany',\n",
" 225: 'France',\n",
" 226: 'Finland',\n",
" 227: 'Spain',\n",
" 228: 'India',\n",
" 229: 'Canada',\n",
" 230: 'Canada',\n",
" 231: 'USA',\n",
" 232: 'USA',\n",
" 233: 'USA',\n",
" 234: 'Canada',\n",
" 235: 'Germany',\n",
" 236: 'United Kingdom',\n",
" 237: 'United Kingdom',\n",
" 238: 'Australia',\n",
" 239: 'Chile',\n",
" 240: 'Germany',\n",
" 241: 'Belgium',\n",
" 242: 'USA',\n",
" 243: 'Canada',\n",
" 244: 'Canada',\n",
" 245: 'Portugal',\n",
" 246: 'Germany',\n",
" 247: 'France',\n",
" 248: 'Ireland',\n",
" 249: 'Australia',\n",
" 250: 'Brazil',\n",
" 251: 'Brazil',\n",
" 252: 'Brazil',\n",
" 253: 'Canada',\n",
" 254: 'USA',\n",
" 255: 'USA',\n",
" 256: 'Portugal',\n",
" 257: 'Netherlands',\n",
" 258: 'Poland',\n",
" 259: 'Sweden',\n",
" 260: 'United Kingdom',\n",
" 261: 'Chile',\n",
" 262: 'Norway',\n",
" 263: 'Brazil',\n",
" 264: 'USA',\n",
" 265: 'USA',\n",
" 266: 'Canada',\n",
" 267: 'Canada',\n",
" 268: 'Germany',\n",
" 269: 'France',\n",
" 270: 'Sweden',\n",
" 271: 'Czech Republic',\n",
" 272: 'Austria',\n",
" 273: 'Denmark',\n",
" 274: 'Brazil',\n",
" 275: 'Canada',\n",
" 276: 'USA',\n",
" 277: 'Canada',\n",
" 278: 'Finland',\n",
" 279: 'Hungary',\n",
" 280: 'Italy',\n",
" 281: 'Poland',\n",
" 282: 'United Kingdom',\n",
" 283: 'India',\n",
" 284: 'Denmark',\n",
" 285: 'USA',\n",
" 286: 'USA',\n",
" 287: 'USA',\n",
" 288: 'USA',\n",
" 289: 'Canada',\n",
" 290: 'Germany',\n",
" 291: 'Italy',\n",
" 292: 'Germany',\n",
" 293: 'Canada',\n",
" 294: 'Czech Republic',\n",
" 295: 'Austria',\n",
" 296: 'Brazil',\n",
" 297: 'USA',\n",
" 298: 'USA',\n",
" 299: 'France',\n",
" 300: 'France',\n",
" 301: 'France',\n",
" 302: 'Hungary',\n",
" 303: 'Poland',\n",
" 304: 'Australia',\n",
" 305: 'Czech Republic',\n",
" 306: 'USA',\n",
" 307: 'USA',\n",
" 308: 'USA',\n",
" 309: 'USA',\n",
" 310: 'USA',\n",
" 311: 'Portugal',\n",
" 312: 'France',\n",
" 313: 'Chile',\n",
" 314: 'India',\n",
" 315: 'Brazil',\n",
" 316: 'Canada',\n",
" 317: 'Austria',\n",
" 318: 'Brazil',\n",
" 319: 'USA',\n",
" 320: 'Germany',\n",
" 321: 'Germany',\n",
" 322: 'France',\n",
" 323: 'France',\n",
" 324: 'Hungary',\n",
" 325: 'Sweden',\n",
" 326: 'Brazil',\n",
" 327: 'Canada',\n",
" 328: 'USA',\n",
" 329: 'USA',\n",
" 330: 'USA',\n",
" 331: 'USA',\n",
" 332: 'Canada',\n",
" 333: 'France',\n",
" 334: 'United Kingdom',\n",
" 335: 'United Kingdom',\n",
" 336: 'Argentina',\n",
" 337: 'India',\n",
" 338: 'Canada',\n",
" 339: 'Denmark',\n",
" 340: 'USA',\n",
" 341: 'Canada',\n",
" 342: 'Canada',\n",
" 343: 'Portugal',\n",
" 344: 'Germany',\n",
" 345: 'France',\n",
" 346: 'Italy',\n",
" 347: 'Argentina',\n",
" 348: 'Brazil',\n",
" 349: 'Brazil',\n",
" 350: 'Canada',\n",
" 351: 'USA',\n",
" 352: 'USA',\n",
" 353: 'USA',\n",
" 354: 'Portugal',\n",
" 355: 'Poland',\n",
" 356: 'Spain',\n",
" 357: 'United Kingdom',\n",
" 358: 'United Kingdom',\n",
" 359: 'India',\n",
" 360: 'Czech Republic',\n",
" 361: 'Canada',\n",
" 362: 'USA',\n",
" 363: 'Canada',\n",
" 364: 'Canada',\n",
" 365: 'Canada',\n",
" 366: 'Germany',\n",
" 367: 'France',\n",
" 368: 'United Kingdom',\n",
" 369: 'Austria',\n",
" 370: 'Belgium',\n",
" 371: 'Brazil',\n",
" 372: 'Brazil',\n",
" 373: 'USA',\n",
" 374: 'USA',\n",
" 375: 'Canada',\n",
" 376: 'Hungary',\n",
" 377: 'Ireland',\n",
" 378: 'Netherlands',\n",
" 379: 'Spain',\n",
" 380: 'United Kingdom',\n",
" 381: 'Brazil',\n",
" 382: 'Brazil',\n",
" 383: 'USA',\n",
" 384: 'USA',\n",
" 385: 'USA',\n",
" 386: 'Canada',\n",
" 387: 'Canada',\n",
" 388: 'France',\n",
" 389: 'Netherlands',\n",
" 390: 'Canada',\n",
" 391: 'Norway',\n",
" 392: 'Czech Republic',\n",
" 393: 'Belgium',\n",
" 394: 'Brazil',\n",
" 395: 'USA',\n",
" 396: 'USA',\n",
" 397: 'France',\n",
" 398: 'France',\n",
" 399: 'Finland',\n",
" 400: 'Ireland',\n",
" 401: 'Spain',\n",
" 402: 'Argentina',\n",
" 403: 'Czech Republic',\n",
" 404: 'USA',\n",
" 405: 'USA',\n",
" 406: 'USA',\n",
" 407: 'USA',\n",
" 408: 'Canada',\n",
" 409: 'Portugal',\n",
" 410: 'Finland',\n",
" 411: 'India'}"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sqlalchemy\n",
"\n",
"engine = sqlalchemy.create_engine('sqlite:///Chinook.sqlite', echo=True)\n",
"connection = engine.raw_connection()\n",
"\n",
"df = pd.read_sql('SELECT * FROM Customer', con='sqlite:///Chinook.sqlite')\n",
"df.to_csv('customers.csv')\n",
"\n",
"df = pd.read_sql('SELECT * FROM Employee', con='sqlite:///Chinook.sqlite')\n",
"# df['City'].drop_duplicates()\n",
"\n",
"df = pd.read_sql('SELECT * FROM Invoice', con='sqlite:///Chinook.sqlite')\n",
"df['BillingCountry'].drop_duplicates().to_dict()\n"
]
},
{
"cell_type": "markdown",
@ -8095,7 +8507,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.10.11"
}
},
"nbformat": 4,

View File

@ -1,4 +1,4 @@
,members,occasionals
May,682758,147898
June,737011,171494
July,779511,194316
,members,occasionals
May,682758,147898
June,737011,171494
July,779511,194316

1 members occasionals
2 May 682758 147898
3 June 737011 171494
4 July 779511 194316

File diff suppressed because it is too large Load Diff

View File

@ -25,119 +25,17 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"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>Unnamed: 0</th>\n",
" <th>Id</th>\n",
" <th>Expected</th>\n",
" <th>Rooms</th>\n",
" <th>SqrMeters</th>\n",
" <th>Floor</th>\n",
" <th>Location</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>269000</td>\n",
" <td>3</td>\n",
" <td>55.00</td>\n",
" <td>1</td>\n",
" <td>Poznań Zawady</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>320000</td>\n",
" <td>3</td>\n",
" <td>79.00</td>\n",
" <td>10</td>\n",
" <td>Poznań Rataje ul. Orła Bialego</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>146000</td>\n",
" <td>1</td>\n",
" <td>31.21</td>\n",
" <td>1</td>\n",
" <td>Poznań Nowe Miasto ul. Kawalerka W Nowym Bloku...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>189000</td>\n",
" <td>2</td>\n",
" <td>44.00</td>\n",
" <td>2</td>\n",
" <td>Poznań Grunwald Ogrody Jeżyce Centrum Łazarz u...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>480240</td>\n",
" <td>2</td>\n",
" <td>65.25</td>\n",
" <td>1</td>\n",
" <td>Poznań ul. Droga Dębińska 19</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 Id Expected Rooms SqrMeters Floor \\\n",
"0 0 1 269000 3 55.00 1 \n",
"1 1 2 320000 3 79.00 10 \n",
"2 2 3 146000 1 31.21 1 \n",
"3 3 4 189000 2 44.00 2 \n",
"4 4 5 480240 2 65.25 1 \n",
"\n",
" Location \n",
"0 Poznań Zawady \n",
"1 Poznań Rataje ul. Orła Bialego \n",
"2 Poznań Nowe Miasto ul. Kawalerka W Nowym Bloku... \n",
"3 Poznań Grunwald Ogrody Jeżyce Centrum Łazarz u... \n",
"4 Poznań ul. Droga Dębińska 19 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"df = pd.read_csv(\"./mieszkania.csv\")\n",
"# ODPOWIEDZ:\n",
"\n",
"df.head()"
"\n",
"\n",
"#df = pd.read_csv(\"./mieszkania.csv\")\n",
"\n",
"#df.head()"
]
},
{
@ -149,30 +47,16 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2 2208\n",
"3 1553\n",
"1 620\n",
"4 523\n",
"5 81\n",
"6 13\n",
"10 1\n",
"7 1\n",
"Name: Rooms, dtype: int64"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"df['Rooms'].value_counts()"
"# ODPOWIEDZ:\n",
"\n",
"\n",
"\n",
"\n",
"#df['Rooms'].value_counts()"
]
},
{
@ -202,15 +86,19 @@
"metadata": {},
"outputs": [],
"source": [
"def find_borough(desc):\n",
" dzielnice = ['Stare Miasto',\n",
" 'Wilda',\n",
" 'Jeżyce',\n",
" 'Rataje',\n",
" 'Piątkowo',\n",
" 'Winogrady',\n",
" 'Miłostowo',\n",
" 'Dębiec']"
"# ODPOWIEDZ:\n",
"\n",
"\n",
"\n",
"# def find_borough(desc):\n",
"# dzielnice = ['Stare Miasto',\n",
"# 'Wilda',\n",
"# 'Jeżyce',\n",
"# 'Rataje',\n",
"# 'Piątkowo',\n",
"# 'Winogrady',\n",
"# 'Miłostowo',\n",
"# 'Dębiec']"
]
},
{
@ -265,7 +153,10 @@
}
],
"source": [
"df[df['Rooms'] == 2]['Expected'].mean()"
"# ODPOWIEDZ:\n",
"\n",
"\n",
"#df[df['Rooms'] == 2]['Expected'].mean()"
]
},
{
@ -294,7 +185,11 @@
}
],
"source": [
"df.query('Floor == 13')['Location']"
"# ODPOWIEDZ:\n",
"\n",
"\n",
"\n",
"#df.query('Floor == 13')['Location']"
]
},
{
@ -314,7 +209,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -328,7 +223,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.8.3"
}
},
"nbformat": 4,

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

176
zajecia3/gapminder.csv Normal file
View File

@ -0,0 +1,176 @@
Country,female_BMI,male_BMI,gdp,population,under5mortality,life_expectancy,fertility
Afghanistan,21.07402,20.62058,1311.0,26528741.0,110.4,52.8,6.2
Albania,25.65726,26.44657,8644.0,2968026.0,17.9,76.8,1.76
Algeria,26.368409999999997,24.5962,12314.0,34811059.0,29.5,75.5,2.73
Angola,23.48431,22.25083,7103.0,19842251.0,192.0,56.7,6.43
Antigua and Barbuda,27.50545,25.76602,25736.0,85350.0,10.9,75.5,2.16
Argentina,27.46523,27.5017,14646.0,40381860.0,15.4,75.4,2.24
Armenia,27.1342,25.355420000000002,7383.0,2975029.0,20.0,72.3,1.4
Australia,26.87777,27.56373,41312.0,21370348.0,5.2,81.6,1.96
Austria,25.09414,26.467409999999997,43952.0,8331465.0,4.6,80.4,1.41
Azerbaijan,27.50879,25.65117,14365.0,8868713.0,43.3,69.2,1.99
Bahamas,29.13948,27.24594,24373.0,348587.0,14.5,72.2,1.89
Bahrain,28.790940000000003,27.83721,42507.0,1115777.0,9.4,77.6,2.23
Bangladesh,20.54531,20.39742,2265.0,148252473.0,55.9,68.3,2.38
Barbados,29.221690000000002,26.384390000000003,16075.0,277315.0,15.4,75.3,1.83
Belarus,26.641859999999998,26.16443,14488.0,9526453.0,7.2,70.0,1.42
Belgium,25.1446,26.75915,41641.0,10779155.0,4.7,79.6,1.82
Belize,29.81663,27.02255,8293.0,306165.0,20.1,70.7,2.91
Benin,23.74026,22.41835,1646.0,8973525.0,116.3,59.7,5.27
Bhutan,22.88243,22.8218,5663.0,694990.0,48.1,70.7,2.51
Bolivia,26.8633,24.43335,5066.0,9599916.0,52.0,71.2,3.48
Bosnia and Herzegovina,26.35874,26.611629999999998,9316.0,3839749.0,8.1,77.5,1.22
Botswana,26.09156,22.129839999999998,13858.0,1967866.0,63.8,53.2,2.86
Brazil,25.99113,25.78623,13906.0,194769696.0,18.6,73.2,1.9
Brunei,22.892310000000002,24.18179,72351.0,380786.0,9.0,76.9,2.1
Bulgaria,25.51574,26.542859999999997,15368.0,7513646.0,13.7,73.2,1.43
Burkina Faso,21.63031,21.27157,1358.0,14709011.0,130.4,58.0,6.04
Burundi,21.27927,21.50291,723.0,8821795.0,108.6,59.1,6.48
Cambodia,21.69608,20.80496,2442.0,13933660.0,51.5,66.1,3.05
Cameroon,24.9527,23.681729999999998,2571.0,19570418.0,113.8,56.6,5.17
Canada,26.698290000000004,27.4521,41468.0,33363256.0,5.8,80.8,1.68
Cape Verde,24.96136,23.515220000000003,6031.0,483824.0,28.4,70.4,2.57
Chad,21.95424,21.485689999999998,1753.0,11139740.0,168.0,54.3,6.81
Chile,27.92807,27.015420000000002,18698.0,16645940.0,8.9,78.5,1.89
China,22.91041,22.92176,7880.0,1326690636.0,18.5,73.4,1.53
Colombia,26.22529,24.94041,10489.0,44901660.0,19.7,76.2,2.43
Comoros,22.444329999999997,22.06131,1440.0,665414.0,91.2,67.1,5.05
"Congo, The Democratic Republic of the",21.6677,19.86692,607.0,61809278.0,124.5,57.5,6.45
"Congo",23.10824,21.87134,5022.0,3832771.0,72.6,58.8,5.1
Costa Rica,27.03497,26.47897,12219.0,4429506.0,10.3,79.8,1.91
Ivory Coast,23.82088,22.56469,2854.0,19261647.0,116.9,55.4,4.91
Croatia,25.17882,26.596290000000003,21873.0,4344151.0,5.9,76.2,1.43
Cuba,26.576140000000002,25.06867,17765.0,11290239.0,6.3,77.6,1.5
Cyprus,25.92587,27.41899,35828.0,1077010.0,4.2,80.0,1.49
Denmark,25.106270000000002,26.13287,45017.0,5495302.0,4.3,78.9,1.89
Djibouti,24.38177,23.38403,2502.0,809639.0,81.0,61.8,3.76
Ecuador,27.062690000000003,25.58841,9244.0,14447600.0,26.8,74.7,2.73
Egypt,30.099970000000003,26.732429999999997,9974.0,78976122.0,31.4,70.2,2.95
El Salvador,27.84092,26.36751,7450.0,6004199.0,21.6,73.7,2.32
Equatorial Guinea,24.528370000000002,23.7664,40143.0,686223.0,118.4,57.5,5.31
Eritrea,21.082320000000003,20.885089999999998,1088.0,4500638.0,60.4,60.1,5.16
Estonia,25.185979999999997,26.264459999999996,24743.0,1339941.0,5.5,74.2,1.62
Ethiopia,20.71463,20.247,931.0,83079608.0,86.9,60.0,5.19
Fiji,29.339409999999997,26.53078,7129.0,843206.0,24.0,64.9,2.74
Finland,25.58418,26.733390000000004,42122.0,5314170.0,3.3,79.6,1.85
France,24.82949,25.853289999999998,37505.0,62309529.0,4.3,81.1,1.97
Gabon,25.95121,24.0762,15800.0,1473741.0,68.0,61.7,4.28
Gambia,24.82101,21.65029,1566.0,1586749.0,87.4,65.7,5.8
Georgia,26.45014,25.54942,5900.0,4343290.0,19.3,71.8,1.79
Germany,25.73903,27.165090000000003,41199.0,80665906.0,4.4,80.0,1.37
Ghana,24.33014,22.842470000000002,2907.0,23115919.0,79.9,62.0,4.19
Greece,24.92026,26.33786,32197.0,11161755.0,4.9,80.2,1.46
Grenada,27.31948,25.179879999999997,12116.0,103934.0,13.5,70.8,2.28
Guatemala,26.84324,25.29947,6960.0,14106687.0,36.9,71.2,4.12
Guinea,22.45206,22.52449,1230.0,10427356.0,121.0,57.1,5.34
Guinea-Bissau,22.92809,21.64338,1326.0,1561293.0,127.6,53.6,5.25
Guyana,26.470190000000002,23.68465,5208.0,748096.0,41.9,65.0,2.74
Haiti,23.27785,23.66302,1600.0,9705130.0,83.3,61.0,3.5
Honduras,26.73191,25.10872,4391.0,7259470.0,26.5,71.8,3.27
"Hong Kong",23.71046,25.057470000000002,46635.0,6910384.0,3.06,82.49,1.04
Hungary,25.97839,27.115679999999998,23334.0,10050699.0,7.2,73.9,1.33
Iceland,26.02599,27.206870000000002,42294.0,310033.0,2.7,82.4,2.12
India,21.31478,20.95956,3901.0,1197070109.0,65.6,64.7,2.64
Indonesia,22.986929999999997,21.85576,7856.0,235360765.0,36.2,69.4,2.48
Iran,27.236079999999998,25.310029999999998,15955.0,72530693.0,21.4,73.1,1.88
Iraq,28.411170000000002,26.71017,11616.0,29163327.0,38.3,66.6,4.34
Ireland,26.62176,27.65325,47713.0,4480145.0,4.5,80.1,2.0
Israel,27.301920000000003,27.13151,28562.0,7093808.0,4.9,80.6,2.92
Italy,24.79289,26.4802,37475.0,59319234.0,4.1,81.5,1.39
Jamaica,27.22601,24.00421,8951.0,2717344.0,18.9,75.1,2.39
Japan,21.87088,23.50004,34800.0,127317900.0,3.4,82.5,1.34
Jordan,29.218009999999996,27.47362,10897.0,6010035.0,22.1,76.9,3.59
Kazakhstan,26.65065,26.290779999999998,18797.0,15915966.0,25.9,67.1,2.51
Kenya,23.06181,21.592579999999998,2358.0,38244442.0,71.0,60.8,4.76
Kiribati,31.30769,29.2384,1803.0,98437.0,64.5,61.5,3.13
Kuwait,31.161859999999997,29.172109999999996,91966.0,2705290.0,11.3,77.3,2.68
Latvia,25.615129999999997,26.45693,20977.0,2144215.0,10.5,72.4,1.5
Lebanon,27.70471,27.20117,14158.0,4109389.0,11.3,77.8,1.57
Lesotho,26.780520000000003,21.90157,2041.0,1972194.0,114.2,44.5,3.34
Liberia,23.21679,21.89537,588.0,3672782.0,100.9,59.9,5.19
Libya,29.19874,26.54164,29853.0,6123022.0,18.8,75.6,2.64
Lithuania,26.01424,26.86102,23223.0,3219802.0,8.2,72.1,1.42
Luxembourg,26.09326,27.434040000000003,95001.0,485079.0,2.8,81.0,1.63
Macao,24.895039999999998,25.713820000000002,80191.0,507274.0,6.72,79.32,0.94
Macedonia,25.37646,26.34473,10872.0,2055266.0,11.8,74.5,1.47
Madagascar,20.73501,21.403470000000002,1528.0,19926798.0,66.7,62.2,4.79
Malawi,22.91455,22.034679999999998,674.0,13904671.0,101.1,52.4,5.78
Malaysia,25.448320000000002,24.73069,19968.0,27197419.0,8.0,74.5,2.05
Maldives,26.4132,23.219910000000002,12029.0,321026.0,16.0,78.5,2.38
Mali,23.07655,21.78881,1602.0,14223403.0,148.3,58.5,6.82
Malta,27.04993,27.683609999999998,27872.0,406392.0,6.6,80.7,1.38
Mauritania,26.26476,22.62295,3356.0,3414552.0,103.0,67.9,4.94
Mauritius,26.09824,25.15669,14615.0,1238013.0,15.8,72.9,1.58
Mexico,28.737509999999997,27.42468,15826.0,114972821.0,17.9,75.4,2.35
Micronesia,31.28402,28.10315,3197.0,104472.0,43.1,68.0,3.59
Moldova,27.05617,24.2369,3890.0,4111168.0,17.6,70.4,1.49
Mongolia,25.71375,24.88385,7563.0,2629666.0,34.8,64.8,2.37
Montenegro,25.70186,26.55412,14183.0,619740.0,8.1,76.0,1.72
Morocco,26.223090000000003,25.63182,6091.0,31350544.0,35.8,73.3,2.44
Mozambique,23.317339999999998,21.93536,864.0,22994867.0,114.4,54.0,5.54
Myanmar,22.47733,21.44932,2891.0,51030006.0,87.2,59.4,2.05
Namibia,25.14988,22.65008,8169.0,2115703.0,62.2,59.1,3.36
Nepal,20.72814,20.76344,1866.0,26325183.0,50.7,68.4,2.9
Netherlands,25.47269,26.01541,47388.0,16519862.0,4.8,80.3,1.77
New Zealand,27.36642,27.768929999999997,32122.0,4285380.0,6.4,80.3,2.12
Nicaragua,27.57259,25.77291,4060.0,5594524.0,28.1,77.0,2.72
Niger,21.95958,21.21958,843.0,15085130.0,141.3,58.0,7.59
Nigeria,23.674020000000002,23.03322,4684.0,151115683.0,140.9,59.2,6.02
Norway,25.73772,26.934240000000003,65216.0,4771633.0,3.6,80.8,1.96
Oman,26.66535,26.241090000000003,47799.0,2652281.0,11.9,76.2,2.89
Pakistan,23.44986,22.299139999999998,4187.0,163096985.0,95.5,64.1,3.58
Panama,27.67758,26.26959,14033.0,3498679.0,21.0,77.3,2.61
Papua New Guinea,25.77189,25.015060000000002,1982.0,6540267.0,69.7,58.6,4.07
Paraguay,25.90523,25.54223,6684.0,6047131.0,25.7,74.0,3.06
Peru,25.98511,24.770410000000002,9249.0,28642048.0,23.2,78.2,2.58
Philippines,23.4671,22.872629999999997,5332.0,90297115.0,33.4,69.8,3.26
Poland,25.918870000000002,26.6738,19996.0,38525752.0,6.7,75.4,1.33
Portugal,26.183020000000003,26.68445,27747.0,10577458.0,4.1,79.4,1.36
Puerto Rico,30.2212,28.378040000000002,35855.0,3728126.0,8.78,77.0,1.69
Qatar,28.912509999999997,28.13138,126076.0,1388962.0,9.5,77.9,2.2
Romania,25.22425,25.41069,18032.0,20741669.0,16.1,73.2,1.34
Russia,27.21272,26.01131,22506.0,143123163.0,13.5,67.9,1.49
Rwanda,22.07156,22.55453,1173.0,9750314.0,78.3,64.1,5.06
Samoa,33.659079999999996,30.42475,5731.0,183440.0,18.8,72.3,4.43
Sao Tome and Principe,24.88216,23.51233,2673.0,163595.0,61.0,66.0,4.41
Saudi Arabia,29.598779999999998,27.884320000000002,44189.0,26742842.0,18.1,78.3,2.97
Senegal,24.30968,21.927429999999998,2162.0,12229703.0,75.8,63.5,5.11
Serbia,25.669970000000003,26.51495,12522.0,9109535.0,8.0,74.3,1.41
Seychelles,27.973740000000003,25.56236,20065.0,91634.0,14.2,72.9,2.28
Sierra Leone,23.93364,22.53139,1289.0,5521838.0,179.1,53.6,5.13
Singapore,22.86642,23.83996,65991.0,4849641.0,2.8,80.6,1.28
Slovak Republic,26.323729999999998,26.92717,24670.0,5396710.0,8.8,74.9,1.31
Slovenia,26.582140000000003,27.43983,30816.0,2030599.0,3.7,78.7,1.43
Solomon Islands,28.8762,27.159879999999998,1835.0,503410.0,33.1,62.3,4.36
Somalia,22.66607,21.969170000000002,615.0,9132589.0,168.5,52.6,7.06
South Africa,29.4803,26.85538,12263.0,50348811.0,66.1,53.4,2.54
Spain,26.30554,27.49975,34676.0,45817016.0,5.0,81.1,1.42
Sri Lanka,23.11717,21.96671,6907.0,19949553.0,11.7,74.0,2.32
Sudan,23.16132,22.40484,3246.0,34470138.0,84.7,65.5,4.79
Suriname,27.749859999999998,25.49887,13470.0,506657.0,26.4,70.2,2.41
Swaziland,28.448859999999996,23.16969,5887.0,1153750.0,112.2,45.1,3.7
Sweden,25.1466,26.37629,43421.0,9226333.0,3.2,81.1,1.92
Switzerland,24.07242,26.20195,55020.0,7646542.0,4.7,82.0,1.47
Syria,28.87418,26.919690000000003,6246.0,20097057.0,16.5,76.1,3.17
Tajikistan,23.84799,23.77966,2001.0,7254072.0,56.2,69.6,3.7
Tanzania,23.0843,22.47792,2030.0,42844744.0,72.4,60.4,5.54
Thailand,24.38577,23.008029999999998,12216.0,66453255.0,15.6,73.9,1.48
Togo,22.73858,21.87875,1219.0,6052937.0,96.4,57.5,4.88
Tonga,34.25969,30.99563,4748.0,102816.0,17.0,70.3,4.01
Trinidad and Tobago,28.27587,26.396690000000003,30875.0,1315372.0,24.9,71.7,1.8
Tunisia,27.93706,25.15699,9938.0,10408091.0,19.4,76.8,2.04
Turkey,28.247490000000003,26.703709999999997,16454.0,70344357.0,22.2,77.8,2.15
Turkmenistan,24.66154,25.24796,8877.0,4917541.0,63.9,67.2,2.48
Uganda,22.48126,22.35833,1437.0,31014427.0,89.3,56.0,6.34
Ukraine,26.23317,25.42379,8762.0,46028476.0,12.9,67.8,1.38
United Arab Emirates,29.614009999999997,28.053590000000003,73029.0,6900142.0,9.1,75.6,1.95
United Kingdom,26.944490000000002,27.392490000000002,37739.0,61689620.0,5.6,79.7,1.87
United States,28.343590000000003,28.456979999999998,50384.0,304473143.0,7.7,78.3,2.07
Uruguay,26.593040000000002,26.39123,15317.0,3350832.0,13.0,76.0,2.11
Uzbekistan,25.43432,25.32054,3733.0,26952719.0,49.2,69.6,2.46
Vanuatu,28.458759999999998,26.78926,2944.0,225335.0,28.2,63.4,3.61
Venezuela,28.134079999999997,27.445,17911.0,28116716.0,17.1,74.2,2.53
Vietnam,21.065,20.9163,4085.0,86589342.0,26.2,74.1,1.86
Palestine,29.026429999999998,26.5775,3564.0,3854667.0,24.7,74.1,4.38
Zambia,23.05436,20.68321,3039.0,13114579.0,94.9,51.1,5.88
Zimbabwe,24.645220000000002,22.0266,1286.0,13495462.0,98.3,47.3,3.85
1 Country female_BMI male_BMI gdp population under5mortality life_expectancy fertility
2 Afghanistan 21.07402 20.62058 1311.0 26528741.0 110.4 52.8 6.2
3 Albania 25.65726 26.44657 8644.0 2968026.0 17.9 76.8 1.76
4 Algeria 26.368409999999997 24.5962 12314.0 34811059.0 29.5 75.5 2.73
5 Angola 23.48431 22.25083 7103.0 19842251.0 192.0 56.7 6.43
6 Antigua and Barbuda 27.50545 25.76602 25736.0 85350.0 10.9 75.5 2.16
7 Argentina 27.46523 27.5017 14646.0 40381860.0 15.4 75.4 2.24
8 Armenia 27.1342 25.355420000000002 7383.0 2975029.0 20.0 72.3 1.4
9 Australia 26.87777 27.56373 41312.0 21370348.0 5.2 81.6 1.96
10 Austria 25.09414 26.467409999999997 43952.0 8331465.0 4.6 80.4 1.41
11 Azerbaijan 27.50879 25.65117 14365.0 8868713.0 43.3 69.2 1.99
12 Bahamas 29.13948 27.24594 24373.0 348587.0 14.5 72.2 1.89
13 Bahrain 28.790940000000003 27.83721 42507.0 1115777.0 9.4 77.6 2.23
14 Bangladesh 20.54531 20.39742 2265.0 148252473.0 55.9 68.3 2.38
15 Barbados 29.221690000000002 26.384390000000003 16075.0 277315.0 15.4 75.3 1.83
16 Belarus 26.641859999999998 26.16443 14488.0 9526453.0 7.2 70.0 1.42
17 Belgium 25.1446 26.75915 41641.0 10779155.0 4.7 79.6 1.82
18 Belize 29.81663 27.02255 8293.0 306165.0 20.1 70.7 2.91
19 Benin 23.74026 22.41835 1646.0 8973525.0 116.3 59.7 5.27
20 Bhutan 22.88243 22.8218 5663.0 694990.0 48.1 70.7 2.51
21 Bolivia 26.8633 24.43335 5066.0 9599916.0 52.0 71.2 3.48
22 Bosnia and Herzegovina 26.35874 26.611629999999998 9316.0 3839749.0 8.1 77.5 1.22
23 Botswana 26.09156 22.129839999999998 13858.0 1967866.0 63.8 53.2 2.86
24 Brazil 25.99113 25.78623 13906.0 194769696.0 18.6 73.2 1.9
25 Brunei 22.892310000000002 24.18179 72351.0 380786.0 9.0 76.9 2.1
26 Bulgaria 25.51574 26.542859999999997 15368.0 7513646.0 13.7 73.2 1.43
27 Burkina Faso 21.63031 21.27157 1358.0 14709011.0 130.4 58.0 6.04
28 Burundi 21.27927 21.50291 723.0 8821795.0 108.6 59.1 6.48
29 Cambodia 21.69608 20.80496 2442.0 13933660.0 51.5 66.1 3.05
30 Cameroon 24.9527 23.681729999999998 2571.0 19570418.0 113.8 56.6 5.17
31 Canada 26.698290000000004 27.4521 41468.0 33363256.0 5.8 80.8 1.68
32 Cape Verde 24.96136 23.515220000000003 6031.0 483824.0 28.4 70.4 2.57
33 Chad 21.95424 21.485689999999998 1753.0 11139740.0 168.0 54.3 6.81
34 Chile 27.92807 27.015420000000002 18698.0 16645940.0 8.9 78.5 1.89
35 China 22.91041 22.92176 7880.0 1326690636.0 18.5 73.4 1.53
36 Colombia 26.22529 24.94041 10489.0 44901660.0 19.7 76.2 2.43
37 Comoros 22.444329999999997 22.06131 1440.0 665414.0 91.2 67.1 5.05
38 Congo, The Democratic Republic of the 21.6677 19.86692 607.0 61809278.0 124.5 57.5 6.45
39 Congo 23.10824 21.87134 5022.0 3832771.0 72.6 58.8 5.1
40 Costa Rica 27.03497 26.47897 12219.0 4429506.0 10.3 79.8 1.91
41 Ivory Coast 23.82088 22.56469 2854.0 19261647.0 116.9 55.4 4.91
42 Croatia 25.17882 26.596290000000003 21873.0 4344151.0 5.9 76.2 1.43
43 Cuba 26.576140000000002 25.06867 17765.0 11290239.0 6.3 77.6 1.5
44 Cyprus 25.92587 27.41899 35828.0 1077010.0 4.2 80.0 1.49
45 Denmark 25.106270000000002 26.13287 45017.0 5495302.0 4.3 78.9 1.89
46 Djibouti 24.38177 23.38403 2502.0 809639.0 81.0 61.8 3.76
47 Ecuador 27.062690000000003 25.58841 9244.0 14447600.0 26.8 74.7 2.73
48 Egypt 30.099970000000003 26.732429999999997 9974.0 78976122.0 31.4 70.2 2.95
49 El Salvador 27.84092 26.36751 7450.0 6004199.0 21.6 73.7 2.32
50 Equatorial Guinea 24.528370000000002 23.7664 40143.0 686223.0 118.4 57.5 5.31
51 Eritrea 21.082320000000003 20.885089999999998 1088.0 4500638.0 60.4 60.1 5.16
52 Estonia 25.185979999999997 26.264459999999996 24743.0 1339941.0 5.5 74.2 1.62
53 Ethiopia 20.71463 20.247 931.0 83079608.0 86.9 60.0 5.19
54 Fiji 29.339409999999997 26.53078 7129.0 843206.0 24.0 64.9 2.74
55 Finland 25.58418 26.733390000000004 42122.0 5314170.0 3.3 79.6 1.85
56 France 24.82949 25.853289999999998 37505.0 62309529.0 4.3 81.1 1.97
57 Gabon 25.95121 24.0762 15800.0 1473741.0 68.0 61.7 4.28
58 Gambia 24.82101 21.65029 1566.0 1586749.0 87.4 65.7 5.8
59 Georgia 26.45014 25.54942 5900.0 4343290.0 19.3 71.8 1.79
60 Germany 25.73903 27.165090000000003 41199.0 80665906.0 4.4 80.0 1.37
61 Ghana 24.33014 22.842470000000002 2907.0 23115919.0 79.9 62.0 4.19
62 Greece 24.92026 26.33786 32197.0 11161755.0 4.9 80.2 1.46
63 Grenada 27.31948 25.179879999999997 12116.0 103934.0 13.5 70.8 2.28
64 Guatemala 26.84324 25.29947 6960.0 14106687.0 36.9 71.2 4.12
65 Guinea 22.45206 22.52449 1230.0 10427356.0 121.0 57.1 5.34
66 Guinea-Bissau 22.92809 21.64338 1326.0 1561293.0 127.6 53.6 5.25
67 Guyana 26.470190000000002 23.68465 5208.0 748096.0 41.9 65.0 2.74
68 Haiti 23.27785 23.66302 1600.0 9705130.0 83.3 61.0 3.5
69 Honduras 26.73191 25.10872 4391.0 7259470.0 26.5 71.8 3.27
70 Hong Kong 23.71046 25.057470000000002 46635.0 6910384.0 3.06 82.49 1.04
71 Hungary 25.97839 27.115679999999998 23334.0 10050699.0 7.2 73.9 1.33
72 Iceland 26.02599 27.206870000000002 42294.0 310033.0 2.7 82.4 2.12
73 India 21.31478 20.95956 3901.0 1197070109.0 65.6 64.7 2.64
74 Indonesia 22.986929999999997 21.85576 7856.0 235360765.0 36.2 69.4 2.48
75 Iran 27.236079999999998 25.310029999999998 15955.0 72530693.0 21.4 73.1 1.88
76 Iraq 28.411170000000002 26.71017 11616.0 29163327.0 38.3 66.6 4.34
77 Ireland 26.62176 27.65325 47713.0 4480145.0 4.5 80.1 2.0
78 Israel 27.301920000000003 27.13151 28562.0 7093808.0 4.9 80.6 2.92
79 Italy 24.79289 26.4802 37475.0 59319234.0 4.1 81.5 1.39
80 Jamaica 27.22601 24.00421 8951.0 2717344.0 18.9 75.1 2.39
81 Japan 21.87088 23.50004 34800.0 127317900.0 3.4 82.5 1.34
82 Jordan 29.218009999999996 27.47362 10897.0 6010035.0 22.1 76.9 3.59
83 Kazakhstan 26.65065 26.290779999999998 18797.0 15915966.0 25.9 67.1 2.51
84 Kenya 23.06181 21.592579999999998 2358.0 38244442.0 71.0 60.8 4.76
85 Kiribati 31.30769 29.2384 1803.0 98437.0 64.5 61.5 3.13
86 Kuwait 31.161859999999997 29.172109999999996 91966.0 2705290.0 11.3 77.3 2.68
87 Latvia 25.615129999999997 26.45693 20977.0 2144215.0 10.5 72.4 1.5
88 Lebanon 27.70471 27.20117 14158.0 4109389.0 11.3 77.8 1.57
89 Lesotho 26.780520000000003 21.90157 2041.0 1972194.0 114.2 44.5 3.34
90 Liberia 23.21679 21.89537 588.0 3672782.0 100.9 59.9 5.19
91 Libya 29.19874 26.54164 29853.0 6123022.0 18.8 75.6 2.64
92 Lithuania 26.01424 26.86102 23223.0 3219802.0 8.2 72.1 1.42
93 Luxembourg 26.09326 27.434040000000003 95001.0 485079.0 2.8 81.0 1.63
94 Macao 24.895039999999998 25.713820000000002 80191.0 507274.0 6.72 79.32 0.94
95 Macedonia 25.37646 26.34473 10872.0 2055266.0 11.8 74.5 1.47
96 Madagascar 20.73501 21.403470000000002 1528.0 19926798.0 66.7 62.2 4.79
97 Malawi 22.91455 22.034679999999998 674.0 13904671.0 101.1 52.4 5.78
98 Malaysia 25.448320000000002 24.73069 19968.0 27197419.0 8.0 74.5 2.05
99 Maldives 26.4132 23.219910000000002 12029.0 321026.0 16.0 78.5 2.38
100 Mali 23.07655 21.78881 1602.0 14223403.0 148.3 58.5 6.82
101 Malta 27.04993 27.683609999999998 27872.0 406392.0 6.6 80.7 1.38
102 Mauritania 26.26476 22.62295 3356.0 3414552.0 103.0 67.9 4.94
103 Mauritius 26.09824 25.15669 14615.0 1238013.0 15.8 72.9 1.58
104 Mexico 28.737509999999997 27.42468 15826.0 114972821.0 17.9 75.4 2.35
105 Micronesia 31.28402 28.10315 3197.0 104472.0 43.1 68.0 3.59
106 Moldova 27.05617 24.2369 3890.0 4111168.0 17.6 70.4 1.49
107 Mongolia 25.71375 24.88385 7563.0 2629666.0 34.8 64.8 2.37
108 Montenegro 25.70186 26.55412 14183.0 619740.0 8.1 76.0 1.72
109 Morocco 26.223090000000003 25.63182 6091.0 31350544.0 35.8 73.3 2.44
110 Mozambique 23.317339999999998 21.93536 864.0 22994867.0 114.4 54.0 5.54
111 Myanmar 22.47733 21.44932 2891.0 51030006.0 87.2 59.4 2.05
112 Namibia 25.14988 22.65008 8169.0 2115703.0 62.2 59.1 3.36
113 Nepal 20.72814 20.76344 1866.0 26325183.0 50.7 68.4 2.9
114 Netherlands 25.47269 26.01541 47388.0 16519862.0 4.8 80.3 1.77
115 New Zealand 27.36642 27.768929999999997 32122.0 4285380.0 6.4 80.3 2.12
116 Nicaragua 27.57259 25.77291 4060.0 5594524.0 28.1 77.0 2.72
117 Niger 21.95958 21.21958 843.0 15085130.0 141.3 58.0 7.59
118 Nigeria 23.674020000000002 23.03322 4684.0 151115683.0 140.9 59.2 6.02
119 Norway 25.73772 26.934240000000003 65216.0 4771633.0 3.6 80.8 1.96
120 Oman 26.66535 26.241090000000003 47799.0 2652281.0 11.9 76.2 2.89
121 Pakistan 23.44986 22.299139999999998 4187.0 163096985.0 95.5 64.1 3.58
122 Panama 27.67758 26.26959 14033.0 3498679.0 21.0 77.3 2.61
123 Papua New Guinea 25.77189 25.015060000000002 1982.0 6540267.0 69.7 58.6 4.07
124 Paraguay 25.90523 25.54223 6684.0 6047131.0 25.7 74.0 3.06
125 Peru 25.98511 24.770410000000002 9249.0 28642048.0 23.2 78.2 2.58
126 Philippines 23.4671 22.872629999999997 5332.0 90297115.0 33.4 69.8 3.26
127 Poland 25.918870000000002 26.6738 19996.0 38525752.0 6.7 75.4 1.33
128 Portugal 26.183020000000003 26.68445 27747.0 10577458.0 4.1 79.4 1.36
129 Puerto Rico 30.2212 28.378040000000002 35855.0 3728126.0 8.78 77.0 1.69
130 Qatar 28.912509999999997 28.13138 126076.0 1388962.0 9.5 77.9 2.2
131 Romania 25.22425 25.41069 18032.0 20741669.0 16.1 73.2 1.34
132 Russia 27.21272 26.01131 22506.0 143123163.0 13.5 67.9 1.49
133 Rwanda 22.07156 22.55453 1173.0 9750314.0 78.3 64.1 5.06
134 Samoa 33.659079999999996 30.42475 5731.0 183440.0 18.8 72.3 4.43
135 Sao Tome and Principe 24.88216 23.51233 2673.0 163595.0 61.0 66.0 4.41
136 Saudi Arabia 29.598779999999998 27.884320000000002 44189.0 26742842.0 18.1 78.3 2.97
137 Senegal 24.30968 21.927429999999998 2162.0 12229703.0 75.8 63.5 5.11
138 Serbia 25.669970000000003 26.51495 12522.0 9109535.0 8.0 74.3 1.41
139 Seychelles 27.973740000000003 25.56236 20065.0 91634.0 14.2 72.9 2.28
140 Sierra Leone 23.93364 22.53139 1289.0 5521838.0 179.1 53.6 5.13
141 Singapore 22.86642 23.83996 65991.0 4849641.0 2.8 80.6 1.28
142 Slovak Republic 26.323729999999998 26.92717 24670.0 5396710.0 8.8 74.9 1.31
143 Slovenia 26.582140000000003 27.43983 30816.0 2030599.0 3.7 78.7 1.43
144 Solomon Islands 28.8762 27.159879999999998 1835.0 503410.0 33.1 62.3 4.36
145 Somalia 22.66607 21.969170000000002 615.0 9132589.0 168.5 52.6 7.06
146 South Africa 29.4803 26.85538 12263.0 50348811.0 66.1 53.4 2.54
147 Spain 26.30554 27.49975 34676.0 45817016.0 5.0 81.1 1.42
148 Sri Lanka 23.11717 21.96671 6907.0 19949553.0 11.7 74.0 2.32
149 Sudan 23.16132 22.40484 3246.0 34470138.0 84.7 65.5 4.79
150 Suriname 27.749859999999998 25.49887 13470.0 506657.0 26.4 70.2 2.41
151 Swaziland 28.448859999999996 23.16969 5887.0 1153750.0 112.2 45.1 3.7
152 Sweden 25.1466 26.37629 43421.0 9226333.0 3.2 81.1 1.92
153 Switzerland 24.07242 26.20195 55020.0 7646542.0 4.7 82.0 1.47
154 Syria 28.87418 26.919690000000003 6246.0 20097057.0 16.5 76.1 3.17
155 Tajikistan 23.84799 23.77966 2001.0 7254072.0 56.2 69.6 3.7
156 Tanzania 23.0843 22.47792 2030.0 42844744.0 72.4 60.4 5.54
157 Thailand 24.38577 23.008029999999998 12216.0 66453255.0 15.6 73.9 1.48
158 Togo 22.73858 21.87875 1219.0 6052937.0 96.4 57.5 4.88
159 Tonga 34.25969 30.99563 4748.0 102816.0 17.0 70.3 4.01
160 Trinidad and Tobago 28.27587 26.396690000000003 30875.0 1315372.0 24.9 71.7 1.8
161 Tunisia 27.93706 25.15699 9938.0 10408091.0 19.4 76.8 2.04
162 Turkey 28.247490000000003 26.703709999999997 16454.0 70344357.0 22.2 77.8 2.15
163 Turkmenistan 24.66154 25.24796 8877.0 4917541.0 63.9 67.2 2.48
164 Uganda 22.48126 22.35833 1437.0 31014427.0 89.3 56.0 6.34
165 Ukraine 26.23317 25.42379 8762.0 46028476.0 12.9 67.8 1.38
166 United Arab Emirates 29.614009999999997 28.053590000000003 73029.0 6900142.0 9.1 75.6 1.95
167 United Kingdom 26.944490000000002 27.392490000000002 37739.0 61689620.0 5.6 79.7 1.87
168 United States 28.343590000000003 28.456979999999998 50384.0 304473143.0 7.7 78.3 2.07
169 Uruguay 26.593040000000002 26.39123 15317.0 3350832.0 13.0 76.0 2.11
170 Uzbekistan 25.43432 25.32054 3733.0 26952719.0 49.2 69.6 2.46
171 Vanuatu 28.458759999999998 26.78926 2944.0 225335.0 28.2 63.4 3.61
172 Venezuela 28.134079999999997 27.445 17911.0 28116716.0 17.1 74.2 2.53
173 Vietnam 21.065 20.9163 4085.0 86589342.0 26.2 74.1 1.86
174 Palestine 29.026429999999998 26.5775 3564.0 3854667.0 24.7 74.1 4.38
175 Zambia 23.05436 20.68321 3039.0 13114579.0 94.9 51.1 5.88
176 Zimbabwe 24.645220000000002 22.0266 1286.0 13495462.0 98.3 47.3 3.85

151
zajecia3/iris.data Executable file
View File

@ -0,0 +1,151 @@
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa
4.7,3.2,1.3,0.2,Iris-setosa
4.6,3.1,1.5,0.2,Iris-setosa
5.0,3.6,1.4,0.2,Iris-setosa
5.4,3.9,1.7,0.4,Iris-setosa
4.6,3.4,1.4,0.3,Iris-setosa
5.0,3.4,1.5,0.2,Iris-setosa
4.4,2.9,1.4,0.2,Iris-setosa
4.9,3.1,1.5,0.1,Iris-setosa
5.4,3.7,1.5,0.2,Iris-setosa
4.8,3.4,1.6,0.2,Iris-setosa
4.8,3.0,1.4,0.1,Iris-setosa
4.3,3.0,1.1,0.1,Iris-setosa
5.8,4.0,1.2,0.2,Iris-setosa
5.7,4.4,1.5,0.4,Iris-setosa
5.4,3.9,1.3,0.4,Iris-setosa
5.1,3.5,1.4,0.3,Iris-setosa
5.7,3.8,1.7,0.3,Iris-setosa
5.1,3.8,1.5,0.3,Iris-setosa
5.4,3.4,1.7,0.2,Iris-setosa
5.1,3.7,1.5,0.4,Iris-setosa
4.6,3.6,1.0,0.2,Iris-setosa
5.1,3.3,1.7,0.5,Iris-setosa
4.8,3.4,1.9,0.2,Iris-setosa
5.0,3.0,1.6,0.2,Iris-setosa
5.0,3.4,1.6,0.4,Iris-setosa
5.2,3.5,1.5,0.2,Iris-setosa
5.2,3.4,1.4,0.2,Iris-setosa
4.7,3.2,1.6,0.2,Iris-setosa
4.8,3.1,1.6,0.2,Iris-setosa
5.4,3.4,1.5,0.4,Iris-setosa
5.2,4.1,1.5,0.1,Iris-setosa
5.5,4.2,1.4,0.2,Iris-setosa
4.9,3.1,1.5,0.1,Iris-setosa
5.0,3.2,1.2,0.2,Iris-setosa
5.5,3.5,1.3,0.2,Iris-setosa
4.9,3.1,1.5,0.1,Iris-setosa
4.4,3.0,1.3,0.2,Iris-setosa
5.1,3.4,1.5,0.2,Iris-setosa
5.0,3.5,1.3,0.3,Iris-setosa
4.5,2.3,1.3,0.3,Iris-setosa
4.4,3.2,1.3,0.2,Iris-setosa
5.0,3.5,1.6,0.6,Iris-setosa
5.1,3.8,1.9,0.4,Iris-setosa
4.8,3.0,1.4,0.3,Iris-setosa
5.1,3.8,1.6,0.2,Iris-setosa
4.6,3.2,1.4,0.2,Iris-setosa
5.3,3.7,1.5,0.2,Iris-setosa
5.0,3.3,1.4,0.2,Iris-setosa
7.0,3.2,4.7,1.4,Iris-versicolor
6.4,3.2,4.5,1.5,Iris-versicolor
6.9,3.1,4.9,1.5,Iris-versicolor
5.5,2.3,4.0,1.3,Iris-versicolor
6.5,2.8,4.6,1.5,Iris-versicolor
5.7,2.8,4.5,1.3,Iris-versicolor
6.3,3.3,4.7,1.6,Iris-versicolor
4.9,2.4,3.3,1.0,Iris-versicolor
6.6,2.9,4.6,1.3,Iris-versicolor
5.2,2.7,3.9,1.4,Iris-versicolor
5.0,2.0,3.5,1.0,Iris-versicolor
5.9,3.0,4.2,1.5,Iris-versicolor
6.0,2.2,4.0,1.0,Iris-versicolor
6.1,2.9,4.7,1.4,Iris-versicolor
5.6,2.9,3.6,1.3,Iris-versicolor
6.7,3.1,4.4,1.4,Iris-versicolor
5.6,3.0,4.5,1.5,Iris-versicolor
5.8,2.7,4.1,1.0,Iris-versicolor
6.2,2.2,4.5,1.5,Iris-versicolor
5.6,2.5,3.9,1.1,Iris-versicolor
5.9,3.2,4.8,1.8,Iris-versicolor
6.1,2.8,4.0,1.3,Iris-versicolor
6.3,2.5,4.9,1.5,Iris-versicolor
6.1,2.8,4.7,1.2,Iris-versicolor
6.4,2.9,4.3,1.3,Iris-versicolor
6.6,3.0,4.4,1.4,Iris-versicolor
6.8,2.8,4.8,1.4,Iris-versicolor
6.7,3.0,5.0,1.7,Iris-versicolor
6.0,2.9,4.5,1.5,Iris-versicolor
5.7,2.6,3.5,1.0,Iris-versicolor
5.5,2.4,3.8,1.1,Iris-versicolor
5.5,2.4,3.7,1.0,Iris-versicolor
5.8,2.7,3.9,1.2,Iris-versicolor
6.0,2.7,5.1,1.6,Iris-versicolor
5.4,3.0,4.5,1.5,Iris-versicolor
6.0,3.4,4.5,1.6,Iris-versicolor
6.7,3.1,4.7,1.5,Iris-versicolor
6.3,2.3,4.4,1.3,Iris-versicolor
5.6,3.0,4.1,1.3,Iris-versicolor
5.5,2.5,4.0,1.3,Iris-versicolor
5.5,2.6,4.4,1.2,Iris-versicolor
6.1,3.0,4.6,1.4,Iris-versicolor
5.8,2.6,4.0,1.2,Iris-versicolor
5.0,2.3,3.3,1.0,Iris-versicolor
5.6,2.7,4.2,1.3,Iris-versicolor
5.7,3.0,4.2,1.2,Iris-versicolor
5.7,2.9,4.2,1.3,Iris-versicolor
6.2,2.9,4.3,1.3,Iris-versicolor
5.1,2.5,3.0,1.1,Iris-versicolor
5.7,2.8,4.1,1.3,Iris-versicolor
6.3,3.3,6.0,2.5,Iris-virginica
5.8,2.7,5.1,1.9,Iris-virginica
7.1,3.0,5.9,2.1,Iris-virginica
6.3,2.9,5.6,1.8,Iris-virginica
6.5,3.0,5.8,2.2,Iris-virginica
7.6,3.0,6.6,2.1,Iris-virginica
4.9,2.5,4.5,1.7,Iris-virginica
7.3,2.9,6.3,1.8,Iris-virginica
6.7,2.5,5.8,1.8,Iris-virginica
7.2,3.6,6.1,2.5,Iris-virginica
6.5,3.2,5.1,2.0,Iris-virginica
6.4,2.7,5.3,1.9,Iris-virginica
6.8,3.0,5.5,2.1,Iris-virginica
5.7,2.5,5.0,2.0,Iris-virginica
5.8,2.8,5.1,2.4,Iris-virginica
6.4,3.2,5.3,2.3,Iris-virginica
6.5,3.0,5.5,1.8,Iris-virginica
7.7,3.8,6.7,2.2,Iris-virginica
7.7,2.6,6.9,2.3,Iris-virginica
6.0,2.2,5.0,1.5,Iris-virginica
6.9,3.2,5.7,2.3,Iris-virginica
5.6,2.8,4.9,2.0,Iris-virginica
7.7,2.8,6.7,2.0,Iris-virginica
6.3,2.7,4.9,1.8,Iris-virginica
6.7,3.3,5.7,2.1,Iris-virginica
7.2,3.2,6.0,1.8,Iris-virginica
6.2,2.8,4.8,1.8,Iris-virginica
6.1,3.0,4.9,1.8,Iris-virginica
6.4,2.8,5.6,2.1,Iris-virginica
7.2,3.0,5.8,1.6,Iris-virginica
7.4,2.8,6.1,1.9,Iris-virginica
7.9,3.8,6.4,2.0,Iris-virginica
6.4,2.8,5.6,2.2,Iris-virginica
6.3,2.8,5.1,1.5,Iris-virginica
6.1,2.6,5.6,1.4,Iris-virginica
7.7,3.0,6.1,2.3,Iris-virginica
6.3,3.4,5.6,2.4,Iris-virginica
6.4,3.1,5.5,1.8,Iris-virginica
6.0,3.0,4.8,1.8,Iris-virginica
6.9,3.1,5.4,2.1,Iris-virginica
6.7,3.1,5.6,2.4,Iris-virginica
6.9,3.1,5.1,2.3,Iris-virginica
5.8,2.7,5.1,1.9,Iris-virginica
6.8,3.2,5.9,2.3,Iris-virginica
6.7,3.3,5.7,2.5,Iris-virginica
6.7,3.0,5.2,2.3,Iris-virginica
6.3,2.5,5.0,1.9,Iris-virginica
6.5,3.0,5.2,2.0,Iris-virginica
6.2,3.4,5.4,2.3,Iris-virginica
5.9,3.0,5.1,1.8,Iris-virginica

BIN
zajecia3/logistic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1033
zajecia3/sklearn cz. 2.ipynb Normal file

File diff suppressed because one or more lines are too long

53
zajecia4/README.md Normal file
View File

@ -0,0 +1,53 @@
# Zajęcia 4
## Aplikacje REST - Fastapi
Jako zadanie pierwsze proszę przerobić wszystkie przykłady z https://fastapi.tiangolo.com/tutorial/ z działow od "First Steps" do "Request Body" odpalając każdy przykład na komputerze.
Następnie proszę użyć modelu KNN z wczorajszych zajęc i wystawić w REST API oraz uruchomić serwis, który będzie serwował odpowiedzi dla zadanych parametrów wejśćiowych.
Następnie osobno korzystając z :
- curl
- pythonowej bibliteki requests ( https://pypi.org/project/requests/ ) proszę wysłać zapytanie do serwisu
proszę zadać pytanie do serwisu REST. Powinni państwo dostać predykcję modelu.
## Testowanie w pythonie - Pytest
Przeczytaj https://docs.pytest.org/en/7.4.x/getting-started.html odpalając przykłady na komputerze.
Pobierz dane w następujący sposób:
` import pandas as pd`
` url = 'https://raw.githubusercontent.com/bigmlcom/python/master/data/spam.csv'`
` data = pd.read_csv(url, sep='\t')`
Podziel dane na train i test oraz wytrenuj model TF IDF + regresja logistyczna. Nastepnie stwórz funkcję `predict_text_category(text: str)`,
która przyjmuje tekst oraz zwraca string 'spam' lub 'ham'. Jeżeli funkcja nie otrzyma stringa, a inny typ danych, funkcja ma zwracać None. Napisz kilka testów sprawdzających
czy dana funkcja faktycznie dla stringów zwraca string, który zawiera się w zbiorze {'spam','ham'}, a dla innych typów None.
## Testowanie REST API
Przeczytaj https://fastapi.tiangolo.com/tutorial/testing/ odpalając przykłady na komputerze
Osadź model z poprzedniego zadania w REST API i napisz testy REST API.
## Przetestowanie maszyny
Skorzystaj z instrukcji "Dostęp do kontenera wdrożeniowego ... " zawartej w tym katalogu. Wystarczy uruchomić konsolę i zalogować się na root bez dalszych kroków.
Następnie na maszynie umieść plik `fastapi_examples/simple.py` (np. korzystając z git). Następnie zainstaluj środowisko (albo bezpośrednio pip albo miniconda- odradzam używanie anacondy na tym serwerze gdyż ma tylko 1GB RAM)
Uruchom przykład:
`python -m uvicorn main:app --host 0.0.0.0`
Sprawdź czy `curl "ppw-MYLOGIN.vm.wmi.amu.edu.pl:8000"` zmieniająć MYLOGIN na login użytkownika zwraca poprawny wynik. Uwaga: Adres jest dostępny tylko w sieci wydziałowej WMI (albo za VPN).
## Własny projekt
Jeżeli wykonałeś/aś wszystkie zadania, pracuj nad projektem zaliczeniownym.

View File

@ -0,0 +1,71 @@
from fastapi import FastAPI
from enum import Enum
from typing import Union
from pydantic import BaseModel
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class ModelName(str, Enum):
alexnet = "alexnet"
resnet = "resnet"
lenet = "lenet"
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int):
return {"item_id": item_id}
@app.get("/models/{model_name}")
async def get_model(model_name: ModelName):
if model_name is ModelName.alexnet:
return {"model_name": model_name, "message": "Deep Learning FTW!"}
if model_name.value == "lenet":
return {"model_name": model_name, "message": "LeCNN all the images"}
return {"model_name": model_name, "message": "Have some residuals"}
@app.get("/items/")
async def read_item(skip: int = 0, limit: int = 10):
return fake_items_db[skip : skip + limit]
@app.get("/users/{user_id}/items/{item_id}")
async def read_user_item(
user_id: int, item_id: str, q: Union[str, None] = None, short: bool = False
):
item = {"item_id": item_id, "owner_id": user_id}
if q:
item.update({"q": q})
if not short:
item.update(
{"description": "This is an amazing item that has a long description"}
)
return item
class Item(BaseModel):
name: str
description: Union[str, None] = None
price: float
tax: Union[float, None] = None
@app.post("/items/")
async def create_item(item: Item):
return item

View File

@ -0,0 +1,4 @@
# uvicorn not_that_simple:app --reload
# albo python -m uvicorn not_that_simple:app --reload

View File

@ -0,0 +1,2 @@
# uvicorn simple:app --reload
# albo python -m uvicorn simple:app --reload

View File

@ -0,0 +1,8 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}

View File

@ -0,0 +1,10 @@
from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
@app.get("/")
async def read_main():
return {"msg": "Hello World"}

View File

@ -0,0 +1,11 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"msg": "Hello World"}

View File

@ -0,0 +1,10 @@
def fibonacci(n):
if not type(n) is int:
return False
if n == 0:
return 0
elif n == 1 or n == 2:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)

View File

@ -0,0 +1,3 @@
def inc(x):
return x + 2

View File

@ -0,0 +1,4 @@
from my_inc_function import inc
def test_answer():
assert inc(3) == 5

View File

@ -0,0 +1,15 @@
from my_functions import fibonacci
def test_fib_basic_ints():
assert fibonacci(0) == 0
assert fibonacci(1) == 1
assert fibonacci(2) == 1
assert fibonacci(20) == 6765
def test_fib_str_input():
assert fibonacci('abc') == False