\n"
]
}
],
"source": [
"tpl=(1,2,3)\n",
"tpl2=1,2,3\n",
"print(type(tpl2))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Gyq28VgrNP1S"
},
"source": [
"## Comprehension"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SLQwqaX-NP1S"
},
"source": [
"tüm veri yapılarıyla uygulanabilir. uzun döngü yazmaktan kurtarır. c#'taki LINQ işlemlerinin benzer hatta daha güzel alternatifi"
]
},
{
"cell_type": "code",
"execution_count": 115,
"metadata": {
"id": "NqPd0hjyNP1S",
"outputId": "c91b871e-6f35-4792-f37c-118843c0fa38",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198]\n"
]
}
],
"source": [
"rangelistinikikatı=[x*2 for x in rangelist]\n",
"print(rangelistinikikatı)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pxwrKmaWNP1S"
},
"source": [
"### koşullu comprehension"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1WQWgwHqNP1S"
},
"source": [
"[x for x in datastruct if x ...]
\n",
"[x if ... else y for x in datastruct]"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {
"id": "HRX1WVkpNP1S",
"outputId": "d6f82004-2737-45b7-b734-8643d70c7f3f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['üzüm', 'muz', 'muz', 'elma']"
]
},
"metadata": {},
"execution_count": 116
}
],
"source": [
"kısaisimlimeyveler=[x for x in meyveler if len(x)<5]\n",
"kısaisimlimeyveler"
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {
"scrolled": true,
"id": "JVjanVF3NP1T",
"outputId": "9d2fa365-40ef-415a-d66e-56d12bf2578f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[1, 3, 5, 7, 9]\n",
"[1, '', 3, '', 5, '', 7, '', 9]\n"
]
}
],
"source": [
"liste=range(1,10)\n",
"sadecetekler=[sayı for sayı in liste if sayı % 2 !=0] #tek if\n",
"tekler=[sayı if sayı%2!=0 else \"\" for sayı in liste] #if-else\n",
"print(sadecetekler)\n",
"print(tekler)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "IheriaOWNP1T"
},
"source": [
"### içiçe(nested) list comprehension"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "EmbFdo9XNP1T"
},
"source": [
"****syntax:[x for iç in dış for x in iç]****"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0TagRdcuNP1T"
},
"source": [
"2 boyutlu bir matrisi düzleştirmek istiyorum
\n",
"matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
\n",
"Beklediğimiz çıktı: flatten_matrix = [1, 2, 3, 4, 5, 6, 7, 8, 9]"
]
},
{
"cell_type": "code",
"execution_count": 118,
"metadata": {
"id": "jPpkAqNKNP1T",
"outputId": "921ba5ce-8183-4552-85b8-29a770fdc6d6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[1, 2, 3, 4, 5, 6, 7, 8, 9]\n"
]
}
],
"source": [
"# 2-D List\n",
"matrix = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]\n",
"\n",
"flatten_matrix = []\n",
"\n",
"for sublist in matrix:\n",
"\tfor val in sublist:\n",
"\t\tflatten_matrix.append(val)\n",
"\n",
"print(flatten_matrix)\n"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {
"id": "7z41QOV3NP1U",
"outputId": "320e7517-697b-4ffc-bdf5-f5c0dc3293b2",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[1, 2, 3, 4, 5, 6, 7, 8, 9]\n"
]
}
],
"source": [
"# 2-D List\n",
"matrix = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]\n",
"\n",
"# Nested List Comprehension to flatten a given 2-D matrix\n",
"flatten_matrix = [val for sublist in matrix for val in sublist]\n",
"\n",
"print(flatten_matrix)"
]
},
{
"cell_type": "code",
"execution_count": 120,
"metadata": {
"id": "-hA1EVDlNP1U",
"outputId": "7ee51822-27c3-4c44-8ac0-1b1ab3a05da4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['Venus', 'Earth', 'Mars', 'Pluto']\n"
]
}
],
"source": [
"# 2-D List of planets\n",
"planets = [['Mercury', 'Venus', 'Earth'], ['Mars', 'Jupiter', 'Saturn'], ['Uranus', 'Neptune', 'Pluto']]\n",
"\n",
"flatten_planets = []\n",
"\n",
"for sublist in planets:\n",
"\tfor planet in sublist:\n",
"\n",
"\t\tif len(planet) < 6:\n",
"\t\t\tflatten_planets.append(planet)\n",
"\n",
"print(flatten_planets)"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {
"scrolled": true,
"id": "3sF4mxwgNP1U",
"outputId": "d19e9fec-d249-47b5-c1e3-dcbf37908ad0",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['Venus', 'Earth', 'Mars', 'Pluto']\n"
]
}
],
"source": [
"flatten_planets = [planet for sublist in planets for planet in sublist if len(planet) < 6]\n",
"print(flatten_planets)"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {
"id": "Gm5-pZTzNP1U",
"outputId": "be895b8d-96f0-432b-adaf-9ce6107b7515",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['Venus', 'Earth', 'Mars', 'Pluto']"
]
},
"metadata": {},
"execution_count": 122
}
],
"source": [
"kısalar=[p for iç in planets for p in iç if len(p)<6]\n",
"kısalar"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0JOWbgJqNP1V"
},
"source": [
"Daha genel bir gösterim için https://stackoverflow.com/questions/18072759/list-comprehension-on-a-nested-list sayfasındaki gif animasyonlu açıklamaya bakınız"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8gG0zt1xNP1V"
},
"source": [
"### Matrisler ve matrislerde comprehension"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {
"id": "Mne2ty4qNP1V",
"outputId": "b953d00f-fa5f-409b-ba93-f2348694a4d6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"3\n",
"(7, ['printy([satır for satır in matris]) #satır satır\\n']) \n",
"----------\n",
"[[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n",
" \n",
"(8, ['printy([satır[0] for satır in matris]) #ilk sütun\\n']) \n",
"----------\n",
"[1, 4, 7]\n",
" \n",
"(9, ['printy([[satır[i] for satır in matris] for i in range(3)]) #sütun sütun, transpozesi\\n']) \n",
"----------\n",
"[[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n",
" \n",
"(10, ['printy([x for iç in matris for x in iç]) #nested\\n']) \n",
"----------\n",
"[1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
" \n"
]
}
],
"source": [
"matris=[\n",
" [1,2,3],\n",
" [4,5,6],\n",
" [7,8,9]\n",
"]\n",
"print(len(matris))\n",
"printy([satır for satır in matris]) #satır satır\n",
"printy([satır[0] for satır in matris]) #ilk sütun\n",
"printy([[satır[i] for satır in matris] for i in range(3)]) #sütun sütun, transpozesi\n",
"printy([x for iç in matris for x in iç]) #nested"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_LEp7Ue3NP1V"
},
"source": [
"amaç aşağıdakini elde etmek olsun\n",
"\n",
"matrix = [[0, 1, 2, 3, 4],\n",
" [0, 1, 2, 3, 4],\n",
" [0, 1, 2, 3, 4],\n",
" [0, 1, 2, 3, 4],\n",
" [0, 1, 2, 3, 4]]\n",
"
"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {
"id": "OFfwnWT5NP1V",
"outputId": "6d14e9aa-858d-4ba9-8a3a-495f7e807a1b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]\n"
]
}
],
"source": [
"matrix = []\n",
"\n",
"for i in range(5):\n",
"\n",
"\t# Append an empty sublist inside the list\n",
"\tmatrix.append([])\n",
"\n",
"\tfor j in range(5):\n",
"\t\tmatrix[i].append(j)\n",
"\n",
"print(matrix)\n"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"id": "pTZObgruNP1V",
"outputId": "87fc9d2b-96d8-4a04-824d-c914309e2a6d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]\n"
]
}
],
"source": [
"# Nested list comprehension\n",
"matrix = [[j for j in range(5)] for i in range(5)]\n",
"\n",
"print(matrix)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bOPaavfoNP1W"
},
"source": [
"### Generators"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "JVGurksxNP1W"
},
"source": [
"Bu konu biraz daha advanced bi konu olup ben sadece toplam alınması gereken durumlar için bir öenride bulunucam. Bi list comprehension sonunda(özellikle çok büyük bi list sözkonusuya) toplam alınacaksa [] kullanamya gerek yok, böylece memory tasarrufu yapmış olursunuz. Detaylar için şu sayfaya bakabilirsiniz: https://www.johndcook.com/blog/2020/01/15/generator-expression/"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {
"id": "5wo-U8QoNP1X",
"outputId": "a535516b-294b-47ab-d45b-ae7ebfc5bcb7",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"285"
]
},
"metadata": {},
"execution_count": 126
}
],
"source": [
"#list comprehension: tüm liste elemanları bellekte tutuluyor\n",
"sum([x**2 for x in range(10)])"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {
"id": "tVNCqHRENP1X",
"outputId": "93732567-cba1-476c-a131-381e128270c6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"285"
]
},
"metadata": {},
"execution_count": 127
}
],
"source": [
"#generator expression: liste elemanları bellekte tutulmuyor\n",
"sum(x**2 for x in range(10))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "w_aH2KmvNP1X"
},
"source": [
"## Stack"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "koT7RrSyNP1X"
},
"source": [
"Normalde böyle bi sınıf yok. list'i stack gibi kullanırız. append ve pop sayesinde. ilk giren ilk çıkar"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {
"id": "AOYlOLN2NP1X",
"outputId": "b546321f-c5e3-41a5-914f-cf564248245d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"4"
]
},
"metadata": {},
"execution_count": 128
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[1, 2, 3]"
]
},
"metadata": {},
"execution_count": 128
}
],
"source": [
"stack=[1,2,3]\n",
"stack.append(4)\n",
"stack.pop()\n",
"stack"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "m9mI5senNP1Y"
},
"source": [
"## Queue"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fhGjV581NP1Y"
},
"source": [
"Bunu da istersek listten yaparız, ilk giren son çıkar. ama bunun için collections modülünde bi sınıf var"
]
},
{
"cell_type": "code",
"execution_count": 129,
"metadata": {
"id": "yWhScMN7NP1Y",
"outputId": "76ffb7b1-8748-426f-bf3d-33c5331c3868",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1\n",
"deque([2, 3, 4])\n"
]
}
],
"source": [
"from collections import deque\n",
"kuyruk=deque([1,2,3])\n",
"kuyruk.append(4)\n",
"sıradaki=kuyruk.popleft()\n",
"print(sıradaki)\n",
"print(kuyruk)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Cdl9pcc0NP1Y"
},
"source": [
"## Dictionary"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SUa2Se8GNP1Y"
},
"source": [
"Key-value ikililerini tutarlar. Sırasızdırlar(EDIT:Python 3.7den itibaren girdilen sırayı korur), indeksle ulaşamayız. key'lerle valuelara ulaşırız veya döngü içinde dolanarak ikisine birden tek seferde de ulaşabiliriz."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kwb7sDe9NP1Y"
},
"source": [
"### Yaratım"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "nJUUXyxBNP1Z"
},
"source": [
"#### Klasik"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {
"id": "o_7JO3-LNP1Z",
"outputId": "ab3f9c0c-f6c8-4e24-a158-9a6a4a603349",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"(5, ['printy(dict_.keys())\\n']) \n",
"----------\n",
"dict_keys(['one', 'two'])\n",
" \n",
"(6, ['printy(dict_.values())\\n']) \n",
"----------\n",
"dict_values(['bir', 'zwei'])\n",
" \n",
"(7, ['printy(dict_.items())\\n']) \n",
"----------\n",
"dict_items([('one', 'bir'), ('two', 'zwei')])\n",
" \n",
"bir\n",
"N/A\n"
]
}
],
"source": [
"dict_={}\n",
"dict_[\"one\"]=\"bir\" #add,append, insert gibi bir metodu yok, direkt atanıyor\n",
"dict_[\"two\"]=\"iki\"\n",
"dict_[\"two\"]=\"zwei\"\n",
"printy(dict_.keys())\n",
"printy(dict_.values())\n",
"printy(dict_.items())\n",
"print(dict_[\"one\"])\n",
"#print(dict_[\"three\"]) # hata alır, almaması için get kullan\n",
"print(dict_.get(\"three\",\"N/A\"))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "uDsCwp-BNP1Z"
},
"source": [
"#### dict metodu ile ikili elemanlardan oluşan bir yapıdan"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "knXEsR2TNP1Z"
},
"source": [
"bu ikili yapılar genelde zip veya enumerate olacaktır. bakınız ilgili fonksiyonar."
]
},
{
"cell_type": "code",
"execution_count": 131,
"metadata": {
"id": "I4q3Wwo7NP1Z",
"outputId": "1388f47f-3570-4675-dfba-2ce248167b92",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'bir'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 131
}
],
"source": [
"tpl=[(\"one\",\"bir\"),(\"two\",\"iki\"),(\"three\",\"üç\")]\n",
"dict_=dict(tpl)\n",
"print(type(dict_))\n",
"dict_[\"one\"]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "l4Z0Cw0PNP1Z"
},
"source": [
"#### comprehension ile"
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {
"id": "2cwYcIVFNP1Z",
"outputId": "17ba06de-e090-4352-d7ed-90b2a88419e4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"dict_items([(0, 0), (2, 4), (4, 16), (6, 36), (8, 64)])\n"
]
}
],
"source": [
"sayılar=list(range(10))\n",
"ciftlerinkaresi={x: x**2 for x in sayılar if x%2==0}\n",
"print(ciftlerinkaresi.items())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qncIYxruNP1a"
},
"source": [
"### elemanlarda dolaşma"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {
"id": "TSXUJrk_NP1a",
"outputId": "e427ec17-1015-41d3-bc73-de3470135ec6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"0 0\n",
"2 4\n",
"4 16\n",
"6 36\n",
"8 64\n"
]
}
],
"source": [
"for k,v in ciftlerinkaresi.items():\n",
" print(k,v)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "nadIvmlzNP1a"
},
"source": [
"### çeşitli metodlar"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {
"id": "V9iUJKtpNP1a",
"outputId": "b1a454ed-a461-4dc4-d4bd-834c0242ff72",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"dict_items([])"
]
},
"metadata": {},
"execution_count": 134
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"name 'ciftlerinkaresi' is not defined\n"
]
}
],
"source": [
"try:\n",
" ciftlerinkaresi.clear()\n",
" ciftlerinkaresi.items()\n",
" del ciftlerinkaresi\n",
" ciftlerinkaresi #hata verir, artık bellekten uçtu\n",
"except Exception as err:\n",
" print(err)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "6M08JSXFNP1a"
},
"source": [
"## Set"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "H8O819D9NP1a"
},
"source": [
"Bunlar da dict gibi sırasızdır. dict gibi {} içinde tanımlanırlar. uniqe değerleri tutarlar. bir listteki duplikeleri ayırmak ve membership kontrolü için çok kullanılırlar"
]
},
{
"cell_type": "code",
"execution_count": 135,
"metadata": {
"id": "tYuMoLaTNP1a",
"outputId": "c5ed3a78-a497-4df3-b7b9-0a392b43b42b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{1, 2, 3, 4, 5}"
]
},
"metadata": {},
"execution_count": 135
}
],
"source": [
"liste=[1,1,2,3,4,4,5]\n",
"set_=set(liste)\n",
"set_"
]
},
{
"cell_type": "code",
"execution_count": 136,
"metadata": {
"scrolled": true,
"id": "PLLzA6DqNP1b",
"outputId": "638755e6-20ea-4fef-dcc9-30f9bd21df7b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"(5, ['printy(set1,set2,set3)\\n']) \n",
"----------\n",
"{1, 2, 3, 4, 5} {2, 3, 4} {2, 3, 4, 5, 6}\n",
" \n",
"(6, ['printy(\"----diff\")\\n']) \n",
"----------\n",
"----diff\n",
" \n",
"(7, ['printy(set1.difference(set2))\\n']) \n",
"----------\n",
"{1, 5}\n",
" \n",
"(8, ['printy(set1.difference(set3))\\n']) \n",
"----------\n",
"{1}\n",
" \n",
"(9, ['printy(set2.difference(set1))\\n']) \n",
"----------\n",
"set()\n",
" \n",
"(10, ['printy(set2.difference(set3))\\n']) \n",
"----------\n",
"set()\n",
" \n",
"(11, ['printy(set3.difference(set1))\\n']) \n",
"----------\n",
"{6}\n",
" \n",
"(12, ['printy(set3.difference(set2))\\n']) \n",
"----------\n",
"{5, 6}\n",
" \n",
"(13, ['printy(\"- intersection----\")\\n']) \n",
"----------\n",
"- intersection----\n",
" \n",
"(14, ['printy(set1.intersection(set2))\\n']) \n",
"----------\n",
"{2, 3, 4}\n",
" \n",
"(15, ['printy(set1.intersection(set3))\\n']) \n",
"----------\n",
"{2, 3, 4, 5}\n",
" \n",
"(16, ['printy(set2.intersection(set1))\\n']) \n",
"----------\n",
"{2, 3, 4}\n",
" \n",
"(17, ['printy(set2.intersection(set3))\\n']) \n",
"----------\n",
"{2, 3, 4}\n",
" \n",
"(18, ['printy(set3.intersection(set1))\\n']) \n",
"----------\n",
"{2, 3, 4, 5}\n",
" \n",
"(19, ['printy(set3.intersection(set2))\\n']) \n",
"----------\n",
"{2, 3, 4}\n",
" \n",
"(20, ['printy(\"----union---\")\\n']) \n",
"----------\n",
"----union---\n",
" \n",
"(21, ['printy(set1.union(set2))\\n']) \n",
"----------\n",
"{1, 2, 3, 4, 5}\n",
" \n",
"(22, ['printy(set1.union(set3))\\n']) \n",
"----------\n",
"{1, 2, 3, 4, 5, 6}\n",
" \n",
"(23, ['printy(set2.union(set1))\\n']) \n",
"----------\n",
"{1, 2, 3, 4, 5}\n",
" \n",
"(24, ['printy(set2.union(set3))\\n']) \n",
"----------\n",
"{2, 3, 4, 5, 6}\n",
" \n",
"(25, ['printy(set3.union(set1))\\n']) \n",
"----------\n",
"{1, 2, 3, 4, 5, 6}\n",
" \n",
"(26, ['printy(set3.union(set2))\\n']) \n",
"----------\n",
"{2, 3, 4, 5, 6}\n",
" \n"
]
}
],
"source": [
"set1={1,2,3,4,5}\n",
"set2={2,3,4}\n",
"set3={2,3,4,5,6}\n",
"\n",
"printy(set1,set2,set3)\n",
"printy(\"----diff\")\n",
"printy(set1.difference(set2))\n",
"printy(set1.difference(set3))\n",
"printy(set2.difference(set1))\n",
"printy(set2.difference(set3))\n",
"printy(set3.difference(set1))\n",
"printy(set3.difference(set2))\n",
"printy(\"- intersection----\")\n",
"printy(set1.intersection(set2))\n",
"printy(set1.intersection(set3))\n",
"printy(set2.intersection(set1))\n",
"printy(set2.intersection(set3))\n",
"printy(set3.intersection(set1))\n",
"printy(set3.intersection(set2))\n",
"printy(\"----union---\")\n",
"printy(set1.union(set2))\n",
"printy(set1.union(set3))\n",
"printy(set2.union(set1))\n",
"printy(set2.union(set3))\n",
"printy(set3.union(set1))\n",
"printy(set3.union(set2))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "g2M7EbFbNP1b"
},
"source": [
"Not: Yukarıdaki altalta aynı hizada olan tüm printy ifadesini tek seferde yapmanın yolu var. ben mesela bunların hepsi print iken printy'yi tek seferde yaptım. Alt tuşuna basarak seçmek. aşağıdaki gibi seçip t tuşuna basarsam tüm ty'ler t olur."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SgE1e1v8NP1b"
},
"source": [
"![resim.png](data:image/png;base64,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)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BNbPUbLBNP1b"
},
"source": [
"## Zip"
]
},
{
"cell_type": "code",
"execution_count": 137,
"metadata": {
"id": "PEvEjCdmNP1c"
},
"outputs": [],
"source": [
"x=[1,2,3]\n",
"y=[10,20,30]\n",
"onkatlar=zip(x,y)\n",
"#print(list(onkatlar)) #yazdırmak için liste çevir. bi kez liste çevirlince artık zip özelliği kalmaz,\n",
"#o yüzden alttaki blok çalışmaz,o yüzden geçici olarak commentledim. deneyin ve görün"
]
},
{
"cell_type": "code",
"execution_count": 138,
"metadata": {
"id": "O7BG__WUNP1c",
"outputId": "4ccf793d-465e-4ebe-d047-99ef439b8b40",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"(1, 2, 3)"
]
},
"metadata": {},
"execution_count": 138
}
],
"source": [
"#tekrar ayırmak için\n",
"x2, y2 = zip(*onkatlar)\n",
"x2"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "JGOPan-RNP1c"
},
"source": [
"### Zip vs Dict"
]
},
{
"cell_type": "code",
"execution_count": 139,
"metadata": {
"id": "rzotDh-vNP1c",
"outputId": "5627cbb1-ca84-4325-f235-61737dc2d5f5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1 10\n",
"2 20\n",
"3 30\n"
]
}
],
"source": [
"a=[1,2,3]\n",
"b=[10,20,30]\n",
"c=zip(a,b)\n",
"for i,j in c:\n",
" print(i,j)"
]
},
{
"cell_type": "code",
"execution_count": 140,
"metadata": {
"id": "yaVPVoMiNP1d",
"outputId": "0910ea05-e1fe-462a-d98e-65f5548e1f13",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n"
]
}
],
"source": [
"a=[1,2,3]\n",
"b=[10,20,30]\n",
"c=zip(a,b)\n",
"print(type(list(c)[0]))\n",
"dict_=dict(c) #zipten dict üretimi\n",
"for k,v in dict_.items():\n",
" print(k,v)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DAIKLenQNP1d"
},
"source": [
"## Listlerle kullanılan önemli fonksiyonlar"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7Ik8QJWvNP1d"
},
"source": [
"### Map ve Reduce"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "feqvx2VsNP1d"
},
"source": [
"Map: bir veri yapısındaki elemanları sırayla bir fonksiyona gönderir ve sonuç yine bir veri yapısıdır
\n",
"Reduce: elemanları sırayla gönderir, bir eritme mantığı var, her bir önceki elamnını sonucyla bir sonraki eleman işleme girer"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "aTuNdPsxNP1d"
},
"source": [
"#### Map"
]
},
{
"cell_type": "code",
"execution_count": 141,
"metadata": {
"id": "A5_yqtr9NP1e",
"outputId": "92a6faa2-d3f2-400d-bf19-1da66ae9744a",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[1, 4, 9, 16, 25]"
]
},
"metadata": {},
"execution_count": 141
}
],
"source": [
"items=[1,2,3,4,5]\n",
"def kareal(sayı):\n",
" return sayı**2\n",
"\n",
"kareler=map(kareal,items) #lambdalı da olur. map(lambda x: x**2, items)\n",
"list(kareler) #yazdırmak için liste çevir\n"
]
},
{
"cell_type": "code",
"execution_count": 142,
"metadata": {
"id": "aAd1opFtNP1e",
"outputId": "ab89bb40-c032-4755-efbc-337228e912ac",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1\n",
"6\n",
"15\n",
"28\n",
"45\n",
"66\n",
"91\n",
"120\n",
"153\n"
]
}
],
"source": [
"#birden fazla veri yapısı da girebilir işleme\n",
"range1=range(1,10)\n",
"range2=range(1,20,2)\n",
"\n",
"mymap=map(lambda x,y:x*y,range1,range2)\n",
"for i in mymap:\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 143,
"metadata": {
"id": "XCiepbUMNP1e",
"outputId": "aebaa2d4-038b-435f-9d61-8f8decdfc920",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[1, 6, 15, 28, 45, 66, 91, 120, 153]"
]
},
"metadata": {},
"execution_count": 143
}
],
"source": [
"#comprehensionla da yapılabilir.\n",
"çarpım=[x*y for x,y in zip(range1,range2)]\n",
"çarpım"
]
},
{
"cell_type": "code",
"execution_count": 144,
"metadata": {
"scrolled": true,
"id": "8a4dlVGBNP1e",
"outputId": "33d10e22-9ea5-4e5a-f610-5fcf372d1830",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o']"
]
},
"metadata": {},
"execution_count": 144
}
],
"source": [
"harfler=map(chr,range(97,112))\n",
"list(harfler)"
]
},
{
"cell_type": "code",
"execution_count": 145,
"metadata": {
"id": "GQa0tF0xNP1e",
"outputId": "c8eef550-d3b7-40c0-fd43-7d7d2c7ca4e4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o']"
]
},
"metadata": {},
"execution_count": 145
}
],
"source": [
"harfler2=[chr(x) for x in range(97,112)]\n",
"harfler2"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hsRSWXPYNP1f"
},
"source": [
"#### Reduce"
]
},
{
"cell_type": "code",
"execution_count": 146,
"metadata": {
"id": "k-33ZD62NP1f",
"outputId": "bbf6ec4f-8b8d-4f9a-bb64-a0e294142b28",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"362880"
]
},
"metadata": {},
"execution_count": 146
}
],
"source": [
"from functools import reduce\n",
"def faktoriyel(sayı1,sayı2):\n",
" return sayı1*sayı2\n",
"\n",
"sayılar=range(1,10)\n",
"fakt=reduce(faktoriyel,sayılar)\n",
"fakt"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "wx8xOTGGNP1f"
},
"source": [
"#### Filter"
]
},
{
"cell_type": "code",
"execution_count": 147,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-04T17:50:33.788733Z",
"start_time": "2020-12-04T17:50:33.783746Z"
},
"id": "tQB2akYENP1f",
"outputId": "b90a7a49-d3c6-4c28-a9f8-dcd583b16bef",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"18\n",
"24\n",
"32\n"
]
}
],
"source": [
"ages = [5, 12, 17, 18, 24, 32]\n",
"\n",
"def myFunc(x):\n",
" if x < 18:\n",
" return False\n",
" else:\n",
" return True\n",
"\n",
"adults = filter(myFunc, ages)\n",
"\n",
"for x in adults:\n",
" print(x)"
]
},
{
"cell_type": "code",
"execution_count": 148,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-04T17:51:27.064547Z",
"start_time": "2020-12-04T17:51:27.060518Z"
},
"id": "4F6I7k98NP1f",
"outputId": "0af51789-c6f1-4b02-8a53-dbd2bd39af36",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[18, 24, 32]"
]
},
"metadata": {},
"execution_count": 148
}
],
"source": [
"#veya lambda ile\n",
"list(filter(lambda x:x>=18,ages))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "FmA92zRANP1f"
},
"source": [
"### Enumerate"
]
},
{
"cell_type": "code",
"execution_count": 149,
"metadata": {
"scrolled": true,
"id": "WMSPL5qrNP1g",
"outputId": "1bc437fa-9a6f-402a-869e-cfa3f97e40d6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[(1, 'Ocak'), (2, 'Şubat'), (3, 'Mart')]\n",
"1 Ocak\n",
"2 Şubat\n",
"3 Mart\n"
]
}
],
"source": [
"aylar=[\"Ocak\",\"Şubat\",\"Mart\"]\n",
"print(list(enumerate(aylar,start=1)))\n",
"dict_=dict(enumerate(aylar,start=1))\n",
"for k,v in dict_.items():\n",
" print(k,v)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "y41iO0qPNP1g"
},
"source": [
"### All ve Any"
]
},
{
"cell_type": "code",
"execution_count": 150,
"metadata": {
"id": "vjuEJ-uPNP1g",
"outputId": "0c136fee-c30e-4df5-c75d-d635a15afd6f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"False\n",
"True\n",
"True\n"
]
}
],
"source": [
"liste1=[True,True,False]\n",
"liste2=[True,True,True]\n",
"print(all(liste1))\n",
"print(any(liste1))\n",
"print(all(liste2))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "GOOpbi13NP1g"
},
"source": [
"# Date Time işlemleri"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0nLGJSCiNP1g"
},
"source": [
"## Modüller ve üyeleri"
]
},
{
"cell_type": "code",
"execution_count": 151,
"metadata": {
"id": "u9LRhmkENP1g"
},
"outputs": [],
"source": [
"import datetime\n",
"import time\n",
"import timeit\n",
"import dateutil\n",
"import calendar\n",
"#import timer as tr #bu threadlerle ilgili kullanma, settimer ve killtimer var"
]
},
{
"cell_type": "markdown",
"source": [
"bunlardan en çok kullanılan datetime olup, bu modül içinde bir de datetime tipi vardır. HAngisini import edeceğinize karar vermek önemli. ernizde olsam sadece modül olanı import eder, sonraki alt tip ve diğer üyeleri bunun üzeirnden çağırırım"
],
"metadata": {
"id": "ABTWlGHd8PiA"
}
},
{
"cell_type": "markdown",
"metadata": {
"id": "ogHsS-WWNP1h"
},
"source": [
"### datetime"
]
},
{
"cell_type": "code",
"execution_count": 152,
"metadata": {
"id": "KuI7TPyGNP1h",
"outputId": "01d3bd66-b733-4d74-a905-c7bb1d6bf53f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['MAXYEAR', 'MINYEAR', 'date', 'datetime', 'datetime_CAPI', 'sys', 'time', 'timedelta', 'timezone', 'tzinfo']\n"
]
}
],
"source": [
"print([i for i in dir(datetime) if not \"__\" in i])"
]
},
{
"cell_type": "code",
"execution_count": 153,
"metadata": {
"id": "XMeABvTLNP1i",
"outputId": "52fe2452-770a-4d64-9be8-2c5f4f7056b5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.datetime(2024, 9, 22, 15, 25, 25, 30003)"
]
},
"metadata": {},
"execution_count": 153
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"15"
]
},
"metadata": {},
"execution_count": 153
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.date(2024, 9, 22)"
]
},
"metadata": {},
"execution_count": 153
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"2024"
]
},
"metadata": {},
"execution_count": 153
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.date(2019, 4, 3)"
]
},
"metadata": {},
"execution_count": 153
}
],
"source": [
"datetime.datetime.now()\n",
"datetime.datetime.now().hour #saliseden yıla kadar hepsi elde edilebili\n",
"datetime.date.today()\n",
"datetime.date.today().year\n",
"datetime.date(2019,4,3)"
]
},
{
"cell_type": "code",
"source": [
"datetime.datetime.now().day # yada dt.date.today().day"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "OLx1qWvFUANF",
"outputId": "32a42b07-955e-42a7-ff89-b1358fe450db"
},
"execution_count": 154,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"22"
]
},
"metadata": {},
"execution_count": 154
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Zx00B2efNP1i"
},
"source": [
"### time (süre ölçümlerinde bunu kullancaz, bundaki time metodunu)"
]
},
{
"cell_type": "code",
"execution_count": 155,
"metadata": {
"id": "o4y2YQ-4NP1i",
"outputId": "7c121e27-cf33-4adb-97e2-64b755f4d742",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['CLOCK_BOOTTIME', 'CLOCK_MONOTONIC', 'CLOCK_MONOTONIC_RAW', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME', 'CLOCK_TAI', 'CLOCK_THREAD_CPUTIME_ID', '_STRUCT_TM_ITEMS', 'altzone', 'asctime', 'clock_getres', 'clock_gettime', 'clock_gettime_ns', 'clock_settime', 'clock_settime_ns', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'perf_counter', 'perf_counter_ns', 'process_time', 'process_time_ns', 'pthread_getcpuclockid', 'sleep', 'strftime', 'strptime', 'struct_time', 'thread_time', 'thread_time_ns', 'time', 'time_ns', 'timezone', 'tzname', 'tzset']\n"
]
}
],
"source": [
"print([i for i in dir(time) if not \"__\" in i])"
]
},
{
"cell_type": "code",
"execution_count": 156,
"metadata": {
"id": "qCo8RMt8NP1i",
"outputId": "1136be26-57ad-4342-d58f-11359319431d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['Timer', '_globals', 'default_number', 'default_repeat', 'default_timer', 'dummy_src_name', 'gc', 'itertools', 'main', 'reindent', 'repeat', 'sys', 'template', 'time', 'timeit']\n"
]
}
],
"source": [
"print([i for i in dir(timeit) if not \"__\" in i])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pS9EitMsNP1i"
},
"source": [
"### dateutil"
]
},
{
"cell_type": "code",
"execution_count": 157,
"metadata": {
"id": "flMnC1jgNP1i",
"outputId": "6a2d948d-df98-4cac-e53c-1633d214e6f5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['_common', '_version', 'parser', 'relativedelta', 'tz']\n"
]
}
],
"source": [
"print([i for i in dir(dateutil) if not \"__\" in i])"
]
},
{
"cell_type": "markdown",
"source": [
"### Calendar"
],
"metadata": {
"id": "LgyH2682UQhd"
}
},
{
"cell_type": "code",
"source": [
"calendar.mdays"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Q7L5Sj7nUQAa",
"outputId": "005203f0-d728-42ed-b805-37916fea1b3e"
},
"execution_count": 158,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]"
]
},
"metadata": {},
"execution_count": 158
}
]
},
{
"cell_type": "code",
"source": [
"calendar.Calendar().monthdayscalendar(datetime.date.today().year,datetime.date.today().month)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "tIvUKaF4UaX8",
"outputId": "17fcb4fa-827b-4e7e-f56b-29e28fff1dcf"
},
"execution_count": 159,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[[0, 0, 0, 0, 0, 0, 1],\n",
" [2, 3, 4, 5, 6, 7, 8],\n",
" [9, 10, 11, 12, 13, 14, 15],\n",
" [16, 17, 18, 19, 20, 21, 22],\n",
" [23, 24, 25, 26, 27, 28, 29],\n",
" [30, 0, 0, 0, 0, 0, 0]]"
]
},
"metadata": {},
"execution_count": 159
}
]
},
{
"cell_type": "code",
"source": [
"#bu aydaki gün sayısı\n",
"calendar.mdays[datetime.date.today().month]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "NfRlfsy55_W8",
"outputId": "02f4c58c-1d6d-4227-ee8c-e72652b8e3db"
},
"execution_count": 160,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"30"
]
},
"metadata": {},
"execution_count": 160
}
]
},
{
"cell_type": "markdown",
"source": [
"### Tarih farkları"
],
"metadata": {
"id": "iCldvgMoTMx0"
}
},
{
"cell_type": "code",
"source": [
"datetime.date.today()-datetime.date(2024,4,3)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QCoSkQIKTMV4",
"outputId": "ba10e902-b1fd-4bda-ace6-8b27a375941c"
},
"execution_count": 161,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.timedelta(days=172)"
]
},
"metadata": {},
"execution_count": 161
}
]
},
{
"cell_type": "code",
"source": [
"#gün farkını alalım\n",
"(datetime.date.today()-datetime.date(2024,4,3)).days"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "cHH11kgV6nn6",
"outputId": "89f9132a-2171-4a68-fa02-70d131b0c10a"
},
"execution_count": 162,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"172"
]
},
"metadata": {},
"execution_count": 162
}
]
},
{
"cell_type": "code",
"source": [
"#30 gün sonrası\n",
"datetime.date.today()+datetime.timedelta(days=30)\n",
"#1 ay sonra(bazen 30, bazen 31, hatta 28/29 olabilir)\n",
"datetime.date.today()+datetime.timedelta(days=calendar.mdays[datetime.date.today().month])"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "G3c0_TWmTUhk",
"outputId": "fdba2571-5c11-43e3-a4f4-52e8e231f1b3"
},
"execution_count": 163,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.date(2024, 10, 22)"
]
},
"metadata": {},
"execution_count": 163
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"datetime.date(2024, 10, 22)"
]
},
"metadata": {},
"execution_count": 163
}
]
},
{
"cell_type": "markdown",
"source": [
"### Dönüşümler"
],
"metadata": {
"id": "FgQkOvgZ7TKO"
}
},
{
"cell_type": "code",
"source": [
"# strftime: datetime nesnesini string'e dönüştürme\n",
"now = datetime.datetime.now()\n",
"date_string = now.strftime(\"%Y-%m-%d %H:%M:%S\")\n",
"print(date_string)\n",
"\n",
"# strptime: string'i datetime nesnesine dönüştürme\n",
"date_string = \"2023-10-26 15:30:00\"\n",
"datetime_object = datetime.datetime.strptime(date_string, \"%Y-%m-%d %H:%M:%S\")\n",
"print(datetime_object, type(datetime_object))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4ob8gIMu7XP4",
"outputId": "d650b3ac-2d5b-434e-99fd-394927d8a177"
},
"execution_count": 164,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"2024-09-22 15:25:25\n",
"2023-10-26 15:30:00 \n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"**datetime.strptime** fonksiyonu, belirli bir formattaki tarih ve saat bilgilerini ayrıştırmak için kullanılırken, yukarıda gördüğümüz **dateutil.parser** fonksiyonu daha genel bir ayrıştırıcıdır ve birçok farklı formatı tanıyabilir.\n",
"\n",
"**dateutil.parser** fonksiyonu, **datetime.strptime** fonksiyonundan daha esnektir ve daha fazla tarih ve saat formatını destekler. Ayrıca, dateutil.parser fonksiyonu, bilinmeyen formattaki tarih ve saat bilgilerini ayrıştırmak için de kullanılabilir.\n"
],
"metadata": {
"id": "x8FxG4UrA5ka"
}
},
{
"cell_type": "code",
"source": [
"from_util = dateutil.parser.parse(date_string)\n",
"print(from_util, type(from_util))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "P4IavL9iAAFe",
"outputId": "d2a3bcfc-ca74-4b10-c9dd-8a5d6fb5761e"
},
"execution_count": 165,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"2023-10-26 15:30:00 \n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UK2fWkAVNP1j"
},
"source": [
"## Süre ölçümü"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bhG0hYSwNP1j"
},
"source": [
"### Performans amaçlı süre ölçümü(sonuçtan bağımsız)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MMxYbw0eNP1j"
},
"source": [
"- `%'li` olanı bir fonksiyon takip eder, `%%'li` kullanımda ise alt satırdan yazarsın.\n",
"- `Time` olan tek seferlik run'ın süresini verirken `timeit` onlarca kez çalıştırıp ortalama süre verir"
]
},
{
"cell_type": "code",
"execution_count": 166,
"metadata": {
"id": "dBc-f8JzNP1j",
"outputId": "565ae13b-c342-404f-a191-f82fbf2b3d80",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"37.7 ms ± 2.34 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"source": [
"%%timeit\n",
"x=sum(range(1000000))"
]
},
{
"cell_type": "code",
"execution_count": 167,
"metadata": {
"ExecuteTime": {
"end_time": "2020-09-02T18:59:00.443453Z",
"start_time": "2020-09-02T18:59:00.277897Z"
},
"id": "QBiH7YAkNP1j",
"outputId": "b5a5a8d6-4608-4660-be9d-04603599e209",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"CPU times: user 35.5 ms, sys: 0 ns, total: 35.5 ms\n",
"Wall time: 35.6 ms\n"
]
}
],
"source": [
"%%time\n",
"x=sum(range(1000000))"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {
"id": "2PXDCsVTNP1k",
"outputId": "4293a549-6a2f-490e-ad2d-c9feff7fd4fa",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"25.7 ms ± 7.89 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"source": [
"def hesapla():\n",
" y=sum(range(1000000))\n",
"\n",
"%timeit hesapla()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ubb3G85qNP1k"
},
"source": [
"### Süreyle birlikte sonuç görme"
]
},
{
"cell_type": "code",
"execution_count": 169,
"metadata": {
"id": "4h98INXtNP1k",
"outputId": "27237b24-a405-4a5e-ccb7-cbeead847909",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"hey\n",
"süre:0.019402027130126953\n"
]
}
],
"source": [
"bas=time.time()\n",
"print(\"hey\")\n",
"hesapla()\n",
"bit=time.time()\n",
"print(\"süre:{}\".format(bit-bas))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "VSthGf9ZNP1k"
},
"source": [
"### jupyter nbextensions"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hmbvwVIcNP1k"
},
"source": [
"![resim.png](data:image/png;base64,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)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DJqzb_e3NP1l"
},
"source": [
"nbextensionsı hala kurmadıysanız alın size bir sebep daha. bu süre ölçümü kodlarına gerek yok. yukarıdaki eklentiyle her hücrenin çalışma süresini veriyor. Bir örnek:"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ku4FWmrvNP1l"
},
"source": [
"![resim.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ0AAAA1CAYAAABbTL58AAAABHNCSVQICAgIfAhkiAAAC5JJREFUeF7tXW1oVFcafuYjkxFTStYfcXXBgbrruHU71S5mYX84IFRFMWtYjCgkYQu2ZemGsLBqS0Ow0JgfJeRHtRa6xMDaJCxJRyrJLrjEH4IJ3cYsdo3YwoSo67BokDU437PvzJz7MZMzk3vNJLnJvAcGZ957zvvxnHvfe85zzjG2FBVwYQQYAUbAIAJ2g/W4GiPACDACGQQ4afCNwAgwAqYQcJqqvUyVw+EwZmZmMDc3t0wW2QwjwAgYRcBmRU7j3r17qKqqQnV1tdE4Vqzew4cPsWnTphWzz4YZgeVGwJLTk/QIYzUkjOXuLLbHCFgBAUsmDSsAwz4wAoyAHAFOGnJcWMoIMAIFEOCkUQAYFjMCjIAcAU4aclxYyggwAgUQ4KRRABgWMwKMgBwBThpyXFjKCDACBRDgpFEAmCUTf1sJzzo31q2rRP+0sKLK3Oj5Id+yA4G30vXpc7ZCXNTJ3q9AOL+JaRt5CsYrs/Yyfhb4eNw4cKgSnVeceJpvf1l+V6BT9Y2wfLCw0bEOXSwdCpbF2pm3UUzbWrnGSWOZezI4BYTSNmsA75ascVWGFLa/ku+QHROXs7KGHUlxUZPV7UjBndfEvI18mwZ+UxCj12xob3DC95YLQQNNuMraQICTxrL2ox3B27asxboUPJlvOtlxRaZz6gcbxsTPnVsT2W96mTeuq5ynz6iNPA1mf4Yu29Haa8kTCWZD4foGEOCkYQCk0lWxY/IfWW1+XxIvZ75qMt/ryfQAJKc8nbJhNCNJwfez7KUcmWRkYtZGnsncn/VJBJ+H8TznE8Hs/QQuHNeqjgxQ8iuqiC+uFQTKPGk8wdhgL3p7ezE4/mTp+zRE04rJrJlarxg16GT+nyvTD82V4L/FyOQwjULEPESV7U3Bm808WoMXsGE+cJoSbYih+f0k/Epjmqpkpl1c1jwCZZs0nowPUrIYBX6xDVVL2M2hAR2p6LGjX9jq3CvkOln3IRfWnajEhzry8VdtosEVO7YLuSq7lpV92GHWhqv0DzglsNxRkg1Pv3Oh8203dlK2UwjVnfsr0Xq+AqH8WRW0+v4dRuoX6jQn+k9o7TvHC9XTyZ8R4blHa+MnktQQuRuqwGctldD7u530vNvhwtRTkeyFGf19cGzAicnzlSouaUzG5rHZBvxeoSrlORG993d8fX8zDjXW4kePxzC4QuCvXrN2hKcd6D5lF1MnoK4xKTiabFThcRfq9mh8jBLr1HUbpq47MPRPuvZFVCQaG4IDLvib5o9W1PqUNANfReDLZ30XC+IzJ3paHGgXycVDcfSciYmpYxHl0y4076GXQN7wKkh6esbt6Blx4ebf5P4GP3WijuophLivMYHaUsdVxPXFXirPkcZP30RjPSWMxaJnoH3N0YjgA2IYOikatCYwm+EIdLKTSTxKy/4SwUcKfzCWhE80uXBb8Ao62Tl6PaW5ho/OmLWhPKwGAhi0iyVi/dKrC9VeetCuZtunH7RzR/VDhwpc/INIGL4Uhu9HyU/iQW4nUSdMpsnTYWV5OUwP7p9EwtiXxGimPsU2G0eP4E1ClGza6Q1d2kKjkhYn3hWrUzXHkxi+GM1JfnJ7tOT9sZIwUrhwW/hLPM8ppcPGbfjyhvzxmqSE4WlLZPs7GKYY5w275GYtIpVHZRHn1pYbRHgGshH5tyrLpDqZSoxqUYe+tyFLgRCfsTkr18sUYlRrYd7GojHelsI7xxO5Dxq9absEd+M/mYB/Q5qroZhfSeJIvS6+x+L7Yxp9KG/sWRueK1XccTToeJOR8xTfoh0WCmI2jPzRiWZdwhjpNpIwqP0DB77sFXpakzhGcWUK8TwHlKxIP4OPCz1eKbS3GhjNCBNW+6fUqdtq8VnHn2kbJsSDoZKgMpnqMQ3ZleVZlQSVyXQhyvTJZKVE5a4Np/dXYKjNjhEa1mdG2bsjtOIijMTtCN2tIAKYVoGu2tEnmwsSqfRjxSd6Qx/4iQs1rwIH3iSilUYefbP0gLlL/P9fd9hxRIdDe1sUXqPk1uYo+tTMZsfT6QrcTMdHHFP/5wbAraf9OKtoOpIfUaFUmF+Pf78gAioB5qU5udChkqAymUqEEsHWIRqoJKhM5oZKhMr0yWQnTBCh0iVXmjr8N4aJ/hRqhYtjZx24+C+F/BOkZpMbnpdc8LzuwJEmO7oHxDw+H8uXY2i5lEukhr4jbqDLjub9TmysJtKwichCGpEsVfnssmRnbTFjGRLUTeS0CxtpqnagwY5OShjBYm2Ua1tSC3MmRvSsUB1OGisE/Ko3W5WA93AUncrqDgU08o0jE1b4WyJBf2knDiKbJLxHU+i6lMDEfeIodNMTDQOafh2NYvKbJNobab4vAWdqwAb/Gy6MKFMaSR3TItrj4hVLPpM5SW8BTQ+IBK11oFUkCc++FE5dTOLmVBTDOjwKankJ83bxFqxrwQucNJa4U7JEaAx9ykYoHQk6X6YjQm9ob16VBJXJVCLUjA0TROgC+Lh1w+w7mZGAA6OXtFWTui/imLgUwTtHY/BuKKaM3r6vRunhC+PO/6II3kqg7yLxJQczO+6zJWRDH628lKTUpNBzNYLRTzWcT3fSUrAB5ZNEDiurJr4zlAxpVae9MQrfliTWGWi/2qtw0liWHpSdFZHJNGdk51FkMq2FTJ9MVqKAiasIXnehvVvTdySzOc2GR9OabOdW3cpAmHgdCacR7NVWZjzpg2RO2hm7LUbLuBF0/TWC/jOavnC8RFOUt5NoSE8TDibQqYx+KBl0ES9RvNgx+x+thserP/vjxJ0bxVuvhavlSYSm92ZcvYtn+h6c+hq9dJgMtNVr28F61BZ9K5rsetlZEZlMVSs7jyKT6fyQ6ZPJTLoOseS6YDN6c9ftTe9ydWCjOIiXbjP0VQWad8VQE3ci8AHt7ZAo8tQn0NJG1+g1H6JpQvuuFE7vi9MQ3obwAyeGr2mN9r9R6uVJWqGh/SYXKM4xMtP9QQWO/DpSZN9EEtUqawsEAnZM7bPBu57aXyDfdb5KQl0TovJMGhtqUU8bu5aryM6KyGSaP7LzKDKZ1kKmTyZbqpjbB2LwZ6YqtMTa5ETt59kpymSXAx76KMVDPEJQ7M+Y+J5uv92UBKpiaL9iw93DtAJDiaPzN050Yv6t2XApjuZ5Z21KENFrceJmaHPZWdJFqyDnLjsx9LvCyclH5HDDJ2KKQslm52Cl6kQN+VdD8aWnOQE6N7QWy0JjsbUY87LHJDsrIpOpjsnOo8hkukhk+mSyUgbv2Q000z6F4SBxEbu1czPuXVEEiNRs0fERtbTM2DUSw51AEvuFEwHdITf3a1EMTcbR9zGNWEivUtJLr3W08W3odgw9ORvIShlJErXv0WhHkCcjNNoJFPv/OWjJtWcsgXM60ta7h/Ze9McxeTOBZoWE+TPtmM0ZzpbS55XTZck/lnTr1i14vd6VQ8WEZf5jSSbAMlyVdoj+1pnZcZp+Y3sP0gP5CXEcRDRyWXkEeKSx8n3AHsxDgHZZ9oVpg1gEj0ZSqLxqw7HfO43tgZiniwWlRoCTRqkRZX2LRCB9SybhzlAaRISK4X2aK6hepGZuXhoE5rNNpdHLWhiBF0OAVkuObdV2z2a2k7cRP/JedFXvonwxMKzZipOGNfulfL3KOddRvjBYOXKenli5d9g3RsCCCHDSsGCnsEuMgJUR4KRh5d5h3xgBCyLAScOCncIuMQJWRoCThpV7h31jBCyIACcNC3YKu8QIWBkBSyaN9evXY3Z21sq4sW+MQNkiYMmzJ+FwGDMzM5ibmyvbjuHAGQGrImDJpGFVsNgvRoARSP8hUS6MACPACJhAgJOGCbC4KiPACPBIg+8BRoARMIkAjzRMAsbVGYFyR4CTRrnfARw/I2ASAU4aJgHj6oxAuSPASaPc7wCOnxEwiQAnDZOAcXVGoNwR4KRR7ncAx88ImESAk4ZJwLg6I1DuCPwfNyIvZqNDnRwAAAAASUVORK5CYII=)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5jd7IUY-NP1l"
},
"source": [
"# Önemli bazı modüller"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9flgVhIsNP1l"
},
"source": [
"Aşağıda önemli olduğunu düşündüğüm bazı modülleri bulacaksınız. Tabiki bunların dışında da başak kütüphaneler/modüller var, bunları da zamanla öğreneceksiniz."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "zIBmaEyINP1l"
},
"source": [
"## os"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ETNToPtcNP1m"
},
"source": [
"İşletim sisteminden bağımsız çalışacak bir koda(dosyalama sistemi v.s ile ilgili) ihtiyacımız olduğunda os modülünü kullanırız."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hvw5ofEoNP1m"
},
"source": [
"### Klasör ve dosya işlemleri"
]
},
{
"cell_type": "code",
"execution_count": 170,
"metadata": {
"id": "idhsE3pENP1m",
"outputId": "72ec3d22-1dc3-46c1-b56e-ac3f98e17786",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'/content'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 170
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'.'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 170
}
],
"source": [
"import os\n",
"os.getcwd() #o anki aktif folder\n",
"os.curdir #mevcut dizini temsil eden karakter, genelde bu . oluyor. Bunu daha çok prefix path olarak kullanırız"
]
},
{
"cell_type": "code",
"source": [
"os.listdir() #o anki aktif folderdaki dosyaları listeler"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "YRnxg8nGITn8",
"outputId": "978b5141-6a0d-45a9-b24f-9c2df3dbbe1e"
},
"execution_count": 171,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['.config', 'drive', 'sample_data']"
]
},
"metadata": {},
"execution_count": 171
}
]
},
{
"cell_type": "code",
"execution_count": 172,
"metadata": {
"id": "0oHJDb3zNP1m",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "2a8c7a49-1c9f-4bcd-ae15-61eee8b06a4e"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['Othercomputers',\n",
" '.file-revisions-by-id',\n",
" 'MyDrive',\n",
" '.shortcut-targets-by-id',\n",
" '.Trash-0']"
]
},
"metadata": {},
"execution_count": 172
}
],
"source": [
"os.chdir(\"drive\") #aktif klasörü değiştiriyoruz\n",
"os.listdir()"
]
},
{
"cell_type": "code",
"execution_count": 173,
"metadata": {
"id": "MJ9SFSM1NP1m",
"outputId": "274ebbb8-ea9d-4cd2-9290-b1ebd7033088",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'..'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 173
}
],
"source": [
"os.pardir #parent klasörü temsil eden karakter"
]
},
{
"cell_type": "code",
"execution_count": 174,
"metadata": {
"id": "Ey3N5KpINP1n",
"outputId": "83ec6a2f-9800-417d-dad9-266ce94edb9c",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['.config', 'drive', 'sample_data']"
]
},
"metadata": {},
"execution_count": 174
}
],
"source": [
"os.listdir(os.pardir)"
]
},
{
"cell_type": "code",
"execution_count": 175,
"metadata": {
"id": "n3LZWSB3NP1n",
"outputId": "afccb4c8-66e6-40a5-81b3-34f2d3a74a7c",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {},
"execution_count": 175
}
],
"source": [
"os.path.exists('Python Genel.ipynb') #bir dosya/klasör mevcut mu"
]
},
{
"cell_type": "code",
"execution_count": 176,
"metadata": {
"id": "ZnWb90SkNP1n",
"outputId": "2fdc4f0c-407c-465a-c648-f689bc660556",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {},
"execution_count": 176
}
],
"source": [
"os.path.isfile('olmayandosya.txt') #parametredeki bir dosya mı? veya bir dosya mevcut mu anlamında da kullanılabilir."
]
},
{
"cell_type": "code",
"execution_count": 177,
"metadata": {
"id": "XhSxCvnqNP1n",
"outputId": "fd06880b-bbd7-4773-aa31-482526f71ca4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {},
"execution_count": 177
}
],
"source": [
"os.path.isdir(\"klasor\")"
]
},
{
"cell_type": "code",
"execution_count": 178,
"metadata": {
"id": "9TEIONcbNP1n",
"outputId": "7e1d8090-d275-48ff-c63a-6908af1cac11",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[]\n"
]
}
],
"source": [
"# list all files in a directory in Python.\n",
"from os import listdir\n",
"from os.path import isfile, join\n",
"p=os.getcwd()\n",
"files_list = [f for f in listdir(p) if isfile(join(p, f))]\n",
"print(files_list);"
]
},
{
"cell_type": "code",
"execution_count": 179,
"metadata": {
"scrolled": true,
"id": "pjdzqreQNP1o",
"outputId": "87141785-3f64-4fe3-cd05-8acf35fb12ab",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/drive/MyDrive/Colab Notebooks\n",
"/content/drive/MyDrive/Colab Notebooks/.config\n",
"/content/drive/MyDrive/Colab Notebooks/.config/startup\n"
]
}
],
"source": [
"dizin= \"/content/drive/MyDrive/Colab Notebooks\"\n",
"for kökdizin, altdizinler, dosyalar in os.walk(dizin):\n",
" print(kökdizin)"
]
},
{
"cell_type": "code",
"execution_count": 180,
"metadata": {
"id": "uBHDharYNP1o",
"outputId": "390d5cbc-b628-4c14-e6ae-a18c11c88a57",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/drive/MyDrive/Colab Notebooks/Snippets: Drive adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/Snippets: Accessing files adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/Data Table Display adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/Forms adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/gemini.ipynb adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/Harici veriler: Yerel Dosyalar, Drive, E-Tablolar ve Cloud Storage adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/_My Custom Snippets.ipynb\n",
"/content/drive/MyDrive/Colab Notebooks/_Colab Aboneliğinizden En İyi Şekilde Yararlanma\n",
"/content/drive/MyDrive/Colab Notebooks/_pathler, drive, github.ipynb\n",
"/content/drive/MyDrive/Colab Notebooks/pandas.ipynb adlı not defterinin kopyası\n",
"/content/drive/MyDrive/Colab Notebooks/.config/startup/starters.py\n"
]
}
],
"source": [
"for kökdizin, altdizinler, dosyalar in os.walk(dizin):\n",
" for dosya in dosyalar:\n",
" print(os.sep.join([kökdizin, dosya]))"
]
},
{
"cell_type": "code",
"source": [
"%cd \"MyDrive\""
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_UCgZfRxJX2f",
"outputId": "81d5ee3e-bdb6-45ef-bcf1-84b5e89f6dec"
},
"execution_count": 181,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/drive/MyDrive\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"!touch abc.txt #dosya yaratalım"
],
"metadata": {
"id": "5_X3DvwpIrwo"
},
"execution_count": 182,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 183,
"metadata": {
"scrolled": true,
"id": "qluw2XfeNP1o",
"outputId": "d35987c6-867c-462e-b4c1-4be768a54ea2",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Last modified: 1727018731.0\n",
"Created: Sun Sep 22 15:25:31 2024\n"
]
}
],
"source": [
"import os.path, time, datetime\n",
"print(\"Last modified: %s\" % os.path.getmtime(\"abc.txt\")) #formatlanmamış\n",
"print(\"Created: %s\" % time.ctime(os.path.getctime(\"abc.txt\")))"
]
},
{
"cell_type": "code",
"source": [
"!rm abc.txt #tekrar silelim"
],
"metadata": {
"id": "cBXWgS90JqmK"
},
"execution_count": 184,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 185,
"metadata": {
"id": "WyqHfL5gNP1o"
},
"outputs": [],
"source": [
"#Sadece windowsta. Linux için-->https://stackoverflow.com/questions/17317219/is-there-an-platform-independent-equivalent-of-os-startfile\n",
"# os.startfile('calc.exe') #dosya açar, program başaltır, internet sitesine gider v.s"
]
},
{
"cell_type": "code",
"execution_count": 186,
"metadata": {
"id": "YM8SBcjENP1o"
},
"outputs": [],
"source": [
"# os.startfile(\"/falanca/klasördeki/filanca/dosya\")"
]
},
{
"cell_type": "code",
"execution_count": 187,
"metadata": {
"id": "NgmG0Uw_NP1p"
},
"outputs": [],
"source": [
"# os.startfile(\"www.volkanyurtseven.com\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qwCvraQ9NP1p"
},
"source": [
"### Sistem ve Environment bilgileri"
]
},
{
"cell_type": "code",
"execution_count": 188,
"metadata": {
"scrolled": true,
"id": "kLkITj7VNP1p",
"outputId": "e2edc182-1e94-4361-8007-a142c568a7b6",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"posix\n",
"Linux\n",
"6.1.85+\n"
]
}
],
"source": [
"import platform, os\n",
"print(os.name)\n",
"print(platform.system())\n",
"print(platform.release())"
]
},
{
"cell_type": "code",
"execution_count": 189,
"metadata": {
"id": "B7-oLbonNP1p",
"outputId": "7cb1bc7e-8f7a-461d-86a8-d493052061c4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'SHELL': '/bin/bash',\n",
" 'NV_LIBCUBLAS_VERSION': '12.2.5.6-1',\n",
" 'NVIDIA_VISIBLE_DEVICES': 'all',\n",
" 'COLAB_JUPYTER_TRANSPORT': 'ipc',\n",
" 'NV_NVML_DEV_VERSION': '12.2.140-1',\n",
" 'NV_CUDNN_PACKAGE_NAME': 'libcudnn8',\n",
" 'CGROUP_MEMORY_EVENTS': '/sys/fs/cgroup/memory.events /var/colab/cgroup/jupyter-children/memory.events',\n",
" 'NV_LIBNCCL_DEV_PACKAGE': 'libnccl-dev=2.19.3-1+cuda12.2',\n",
" 'NV_LIBNCCL_DEV_PACKAGE_VERSION': '2.19.3-1',\n",
" 'VM_GCE_METADATA_HOST': '169.254.169.253',\n",
" 'HOSTNAME': '51c8695c6b32',\n",
" 'LANGUAGE': 'en_US',\n",
" 'TBE_RUNTIME_ADDR': '172.28.0.1:8011',\n",
" 'COLAB_TPU_1VM': '',\n",
" 'GCE_METADATA_TIMEOUT': '3',\n",
" 'NVIDIA_REQUIRE_CUDA': 'cuda>=12.2 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=525,driver<526 brand=unknown,driver>=525,driver<526 brand=nvidia,driver>=525,driver<526 brand=nvidiartx,driver>=525,driver<526 brand=geforce,driver>=525,driver<526 brand=geforcertx,driver>=525,driver<526 brand=quadro,driver>=525,driver<526 brand=quadrortx,driver>=525,driver<526 brand=titan,driver>=525,driver<526 brand=titanrtx,driver>=525,driver<526',\n",
" 'NV_LIBCUBLAS_DEV_PACKAGE': 'libcublas-dev-12-2=12.2.5.6-1',\n",
" 'NV_NVTX_VERSION': '12.2.140-1',\n",
" 'COLAB_JUPYTER_IP': '172.28.0.12',\n",
" 'NV_CUDA_CUDART_DEV_VERSION': '12.2.140-1',\n",
" 'NV_LIBCUSPARSE_VERSION': '12.1.2.141-1',\n",
" 'COLAB_LANGUAGE_SERVER_PROXY_ROOT_URL': 'http://172.28.0.1:8013/',\n",
" 'NV_LIBNPP_VERSION': '12.2.1.4-1',\n",
" 'NCCL_VERSION': '2.19.3-1',\n",
" 'KMP_LISTEN_PORT': '6000',\n",
" 'TF_FORCE_GPU_ALLOW_GROWTH': 'true',\n",
" 'ENV': '/root/.bashrc',\n",
" 'PWD': '/',\n",
" 'TBE_EPHEM_CREDS_ADDR': '172.28.0.1:8009',\n",
" 'COLAB_LANGUAGE_SERVER_PROXY_REQUEST_TIMEOUT': '30s',\n",
" 'TBE_CREDS_ADDR': '172.28.0.1:8008',\n",
" 'NV_CUDNN_PACKAGE': 'libcudnn8=8.9.6.50-1+cuda12.2',\n",
" 'NVIDIA_DRIVER_CAPABILITIES': 'compute,utility',\n",
" 'COLAB_JUPYTER_TOKEN': '',\n",
" 'LAST_FORCED_REBUILD': '20240627',\n",
" 'NV_NVPROF_DEV_PACKAGE': 'cuda-nvprof-12-2=12.2.142-1',\n",
" 'NV_LIBNPP_PACKAGE': 'libnpp-12-2=12.2.1.4-1',\n",
" 'NV_LIBNCCL_DEV_PACKAGE_NAME': 'libnccl-dev',\n",
" 'TCLLIBPATH': '/usr/share/tcltk/tcllib1.20',\n",
" 'NV_LIBCUBLAS_DEV_VERSION': '12.2.5.6-1',\n",
" 'NVIDIA_PRODUCT_NAME': 'CUDA',\n",
" 'COLAB_KERNEL_MANAGER_PROXY_HOST': '172.28.0.12',\n",
" 'NV_LIBCUBLAS_DEV_PACKAGE_NAME': 'libcublas-dev-12-2',\n",
" 'NV_CUDA_CUDART_VERSION': '12.2.140-1',\n",
" 'COLAB_WARMUP_DEFAULTS': '1',\n",
" 'HOME': '/root',\n",
" 'LANG': 'en_US.UTF-8',\n",
" 'COLUMNS': '100',\n",
" 'CUDA_VERSION': '12.2.2',\n",
" 'CLOUDSDK_CONFIG': '/content/.config',\n",
" 'NV_LIBCUBLAS_PACKAGE': 'libcublas-12-2=12.2.5.6-1',\n",
" 'NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE': 'cuda-nsight-compute-12-2=12.2.2-1',\n",
" 'COLAB_RELEASE_TAG': 'release-colab_20240919-060125_RC00',\n",
" 'KMP_TARGET_PORT': '9000',\n",
" 'KMP_EXTRA_ARGS': '--logtostderr --listen_host=172.28.0.12 --target_host=172.28.0.12 --tunnel_background_save_url=https://colab.research.google.com/tun/m/cc48301118ce562b961b3c22d803539adc1e0c19/m-s-2x16lz196cw9 --tunnel_background_save_delay=10s --tunnel_periodic_background_save_frequency=30m0s --enable_output_coalescing=true --output_coalescing_required=true --gorilla_ws_opt_in --log_code_content',\n",
" 'NV_LIBNPP_DEV_PACKAGE': 'libnpp-dev-12-2=12.2.1.4-1',\n",
" 'COLAB_LANGUAGE_SERVER_PROXY_LSP_DIRS': '/datalab/web/pyright/typeshed-fallback/stdlib,/usr/local/lib/python3.10/dist-packages',\n",
" 'NV_LIBCUBLAS_PACKAGE_NAME': 'libcublas-12-2',\n",
" 'COLAB_KERNEL_MANAGER_PROXY_PORT': '6000',\n",
" 'CLOUDSDK_PYTHON': 'python3',\n",
" 'NV_LIBNPP_DEV_VERSION': '12.2.1.4-1',\n",
" 'NO_GCE_CHECK': 'False',\n",
" 'PYTHONPATH': '/env/python',\n",
" 'NV_LIBCUSPARSE_DEV_VERSION': '12.1.2.141-1',\n",
" 'LIBRARY_PATH': '/usr/local/cuda/lib64/stubs',\n",
" 'NV_CUDNN_VERSION': '8.9.6.50',\n",
" 'SHLVL': '0',\n",
" 'NV_CUDA_LIB_VERSION': '12.2.2-1',\n",
" 'COLAB_LANGUAGE_SERVER_PROXY': '/usr/colab/bin/language_service',\n",
" 'NVARCH': 'x86_64',\n",
" 'NV_CUDNN_PACKAGE_DEV': 'libcudnn8-dev=8.9.6.50-1+cuda12.2',\n",
" 'NV_CUDA_COMPAT_PACKAGE': 'cuda-compat-12-2',\n",
" 'NV_LIBNCCL_PACKAGE': 'libnccl2=2.19.3-1+cuda12.2',\n",
" 'LD_LIBRARY_PATH': '/usr/local/nvidia/lib:/usr/local/nvidia/lib64',\n",
" 'COLAB_GPU': '',\n",
" 'NV_CUDA_NSIGHT_COMPUTE_VERSION': '12.2.2-1',\n",
" 'GCS_READ_CACHE_BLOCK_SIZE_MB': '16',\n",
" 'NV_NVPROF_VERSION': '12.2.142-1',\n",
" 'LC_ALL': 'en_US.UTF-8',\n",
" 'COLAB_FILE_HANDLER_ADDR': 'localhost:3453',\n",
" 'PATH': '/opt/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin',\n",
" 'NV_LIBNCCL_PACKAGE_NAME': 'libnccl2',\n",
" 'COLAB_DEBUG_ADAPTER_MUX_PATH': '/usr/local/bin/dap_multiplexer',\n",
" 'NV_LIBNCCL_PACKAGE_VERSION': '2.19.3-1',\n",
" 'PYTHONWARNINGS': 'ignore:::pip._internal.cli.base_command',\n",
" 'DEBIAN_FRONTEND': 'noninteractive',\n",
" 'COLAB_BACKEND_VERSION': 'next',\n",
" 'OLDPWD': '/',\n",
" 'JPY_PARENT_PID': '92',\n",
" 'TERM': 'xterm-color',\n",
" 'CLICOLOR': '1',\n",
" 'PAGER': 'cat',\n",
" 'GIT_PAGER': 'cat',\n",
" 'MPLBACKEND': 'module://ipykernel.pylab.backend_inline',\n",
" 'ENABLE_DIRECTORYPREFETCHER': '1',\n",
" 'USE_AUTH_EPHEM': '1',\n",
" 'PYDEVD_USE_FRAME_EVAL': 'NO'}"
]
},
"metadata": {},
"execution_count": 189
}
],
"source": [
"dict(os.environ)"
]
},
{
"cell_type": "code",
"execution_count": 190,
"metadata": {
"id": "PrSwwZeBNP1p"
},
"outputs": [],
"source": [
"# print(dict(os.environ)[\"HOMEPATH\"])\n",
"# print(dict(os.environ)[\"USERNAME\"])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "QkXjdGPuNP1p"
},
"source": [
"## random"
]
},
{
"cell_type": "code",
"execution_count": 191,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T15:44:49.592635Z",
"start_time": "2020-11-22T15:44:49.579668Z"
},
"id": "3rj9nepQNP1q",
"outputId": "3fff8a56-1bb1-45bf-9dce-6e95b2f5eee2",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"10\n",
"13\n",
"8\n",
"[3, 1, 3]\n",
"0.37961522332372777\n",
"2.6298644191144316\n",
"[3, 3]\n"
]
}
],
"source": [
"import random\n",
"dizi=[3,5,8,3,2,1,9]\n",
"random.seed(1)\n",
"print(random.randint(2,48)) #2 ile 48 arasında\n",
"print(random.randrange(1,100,3))\n",
"print(random.choice(dizi))\n",
"print(random.choices(dizi,k=3)) #çektiğini geri koyar, sampledan farkı bu, o yüzden aynısı çıkabilir\n",
"print(random.random()) #0-1 arası\n",
"print(random.uniform(2,5)) #2-5 arası küsurlu sayı\n",
"print(random.sample(dizi,2)) #çektiğini geri koymaz, choicestan farkı bu"
]
},
{
"cell_type": "code",
"execution_count": 192,
"metadata": {
"id": "Chjq0qoINP1r",
"outputId": "45695dcb-97e3-44a1-df0d-64479541b198",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[2, 5, 8, 3, 1, 3, 9]"
]
},
"metadata": {},
"execution_count": 192
}
],
"source": [
"#liste karıştırmak\n",
"random.shuffle(dizi)\n",
"dizi"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "zIVd55b_NP1r"
},
"source": [
"## array"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "yEQlL9_LNP1r"
},
"source": [
"listin hemen hemen aynısı olup önemli bir farkı, içine sadece belli tipte eleman almasıdır. Bu yüzden memory performansı açısından liste göre daha iyidir.ancak list'ler daha hızlıdır. Ayrıca sayısal bir dizi kullanacaksanız numpy kullanmanızı tavsiye ederim. Bunun dışıdna çok büyük metinsel diziler oluşturacaksanız array kullanabilirsinz."
]
},
{
"cell_type": "code",
"execution_count": 193,
"metadata": {
"id": "Aehg6NoUNP1r",
"outputId": "67cb0480-235a-4ccc-9e7f-99631a36be54",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"92 88\n"
]
}
],
"source": [
"from array import array\n",
"import sys\n",
"arr=array('i',[1,2,3])\n",
"lst=[1,2,3]\n",
"print(sys.getsizeof(arr),sys.getsizeof(lst)) #arr'ın memory kullanımı daha düşüktür"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Wwf1DhqXNP1r"
},
"source": [
"## collections"
]
},
{
"cell_type": "code",
"execution_count": 194,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T12:42:13.976560Z",
"start_time": "2020-11-22T12:42:13.970578Z"
},
"id": "OigSvt6TNP1r",
"outputId": "03e468fd-4d7e-4764-ca7a-2dad1d4a37fb",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"2"
]
},
"metadata": {},
"execution_count": 194
}
],
"source": [
"my_list = [\"a\",\"b\",\"c\",\"c\",\"e\",\"c\",\"b\",\"b\",\"a\"]\n",
"my_list.count(\"a\")"
]
},
{
"cell_type": "code",
"execution_count": 195,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T12:42:42.671252Z",
"start_time": "2020-11-22T12:42:42.668256Z"
},
"id": "MKziwSJ3NP1r",
"outputId": "1aa014a1-2768-4f65-e9fd-fdea33bf3fb8",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Counter({'b': 3, 'c': 3, 'a': 2, 'e': 1})\n",
"2\n"
]
}
],
"source": [
"from collections import Counter\n",
"\n",
"cn = Counter(my_list) #dictionary benzeri bir yapı. tüm dictionary metodları kullanılabilir\n",
"print(cn)\n",
"print(cn[\"a\"]) #yukarda list ile yaptığımızın aynısı"
]
},
{
"cell_type": "code",
"execution_count": 196,
"metadata": {
"id": "29BWc8LiNP1r",
"outputId": "66290e3b-9233-4adb-9629-606a4b561366",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Counter({'sen': 3, 'seni': 2, 'bil': 1, 'bilmezsen': 1, 'kendini': 1})"
]
},
"metadata": {},
"execution_count": 196
}
],
"source": [
"str_ = \"sen seni bil sen seni sen bilmezsen kendini\"\n",
"cn = Counter(str_.split(' '))\n",
"cn"
]
},
{
"cell_type": "code",
"execution_count": 197,
"metadata": {
"id": "y0tSvEiiNP1s",
"outputId": "533830e2-2567-4395-a2a7-a9890728fc31",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[('sen', 3), ('seni', 2)]\n",
"['sen', 'seni', 'bil', 'bilmezsen', 'kendini']\n",
"{'sen': 3, 'seni': 2, 'bil': 1, 'bilmezsen': 1, 'kendini': 1}\n"
]
}
],
"source": [
"print(cn.most_common(2)) #en çok kullanılan 2 kelime\n",
"print(list(cn)) #key değerlerinin listeye çevrilmiş hali\n",
"print(dict(cn)) #key-value değerlerinin sözlüğe çevrilmiş hali"
]
},
{
"cell_type": "code",
"execution_count": 198,
"metadata": {
"id": "0yot3vKfNP1s",
"outputId": "c4d448b4-05e1-46c3-cc0a-23b8600d4c62",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"a 4\n",
"c 3\n",
"b 2\n",
"----\n",
"a 4\n",
"c 3\n",
"b 2\n"
]
}
],
"source": [
"#OrderDict'e artık ihtiyaç yoktur. Python 3.7den itibaren de dictioanryye girilen sırayı korumaktadır\n",
"#aşağıdaki örnekten de görebiliyoruz\n",
"from collections import OrderedDict\n",
"liste = [\"a\",\"c\",\"c\",\"a\",\"b\",\"a\",\"a\",\"b\",\"c\"]\n",
"cnt = Counter(liste)\n",
"od = OrderedDict(cnt.most_common())\n",
"d=dict(cnt.most_common())\n",
"for key, value in od.items():\n",
" print(key, value)\n",
"print(\"----\")\n",
"for key, value in d.items():\n",
" print(key, value)"
]
},
{
"cell_type": "code",
"execution_count": 199,
"metadata": {
"id": "stMs_GdcNP1s",
"outputId": "620cbbeb-3e0c-49cf-8f92-8d9a2fe84fad",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"John\n"
]
}
],
"source": [
"from collections import namedtuple\n",
"\n",
"Student = namedtuple('Student', 'fname, lname, age') #class yapısına benzer bir kullanım. indeks ezberlemeye son!\n",
"s1 = Student('John', 'Clarke', '13')\n",
"print(s1.fname)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "by8Up3HxNP1s"
},
"source": [
"## itertools"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XjRcEeAlNP1s"
},
"source": [
"### Permütasyon"
]
},
{
"cell_type": "code",
"execution_count": 200,
"metadata": {
"id": "NCwAzv4bNP1t",
"outputId": "728eec2b-54e6-4dc2-d4bf-8df05907000e",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[('A', 'B', 'C'), ('A', 'C', 'B'), ('B', 'A', 'C'), ('B', 'C', 'A'), ('C', 'A', 'B'), ('C', 'B', 'A')]\n",
"[('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]\n"
]
}
],
"source": [
"from itertools import permutations #sadece tekrarsızlar yapılabiliyor. n!/(n-r)!\n",
"liste=[\"A\",\"B\",\"C\"]\n",
"per1=list(permutations(liste))\n",
"per2=list(permutations(liste,2))\n",
"print(per1)\n",
"print(per2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oYYgBnk7NP1t"
},
"source": [
"### Kombinasyon"
]
},
{
"cell_type": "code",
"execution_count": 201,
"metadata": {
"id": "jpiwGFjSNP1t",
"outputId": "105dd14f-1704-4385-f7a9-6b2482333805",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[('A', 'B'), ('A', 'C'), ('B', 'C')]"
]
},
"metadata": {},
"execution_count": 201
}
],
"source": [
"from itertools import combinations #n!/(r!*(n-r)!)\n",
"com=list(combinations(liste,2))\n",
"com"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oySaIniiNP1t"
},
"source": [
"### Kartezyen çarpım"
]
},
{
"cell_type": "code",
"execution_count": 202,
"metadata": {
"id": "imyEWmAzNP1t",
"outputId": "fa1d5c39-5245-4174-a288-040494180a60",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[('A', 2000),\n",
" ('A', 2001),\n",
" ('A', 2002),\n",
" ('A', 2003),\n",
" ('B', 2000),\n",
" ('B', 2001),\n",
" ('B', 2002),\n",
" ('B', 2003),\n",
" ('C', 2000),\n",
" ('C', 2001),\n",
" ('C', 2002),\n",
" ('C', 2003)]"
]
},
"metadata": {},
"execution_count": 202
}
],
"source": [
"from itertools import product\n",
"list1=[\"A\",\"B\",\"C\"]\n",
"list2=[2000,2001,2002,2003]\n",
"krt=list(product(list1,list2))\n",
"krt"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8c-v2GPbNP1u"
},
"source": [
"## Regex (Düzenli ifadeler)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "T7ffL3MvNP1u"
},
"source": [
"Pythona özgü değildir, hemen her dilde implementasyonu vardır. Başlı başına büyük bi konudur. Burada özet vermeye çalışıcam. İleride Text mining, NLP v.s çalışacaksanız iyi öğrenmenizde fayda var"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "yYTdlQvRNP1u"
},
"source": [
"### Isınma"
]
},
{
"cell_type": "code",
"execution_count": 203,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T14:55:50.942122Z",
"start_time": "2020-11-22T14:55:50.939128Z"
},
"id": "LstCA0g5NP1u"
},
"outputs": [],
"source": [
"import re"
]
},
{
"cell_type": "code",
"execution_count": 204,
"metadata": {
"id": "cp0dScCoNP1u"
},
"outputs": [],
"source": [
"a=\"benim adım volkan\""
]
},
{
"cell_type": "code",
"execution_count": 205,
"metadata": {
"id": "bc2oiGJMNP1u"
},
"outputs": [],
"source": [
"#match: başında var mı diye kontrol eder\n",
"re.match(\"volkan\",a) #eşleşme yok, sonuç dönmez"
]
},
{
"cell_type": "code",
"execution_count": 206,
"metadata": {
"id": "A2r-VT66NP1v",
"outputId": "3e901d97-7e7e-481d-b3bb-fcf0084d58ac",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 206
}
],
"source": [
"re.match(\"ben\",a) #var"
]
},
{
"cell_type": "code",
"execution_count": 207,
"metadata": {
"id": "vGUREnelNP1v",
"outputId": "c09044fe-487a-403d-b212-e1ebabf6fb01",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {},
"execution_count": 207
}
],
"source": [
"a.startswith(\"ben\") #bu daha kullanışlıdır."
]
},
{
"cell_type": "code",
"execution_count": 208,
"metadata": {
"id": "_43rk05kNP1v",
"outputId": "91555923-4984-46f5-de5c-a83218bde2e9",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 208
}
],
"source": [
"#search, herhangi bi yerde var mı, matche göre daha yavaş çalışır\n",
"re.search(\"volkan\",a)"
]
},
{
"cell_type": "code",
"execution_count": 209,
"metadata": {
"id": "eINL0Yl7NP1v",
"outputId": "aefcdf3c-561f-43e3-9e87-c3df2d851fb3",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {},
"execution_count": 209
}
],
"source": [
"\"volkan\" in a #bu daha pratik"
]
},
{
"cell_type": "code",
"execution_count": 210,
"metadata": {
"id": "hHIC0gVqNP1v",
"outputId": "b85a86b4-f2bb-4088-cf10-fd8f2d4b52b8",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['sen', 'sen', 'sen', 'sen']\n",
"4\n",
"4\n"
]
}
],
"source": [
"b=\"sen seni bil sen seni\"\n",
"bul=re.findall(\"sen\", b)\n",
"\n",
"print(bul)\n",
"print(len(bul))\n",
"print(b.count(\"sen\"))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hiAVtFvyNP1w"
},
"source": [
"### Metakarakter kullanımı"
]
},
{
"cell_type": "code",
"execution_count": 211,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T14:56:00.364786Z",
"start_time": "2020-11-22T14:56:00.361819Z"
},
"id": "YIAHevecNP1w"
},
"outputs": [],
"source": [
"isimler=[\"123a\",\"ali\",\"veli\",\"hakan\",\"volkan\",\"osman\",\"kandemir\",\"VOLkan\"]"
]
},
{
"cell_type": "code",
"execution_count": 212,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T14:56:03.790850Z",
"start_time": "2020-11-22T14:56:03.785864Z"
},
"id": "5IurCv6oNP1w",
"outputId": "bf8c26f5-ccfc-47e0-dae7-805166919943",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['hakan', 'volkan', 'VOLkan']"
]
},
"metadata": {},
"execution_count": 212
}
],
"source": [
"#kan ile bitenler, regex olmadan\n",
"kan=[x for x in isimler if x[-3:]==\"kan\"]\n",
"kan"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "wPMAW5iXNP1w"
},
"source": [
"![resim.png](data:image/png;base64,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)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BkbwbRCTNP1w"
},
"source": [
"#### [ ] Köşeli parantez"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fw-efq3_NP1x"
},
"source": [
"[] işareti, \"içine giren karakterleri içeren\" filtresi uygular. Burada önemli olan [] içinde gördügümüz tüm karaktereleri tek tek uyguluyor olmasıdır. Ör: [abc]: a veya b veya c içeren demek. [a-z]: A ile Z arasındakiler demek"
]
},
{
"cell_type": "code",
"execution_count": 213,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T14:56:09.039799Z",
"start_time": "2020-11-22T14:56:09.035811Z"
},
"id": "ov68JgukNP1x",
"outputId": "7dee106c-f324-4279-ae9b-4e0437b0824f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"hakan\n",
"volkan\n"
]
}
],
"source": [
"#regex ile\n",
"for i in isimler:\n",
" if re.search(\"[a-z]kan\",i):\n",
" print(i)\n",
"#başta veya ortada bir yerde a-z arasında bir karekter olsun, sonu kan olsun demiş olduk. yani \"kan\"ın önünde bir harf\n",
"#olsun da nerede olursa olsun, bşta mı ortada mı önemli değil, önemli olan kan'ın öncesinde olmaslı"
]
},
{
"cell_type": "code",
"execution_count": 214,
"metadata": {
"id": "Fsvv35iGNP1y",
"outputId": "384c7687-3e20-4112-ea72-3f63886637d1",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['veli', 'osman', 'kandemir']"
]
},
"metadata": {},
"execution_count": 214
}
],
"source": [
"#içinde e veya m geçenler, bu sefer list comprehension ile yapalım\n",
"[i for i in isimler if re.search(\"[em]\",i)]"
]
},
{
"cell_type": "code",
"execution_count": 215,
"metadata": {
"id": "WCYR4kscNP1y",
"outputId": "02899ce3-f02f-4869-dfe1-c67cc809ef0b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['123a', 'b123', '1234']"
]
},
"metadata": {},
"execution_count": 215
}
],
"source": [
"#rakam içerenler\n",
"liste = [\"123a\",\"b123\",\"1234\",\"volkan\"]\n",
"sayıiçerenler=[x for x in liste if re.search(\"[0-9]\",x)]\n",
"sayıiçerenler"
]
},
{
"cell_type": "code",
"execution_count": 216,
"metadata": {
"id": "SnmWLT3YNP1y",
"outputId": "111b849b-581f-4867-f9a0-e00aae075f6d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['123a', '1234']"
]
},
"metadata": {},
"execution_count": 216
}
],
"source": [
"#rakam ile başlayanları bulma\n",
"rakamlabaşlayanlar=[x for x in liste if re.match(\"[0-9]\",x)] #yukardakinden farklı olarak match kullandık, daha hızlı çalışır\n",
"rakamlabaşlayanlar"
]
},
{
"cell_type": "code",
"execution_count": 217,
"metadata": {
"id": "GcqMsXEENP1y",
"outputId": "aba87780-4f1b-47be-8dc8-c20fe2c4ed94",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"['ABC', 'Abc', 'abc', '12a', 'A12', 'Ab1', 'Ab23']\n",
"['Abc', 'Ab1', 'Ab23']\n",
"['ABC', 'Abc', 'abc', '12a', 'A12', '123', 'Ab1', 'Ab23']\n",
"['Ab1', 'Ab23']\n"
]
}
],
"source": [
"liste=[\"ABC\",\"Abc\",\"abc\",\"12a\",\"A12\",\"123\",\"Ab1\",\"Ab23\"]\n",
"print([x for x in liste if re.search(\"[A-Za-z]\",x)]) #büyük veya küçük harf içerenler\n",
"print([x for x in liste if re.search(\"[A-Z][a-z]\",x)]) #ilki büyük ikincisi küçük harf içerenler\n",
"print([x for x in liste if re.search(\"[A-Za-z0-9]\",x)]) #büyük veya küçük harf veya sayı içerenler\n",
"print([x for x in liste if re.search(\"[A-Z][a-z][0-9]\",x)]) #ilki büyük ikincisi küçük üçüncüsü sayı olanlar"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9giRPBb3NP1y"
},
"source": [
"#### . Nokta"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Bo5mfg5cNP1y"
},
"source": [
"\".\" tek karekteri için joker anlamındadır"
]
},
{
"cell_type": "code",
"execution_count": 218,
"metadata": {
"id": "ZsSkaV5qNP1z"
},
"outputs": [],
"source": [
"isimler=[\"arhan\",\"volkan\",\"osman\",\"hakan\",\"demirhan\",\"1ozan\"]"
]
},
{
"cell_type": "code",
"execution_count": 219,
"metadata": {
"id": "ApljdIy-NP1z",
"outputId": "9f03dac5-a52a-4cb2-9197-d070c67cffa3",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['arhan', 'osman', 'hakan']"
]
},
"metadata": {},
"execution_count": 219
}
],
"source": [
"#5 karekterli olup an ile biten gerçek isimler(gerçek isim: sayı ile başlayan birşey isim olamaz)\n",
"liste=[x for x in isimler if re.match(\"[a-z]..an\",x)]\n",
"liste"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lfCcup0ANP1z"
},
"source": [
"#### * Yıldız"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Yb-V7AdfNP1z"
},
"source": [
"Kendinden önce gelen 1 ifadeyi en az 0(evet 0, 1 değil) sayıda eşleştirir. Özellikle bir ifadenin yazılamayabildiği durumları da kapsamak için kullanılır. Aşağıdkai örnek gayet açıklayıcıdır."
]
},
{
"cell_type": "code",
"execution_count": 220,
"metadata": {
"id": "nw9onGxYNP1z",
"outputId": "6e1b138e-f400-4caa-8b2b-30adc79e354a",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['kıral', 'kral', 'kıro', 'kro', 'kritik', 'kıritik', 'kııral']"
]
},
"metadata": {},
"execution_count": 220
}
],
"source": [
"liste = [\"kıral\", \"kral\", \"kıro\", \"kro\", \"kırmızı\",\"kırçıllı\",\"kritik\",\"kıritik\",\"kııral\"]\n",
"[x for x in liste if re.match(\"kı*r[aeıioöuü]\",x)]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "wEXQD-HtNP10"
},
"source": [
"Bu örnekte, yabancı dilden geçen kelimelerden \"kr\" ile başlayanları inceledik. Bunlar bazen aralarına ı harfi girilerek yazılabiliyor. Bu kelimelerde genelde r'den sonra sesli bi harf gelir. Biz de bunları yakalamaya çalıştık."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "LC-ketd1NP10"
},
"source": [
"#### + Artı"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WU2zW6m5NP10"
},
"source": [
"Yıldıza benzer, ancak bu sefer en az 1 sayıda eşleşme yapar."
]
},
{
"cell_type": "code",
"execution_count": 221,
"metadata": {
"id": "YHDg_aX3NP11",
"outputId": "13cd2b57-c1eb-456e-cdd8-75010ab5629e",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['kıral', 'kıro', 'kıritik', 'kııral']"
]
},
"metadata": {},
"execution_count": 221
}
],
"source": [
"liste = [\"kıral\", \"kral\", \"kıro\", \"kro\", \"kırmızı\",\"kırçıllı\",\"kritik\",\"kıritik\",\"kııral\"]\n",
"[x for x in liste if re.match(\"kı+r[aeıioöuü]\",x)]"
]
},
{
"cell_type": "code",
"execution_count": 222,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T14:57:05.136600Z",
"start_time": "2020-11-22T14:57:05.132611Z"
},
"id": "KObxbEcsNP11",
"outputId": "4ef84528-d5fe-4f7c-ad91-6697ca046e15",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"volkan\n",
"hakan\n"
]
}
],
"source": [
"#yukardaki kan'la biten isimler örneğin. bu sefer VOLkan yazdırılır\n",
"for i in isimler:\n",
" if re.search(\".+kan\",i):\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "rV6ooe6aNP11"
},
"source": [
"#### ? Soru işareti"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ekAtIxZnNP11"
},
"source": [
"Kendinden önce gelen karakterin 0 veya 1 kez geçtiği durumları eşleştirir."
]
},
{
"cell_type": "code",
"execution_count": 223,
"metadata": {
"id": "yu6V0LzTNP11",
"outputId": "aca00f6a-c436-42a9-e8b7-097197983682",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['kıral', 'kral', 'kıro', 'kro', 'kritik', 'kıritik']"
]
},
"metadata": {},
"execution_count": 223
}
],
"source": [
"liste = [\"kıral\", \"kral\", \"kıro\", \"kro\", \"kırmızı\",\"kırçıllı\",\"kritik\",\"kıritik\",\"kııral\"]\n",
"[x for x in liste if re.match(\"kı?r[aeıioöuü]\",x)]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "E4bdPfQoNP12"
},
"source": [
"#### {} süslü parantez"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "gf5Uj6JPNP12"
},
"source": [
"bir karekterin n adet geçtiği durumlar eşleştirilir."
]
},
{
"cell_type": "code",
"execution_count": 224,
"metadata": {
"id": "ujabWlTENP12",
"outputId": "7521267c-e0b1-49f2-ad64-353a46a5b2a9",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['kııral']"
]
},
"metadata": {},
"execution_count": 224
}
],
"source": [
"liste = [\"kıral\", \"kral\", \"kıro\", \"kro\", \"kırmızı\",\"kırçıllı\",\"kritik\",\"kıritik\",\"kııral\"]\n",
"[x for x in liste if re.match(\"kı{2}r[aeıioöuü]\",x)]"
]
},
{
"cell_type": "code",
"execution_count": 225,
"metadata": {
"id": "DXKgN-erNP12",
"outputId": "cda37a34-912f-408e-d0f9-23b61883985c",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['kııral']"
]
},
"metadata": {},
"execution_count": 225
}
],
"source": [
"#böyle de yapılabilirdi ama n sayısı yükseldikçe {} ile yapmak daha mantıklı\n",
"[x for x in liste if re.match(\"kıır[aeıioöuü]\",x)]"
]
},
{
"cell_type": "code",
"execution_count": 226,
"metadata": {
"id": "lJ2-PlDENP12",
"outputId": "5327b5f8-4a10-4055-d192-1af27c6ad563",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['gool', 'gooool']"
]
},
"metadata": {},
"execution_count": 226
}
],
"source": [
"#{min,max}\n",
"liste=[\"gol\",\"gool\",\"gooool\",\"gööl\",\"gooooooool\"]\n",
"[x for x in liste if re.match(\"[a-z]o{2,5}l\",x)] #en az 2 en çok 5 oo içersin"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KNreV4PoNP12"
},
"source": [
"##### Çeşitli linkler"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MGQ1_VJ_NP12"
},
"source": [
"Regex dünyası çok büyük bi dünya, burada hepsini anlatmak yerine kısa bir girizgah yapmış olduk. Öncelikle genel oalrak regexi kavramanız sonrasında da python implementasonunu kavramanız gerekiyor. Aşağıdaki linkleri incelemenizi tavisye ederim.\n",
"\n",
"**Genel bilgi**\n",
"- https://en.wikipedia.org/wiki/Regular_expression\n",
"- https://regexr.com/ (pratik amaçlı)\n",
"\n",
"**Python**\n",
"- https://docs.python.org/3/howto/regex.html\n",
"- https://docs.python.org/3/library/re.html"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "GwqZZyGrNP12"
},
"source": [
"## json"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MH6E3UfyNP13"
},
"source": [
"### jsondan pythona"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ZN4qHLaRNP13"
},
"source": [
"json yapısı python dictionary'lerine çok benzer. elde edeceğimiz nesne de bir dictionary olacaktır"
]
},
{
"cell_type": "code",
"execution_count": 227,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:50:09.106861Z",
"start_time": "2021-04-11T10:50:09.100878Z"
},
"id": "oJVvrFqFNP13"
},
"outputs": [],
"source": [
"import json"
]
},
{
"cell_type": "code",
"execution_count": 228,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:50:09.603020Z",
"start_time": "2021-04-11T10:50:09.595037Z"
},
"id": "wP1nOj35NP13",
"outputId": "5edbf058-7746-4e12-fe4a-33643d07acf3",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 71
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"str"
]
},
"metadata": {},
"execution_count": 228
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"dict"
]
},
"metadata": {},
"execution_count": 228
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'John'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 228
}
],
"source": [
"#örnek bir json stringden\n",
"x = '{ \"name\":\"John\", \"age\":30, \"city\":\"New York\"}'\n",
"y=json.loads(x) #dcitionary olarak yükler\n",
"type(x)\n",
"type(y)\n",
"y[\"name\"]"
]
},
{
"cell_type": "code",
"execution_count": 231,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:51:12.111273Z",
"start_time": "2021-04-11T10:51:12.102295Z"
},
"id": "9TkJmx4gNP13",
"outputId": "26a2d4ba-7607-418e-b62d-8f903cec694c",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"dict"
]
},
"metadata": {},
"execution_count": 231
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'Bolge': {'0': 'Akdeniz', '1': 'Marmara', '2': 'Akdeniz', '3': 'Marmara'},\n",
" 'Yil': {'0': 2020, '1': 2020, '2': 2021, '3': 2021},\n",
" 'Satis': {'0': 10, '1': 15, '2': 42, '3': 56}}"
]
},
"metadata": {},
"execution_count": 231
}
],
"source": [
"#veya json dosyadan. ama bu indenti dikkate almıyor, çünkü elde edilen nesne bi string değil, dictionary\n",
"import io\n",
"with io.open(\"/content/drive/MyDrive/Programming/PythonRocks/dataset/json/indentli_bolgesatis.json\", 'r') as f:\n",
" data = json.load(f)\n",
"type(data)\n",
"data"
]
},
{
"cell_type": "code",
"execution_count": 232,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:52:53.530875Z",
"start_time": "2021-04-11T10:52:53.525888Z"
},
"scrolled": true,
"id": "hRNmBbs7NP13",
"outputId": "114afbfe-5d59-4643-ba51-3020d03313f5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\n",
" \"Bolge\":{\n",
" \"0\":\"Akdeniz\",\n",
" \"1\":\"Marmara\",\n",
" \"2\":\"Akdeniz\",\n",
" \"3\":\"Marmara\"\n",
" },\n",
" \"Yil\":{\n",
" \"0\":2020,\n",
" \"1\":2020,\n",
" \"2\":2021,\n",
" \"3\":2021\n",
" },\n",
" \"Satis\":{\n",
" \"0\":10,\n",
" \"1\":15,\n",
" \"2\":42,\n",
" \"3\":56\n",
" }\n",
"}\n"
]
}
],
"source": [
"#indentli formatı yazdırmak istersek dosya okuması yaparak bi string içine okuruz\n",
"with io.open(\"/content/drive/MyDrive/Programming/PythonRocks/dataset/json/indentli_bolgesatis.json\", mode='r') as f:\n",
" content=f.read() # bu stringdir, ve indentli yapı korunmuştur\n",
"print(content)"
]
},
{
"cell_type": "code",
"execution_count": 233,
"metadata": {
"scrolled": true,
"id": "1KVAmiwdNP14",
"outputId": "4b240885-5cbc-4d9a-d41c-91efb1b36097",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\n",
" \"columns\":[\n",
" \"Bolge\",\n",
" \"Yil\",\n",
" \"Satis\"\n",
" ],\n",
" \"data\":[\n",
" [\n",
" \"Akdeniz\",\n",
" 2020,\n",
" 10\n",
" ],\n",
" [\n",
" \"Marmara\",\n",
" 2020,\n",
" 15\n",
" ],\n",
" [\n",
" \"Akdeniz\",\n",
" 2021,\n",
" 42\n",
" ],\n",
" [\n",
" \"Marmara\",\n",
" 2021,\n",
" 56\n",
" ]\n",
" ]\n",
"}\n"
]
}
],
"source": [
"#split oriented kaydedilmiş dosyadan\n",
"with io.open(\"/content/drive/MyDrive/Programming/PythonRocks/dataset/json/indentli_bolgesatis_split.json\", mode='r') as f:\n",
" content=f.read()\n",
"print(content)"
]
},
{
"cell_type": "code",
"execution_count": 234,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:54:03.948942Z",
"start_time": "2021-04-11T10:54:03.598989Z"
},
"scrolled": true,
"id": "5G-iiEBINP14",
"outputId": "17d65dbf-4a64-417c-f105-e290fedf1853",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\n",
" \"schema\":{\n",
" \"fields\":[\n",
" {\n",
" \"name\":\"Bolge\",\n",
" \"type\":\"string\"\n",
" },\n",
" {\n",
" \"name\":\"Yil\",\n",
" \"type\":\"integer\"\n",
" },\n",
" {\n",
" \"name\":\"Satis\",\n",
" \"type\":\"integer\"\n",
" }\n",
" ],\n",
" \"pandas_version\":\"0.20.0\"\n",
" },\n",
" \"data\":[\n",
" {\n",
" \"Bolge\":\"Akdeniz\",\n",
" \"Yil\":2020,\n",
" \"Satis\":10\n",
" },\n",
" {\n",
" \"Bolge\":\"Marmara\",\n",
" \"Yil\":2020,\n",
" \"Satis\":15\n",
" },\n",
" {\n",
" \"Bolge\":\"Akdeniz\",\n",
" \"Yil\":2021,\n",
" \"Satis\":42\n",
" },\n",
" {\n",
" \"Bolge\":\"Marmara\",\n",
" \"Yil\":2021,\n",
" \"Satis\":56\n",
" }\n",
" ]\n",
"}\n"
]
}
],
"source": [
"#table oriented kaydedilmiş dosyadan\n",
"with io.open(\"/content/drive/MyDrive/Programming/PythonRocks/dataset/json/indentli_bolgesatis_table.json\", mode='r') as f:\n",
" content=f.read()\n",
"print(content)"
]
},
{
"cell_type": "code",
"execution_count": 235,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:54:05.350155Z",
"start_time": "2021-04-11T10:54:05.343174Z"
},
"id": "Q_41Obj_NP14",
"outputId": "3c9d6fb0-5467-4f71-951c-71aec5aa7a26",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"dict"
]
},
"metadata": {},
"execution_count": 235
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'schema': {'fields': [{'name': 'Bolge', 'type': 'string'},\n",
" {'name': 'Yil', 'type': 'integer'},\n",
" {'name': 'Satis', 'type': 'integer'}],\n",
" 'pandas_version': '0.20.0'},\n",
" 'data': [{'Bolge': 'Akdeniz', 'Yil': 2020, 'Satis': 10},\n",
" {'Bolge': 'Marmara', 'Yil': 2020, 'Satis': 15},\n",
" {'Bolge': 'Akdeniz', 'Yil': 2021, 'Satis': 42},\n",
" {'Bolge': 'Marmara', 'Yil': 2021, 'Satis': 56}]}"
]
},
"metadata": {},
"execution_count": 235
}
],
"source": [
"c=json.loads(content)\n",
"type(c)\n",
"c"
]
},
{
"cell_type": "code",
"execution_count": 236,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:54:13.377699Z",
"start_time": "2021-04-11T10:54:13.369758Z"
},
"id": "k2jY8dmbNP14",
"outputId": "5cc913d8-e0b6-400f-99c4-4a5de5ac1f09",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'Akdeniz'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 236
}
],
"source": [
"#içteki tek bir bilgiye ulaşma\n",
"c[\"data\"][0][\"Bolge\"] #dict of list of dict"
]
},
{
"cell_type": "code",
"execution_count": 237,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T10:54:14.362891Z",
"start_time": "2021-04-11T10:54:14.358940Z"
},
"id": "9THsxWPVNP15",
"outputId": "d7b24dfc-50a4-4fda-945e-9d2cfd4525ca",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Akdeniz\n",
"Marmara\n",
"Akdeniz\n",
"Marmara\n"
]
}
],
"source": [
"#tüm bölgeleri alma\n",
"for l in c[\"data\"]:\n",
" print(l[\"Bolge\"])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ycJ0g1LtNP15"
},
"source": [
"### pythondan jsona"
]
},
{
"cell_type": "code",
"execution_count": 238,
"metadata": {
"id": "6XY4uNXINP15",
"outputId": "67beeaef-c239-480b-9da9-7efb469075be",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 71
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"dict"
]
},
"metadata": {},
"execution_count": 238
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"str"
]
},
"metadata": {},
"execution_count": 238
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 238
}
],
"source": [
"x = {\n",
" \"name\": \"John\",\n",
" \"age\": 30,\n",
" \"city\": \"New York\"\n",
"}\n",
"\n",
"j = json.dumps(x)\n",
"type(x)\n",
"type(j)\n",
"j"
]
},
{
"cell_type": "code",
"execution_count": 239,
"metadata": {
"id": "ZtP7EQwpNP16",
"outputId": "79ad0169-ff34-4ebb-dde9-e20dd2fb54be",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\"name\": \"John\", \"age\": 30, \"married\": true, \"divorced\": false, \"children\": [\"Ann\", \"Billy\"], \"pets\": null, \"cars\": [{\"model\": \"BMW 230\", \"mpg\": 27.5}, {\"model\": \"Ford Edge\", \"mpg\": 24.1}]}\n"
]
}
],
"source": [
"#komplike(nested) json\n",
"x = {\n",
" \"name\": \"John\",\n",
" \"age\": 30,\n",
" \"married\": True,\n",
" \"divorced\": False,\n",
" \"children\": (\"Ann\",\"Billy\"),\n",
" \"pets\": None,\n",
" \"cars\": [\n",
" {\"model\": \"BMW 230\", \"mpg\": 27.5},\n",
" {\"model\": \"Ford Edge\", \"mpg\": 24.1}\n",
" ]\n",
"}\n",
"\n",
"print(json.dumps(x))"
]
},
{
"cell_type": "code",
"execution_count": 240,
"metadata": {
"id": "Z9HyTevzNP16",
"outputId": "349dbdf7-2774-4bce-eda3-3ed06f8e6525",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\n",
" \"name\": \"John\",\n",
" \"age\": 30,\n",
" \"married\": true,\n",
" \"divorced\": false,\n",
" \"children\": [\n",
" \"Ann\",\n",
" \"Billy\"\n",
" ],\n",
" \"pets\": null,\n",
" \"cars\": [\n",
" {\n",
" \"model\": \"BMW 230\",\n",
" \"mpg\": 27.5\n",
" },\n",
" {\n",
" \"model\": \"Ford Edge\",\n",
" \"mpg\": 24.1\n",
" }\n",
" ]\n",
"}\n"
]
}
],
"source": [
"#bu da şık hali\n",
"print(json.dumps(x,indent=4))"
]
},
{
"cell_type": "code",
"execution_count": 241,
"metadata": {
"id": "KdCqAtjUNP16",
"outputId": "33cb15d7-09c7-4631-ee98-87696ab386b5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\n",
" \"age\": 30,\n",
" \"cars\": [\n",
" {\n",
" \"model\": \"BMW 230\",\n",
" \"mpg\": 27.5\n",
" },\n",
" {\n",
" \"model\": \"Ford Edge\",\n",
" \"mpg\": 24.1\n",
" }\n",
" ],\n",
" \"children\": [\n",
" \"Ann\",\n",
" \"Billy\"\n",
" ],\n",
" \"divorced\": false,\n",
" \"married\": true,\n",
" \"name\": \"John\",\n",
" \"pets\": null\n",
"}\n"
]
}
],
"source": [
"print(json.dumps(x,indent=4,sort_keys=True))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "t0GIaoxuNP16"
},
"source": [
"Bunları aşağıdaki I/O işlemleriyle bir dosyaya da yazdırabilirsiniz."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "W_Azx01eNP16"
},
"source": [
"## Request"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "c9pQ-nD9NP17"
},
"source": [
"https://realpython.com/python-requests/ sitesinden faydalandım"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "sLIO_t5oNP17"
},
"source": [
"### Basics"
]
},
{
"cell_type": "code",
"execution_count": 242,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:34:22.862704Z",
"start_time": "2021-05-15T15:34:22.641341Z"
},
"id": "p9pEubABNP17"
},
"outputs": [],
"source": [
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 243,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:34:24.362239Z",
"start_time": "2021-05-15T15:34:24.358213Z"
},
"id": "kFF-hydsNP17"
},
"outputs": [],
"source": [
"httpget0=r\"https://www.excelinefendisi.com/httpapiservice/ResponseveRequestTarget.aspx\" #buna parametre verebiliyoruz, Anakonu=VBAMakro, Altkonu=Temeller\n",
"httpget0j=r\"https://www.excelinefendisi.com/httpapiservice/ReturnJson.aspx\" #tüm duyurlar as json\n",
"httpget3=r\"https://httpbin.org/get\" #as json\n",
"httpget4img=r\"https://httpbin.org/image\"\n",
"httpget5=r\"https://www.google.com/search?q=excel&oq=excel&aqs=chrome..69i57j35i39l2j0i433l4j46i433l2j0.839j0j15&sourceid=chrome&ie=UTF-8\"\n",
"httpget6githubjson=r\"https://raw.githubusercontent.com/VolkiTheDreamer/dataset/master/json/bolgesatis.json\"\n",
"\n",
"httppost3=r\"https://httpbin.org/post\""
]
},
{
"cell_type": "code",
"execution_count": 244,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:34:29.194045Z",
"start_time": "2021-05-15T15:34:28.511013Z"
},
"id": "suK8G-UYNP17"
},
"outputs": [],
"source": [
"r=requests.get(httpget3)"
]
},
{
"cell_type": "code",
"execution_count": 245,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:34:32.053841Z",
"start_time": "2021-05-15T15:34:32.048854Z"
},
"id": "NFHER8uYNP17",
"outputId": "3f1885af-8b11-4b33-ed6e-d151b5974f01",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'Date': 'Sun, 22 Sep 2024 15:26:54 GMT', 'Content-Type': 'application/json', 'Content-Length': '307', 'Connection': 'keep-alive', 'Server': 'gunicorn/19.9.0', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true'}"
]
},
"metadata": {},
"execution_count": 245
}
],
"source": [
"r.headers"
]
},
{
"cell_type": "code",
"execution_count": 246,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:34:36.018195Z",
"start_time": "2021-05-15T15:34:34.687476Z"
},
"id": "vMb7XEH2NP18",
"outputId": "bdcb0f0a-276e-4f2f-f171-d6b08c5933e3",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 246
}
],
"source": [
"requests.get('http://volkanyurtseven.com')"
]
},
{
"cell_type": "code",
"execution_count": 247,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:18:33.490545Z",
"start_time": "2021-04-12T11:18:32.595460Z"
},
"id": "mSrSW1NGNP18",
"outputId": "3d5d55ab-4d91-4742-bdfd-f98dda647142",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"site çalışmıyor\n"
]
}
],
"source": [
"try:\n",
" requests.get('https://volkanyurtseven.com') #https versiyonu yok, hata alcaz\n",
" print(\"site çalışıyor\")\n",
"except:\n",
" print(\"site çalışmıyor\")"
]
},
{
"cell_type": "code",
"execution_count": 248,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:18:46.903444Z",
"start_time": "2021-04-12T11:18:46.773750Z"
},
"id": "t1BPrEGDNP18",
"outputId": "e1bde44f-db1b-42a1-dfe9-2aa3ad1ce70b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 248
}
],
"source": [
"requests.get('http://volkanyurtseven.com/olmayansayfa') #bu sefer site doğru ama bahsekonu sayfa yoksa 404"
]
},
{
"cell_type": "code",
"execution_count": 249,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:18:52.376056Z",
"start_time": "2021-04-12T11:18:52.246402Z"
},
"id": "9gXqkxYYNP18",
"outputId": "4cf9fce1-905a-4810-d32f-b5059d3e11e7",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"200"
]
},
"metadata": {},
"execution_count": 249
}
],
"source": [
"response = requests.get('http://volkanyurtseven.com')\n",
"response.status_code"
]
},
{
"cell_type": "code",
"execution_count": 250,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:50:00.510411Z",
"start_time": "2021-04-12T11:50:00.239067Z"
},
"scrolled": true,
"id": "qVhplpG1NP19",
"outputId": "595db2ba-8acb-4079-d6ee-cc1e8d78d275",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"b'{\\n \"args\": {}, \\n \"headers\": {\\n \"Accept\": \"*/*\", \\n \"Accept-Encoding\": \"gzip, deflate\", \\n \"Host\": \"httpbin.org\", \\n \"User-Agent\": \"python-requests/2.32.3\", \\n \"X-Amzn-Trace-Id\": \"Root=1-66f03742-6923173002866a3c50f6dfc5\"\\n }, \\n \"origin\": \"34.16.168.234\", \\n \"url\": \"https://httpbin.org/get\"\\n}\\n'"
]
},
"metadata": {},
"execution_count": 250
}
],
"source": [
"response = requests.get(httpget3)\n",
"response.content #byte olarak"
]
},
{
"cell_type": "code",
"execution_count": 251,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:50:02.611257Z",
"start_time": "2021-04-12T11:50:02.604275Z"
},
"id": "CC-Ru5WBNP19",
"outputId": "45bf2b51-72e2-40b7-b3f8-6c69ce234f2e",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'{\\n \"args\": {}, \\n \"headers\": {\\n \"Accept\": \"*/*\", \\n \"Accept-Encoding\": \"gzip, deflate\", \\n \"Host\": \"httpbin.org\", \\n \"User-Agent\": \"python-requests/2.32.3\", \\n \"X-Amzn-Trace-Id\": \"Root=1-66f03742-6923173002866a3c50f6dfc5\"\\n }, \\n \"origin\": \"34.16.168.234\", \\n \"url\": \"https://httpbin.org/get\"\\n}\\n'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 251
}
],
"source": [
"response.text #string olarak"
]
},
{
"cell_type": "code",
"execution_count": 252,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:50:07.692493Z",
"start_time": "2021-04-12T11:50:07.689491Z"
},
"id": "dQuY_FaMNP19",
"outputId": "69ef30ae-edcb-41db-9ed1-876230c534b1",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 252
}
],
"source": [
"response.raw"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "aT_D0icCNP19"
},
"source": [
"Böyle çok karışık oldu, bunu json olarak okuyalım. ama tabi önce bunun son versiyonuna tekrar bi get atalım."
]
},
{
"cell_type": "code",
"execution_count": 253,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:50:45.445755Z",
"start_time": "2021-04-12T11:50:45.165506Z"
},
"id": "w_4RI0kZNP1-",
"outputId": "805a936b-4645-4d61-ae0c-ead5c614035a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'{\\n \"args\": {}, \\n \"headers\": {\\n \"Accept\": \"*/*\", \\n \"Accept-Encoding\": \"gzip, deflate\", \\n \"Host\": \"httpbin.org\", \\n \"User-Agent\": \"python-requests/2.32.3\", \\n \"X-Amzn-Trace-Id\": \"Root=1-66f03743-514f57731ffeb7ce34129485\"\\n }, \\n \"origin\": \"34.16.168.234\", \\n \"url\": \"https://httpbin.org/get\"\\n}\\n'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 253
}
],
"source": [
"#hala biraz okunaklı değil gibi\n",
"response = requests.get(httpget3)\n",
"response.text"
]
},
{
"cell_type": "code",
"execution_count": 254,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:50:31.769676Z",
"start_time": "2021-04-12T11:50:31.761693Z"
},
"id": "WQ895eaFNP1-",
"outputId": "0ae60c50-7a8e-4edd-f5c1-0c25a66aea06",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'args': {},\n",
" 'headers': {'Accept': '*/*',\n",
" 'Accept-Encoding': 'gzip, deflate',\n",
" 'Host': 'httpbin.org',\n",
" 'User-Agent': 'python-requests/2.32.3',\n",
" 'X-Amzn-Trace-Id': 'Root=1-66f03743-514f57731ffeb7ce34129485'},\n",
" 'origin': '34.16.168.234',\n",
" 'url': 'https://httpbin.org/get'}"
]
},
"metadata": {},
"execution_count": 254
}
],
"source": [
"json.loads(response.text)"
]
},
{
"cell_type": "code",
"execution_count": 255,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:49:39.489580Z",
"start_time": "2021-04-12T11:49:39.480603Z"
},
"id": "K_c3PGEENP1-",
"outputId": "0bf71ddb-0530-401e-86d2-0d70fa5ead3f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'args': {},\n",
" 'headers': {'Accept': '*/*',\n",
" 'Accept-Encoding': 'gzip, deflate',\n",
" 'Host': 'httpbin.org',\n",
" 'User-Agent': 'python-requests/2.32.3',\n",
" 'X-Amzn-Trace-Id': 'Root=1-66f03743-514f57731ffeb7ce34129485'},\n",
" 'origin': '34.16.168.234',\n",
" 'url': 'https://httpbin.org/get'}"
]
},
"metadata": {},
"execution_count": 255
}
],
"source": [
"#veya responseun json metopdunu kullanabiliriz\n",
"response.json()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oQpsp8BiNP1-"
},
"source": [
"It should be noted that the success of the call to r.json() does not indicate the success of the response. Some servers may return a JSON object in a failed response (e.g. error details with HTTP 500). Such JSON will be decoded and returned. To check that a request is successful, use r.raise_for_status() or check r.status_code is what you expect."
]
},
{
"cell_type": "code",
"execution_count": 256,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:51:01.521114Z",
"start_time": "2021-04-12T11:51:01.517158Z"
},
"id": "Y-yvVvIFNP1-",
"outputId": "2f259fb0-8286-4ec4-aec1-c225ec78b0bf",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"200"
]
},
"metadata": {},
"execution_count": 256
}
],
"source": [
"response.raise_for_status()\n",
"response.status_code"
]
},
{
"cell_type": "code",
"execution_count": 257,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:51:09.536268Z",
"start_time": "2021-04-12T11:51:09.531280Z"
},
"id": "MRIBCQXlNP1_",
"outputId": "d42a67b4-76b0-44d6-c3b4-e00c1f39f527",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'Date': 'Sun, 22 Sep 2024 15:26:59 GMT',\n",
" 'Content-Type': 'application/json',\n",
" 'Content-Length': '307',\n",
" 'Connection': 'keep-alive',\n",
" 'Server': 'gunicorn/19.9.0',\n",
" 'Access-Control-Allow-Origin': '*',\n",
" 'Access-Control-Allow-Credentials': 'true'}"
]
},
"metadata": {},
"execution_count": 257
}
],
"source": [
"dict(response.headers)"
]
},
{
"cell_type": "code",
"execution_count": 258,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:51:15.329872Z",
"start_time": "2021-04-12T11:51:15.323889Z"
},
"id": "pCFUpP0ONP1_",
"outputId": "90b9edf9-e069-43e3-a532-d0f0f3d8d795",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'application/json'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 258
}
],
"source": [
"response.headers['Content-Type']"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "OZXIKvJiNP1_"
},
"source": [
"### QueryString parameters"
]
},
{
"cell_type": "code",
"execution_count": 259,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:51:35.981224Z",
"start_time": "2021-04-12T11:51:34.739424Z"
},
"id": "A8MuEWfwNP1_",
"outputId": "2b4745f4-53d3-44d2-a5bc-4a45db5a2750",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Repository name: secrules-language-evaluation\n",
"Repository description: Set of Python scripts to perform SecRules language evaluation on a given http request.\n",
"https://api.github.com/search/repositories?q=requests%2Blanguage%3Apython\n"
]
}
],
"source": [
"# Search GitHub's repositories for requests\n",
"response = requests.get(\n",
" 'https://api.github.com/search/repositories',\n",
" params={'q': 'requests+language:python'},\n",
")\n",
"\n",
"# Inspect some attributes of the `requests` repository\n",
"json_response = response.json()\n",
"repository = json_response['items'][0]\n",
"print(f'Repository name: {repository[\"name\"]}') # Python 3.6+\n",
"print(f'Repository description: {repository[\"description\"]}') # Python 3.6+\n",
"print(response.url)"
]
},
{
"cell_type": "code",
"execution_count": 260,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-12T11:51:36.220773Z",
"start_time": "2021-04-12T11:51:35.991157Z"
},
"id": "gji0Xwf1NP1_",
"outputId": "2920a2bd-235f-4cbf-ba34-f42f7a03f573",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"https://www.excelinefendisi.com/httpapiservice/ResponseveRequestTarget.aspx?Anakonu=VBAMakro&Altkonu=Temeller\n"
]
}
],
"source": [
"response = requests.get(\n",
" 'https://www.excelinefendisi.com/httpapiservice/ResponseveRequestTarget.aspx',\n",
" params={'Anakonu':'VBAMakro', 'Altkonu':'Temeller'},\n",
")\n",
"\n",
"print(response.url)"
]
},
{
"cell_type": "code",
"execution_count": 261,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T11:54:43.262529Z",
"start_time": "2021-04-11T11:54:43.257543Z"
},
"id": "5irgpaj_NP2A",
"outputId": "2c6f96ae-621c-4582-82d8-f89887510002",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 125
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n \\r\\n\\r\\n\\r\\n'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 261
}
],
"source": [
"response.text"
]
},
{
"cell_type": "code",
"execution_count": 262,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T11:48:29.128562Z",
"start_time": "2021-04-11T11:48:28.375577Z"
},
"id": "wedIz7JuNP2A"
},
"outputs": [],
"source": [
"payload = {'key1': 'value1', 'key2': 'value2'}\n",
"r = requests.get('https://httpbin.org/get', params=payload)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Zg-_6jfqNP2A"
},
"source": [
"### Headers"
]
},
{
"cell_type": "code",
"execution_count": 263,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T11:49:45.766142Z",
"start_time": "2021-04-11T11:49:45.761157Z"
},
"id": "sevAAWy_NP2A",
"outputId": "13cd6f19-cfd0-4a5b-8918-db616b4d6fa4",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'Date': 'Sun, 22 Sep 2024 15:27:02 GMT', 'Content-Type': 'application/json', 'Content-Length': '378', 'Connection': 'keep-alive', 'Server': 'gunicorn/19.9.0', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true'}"
]
},
"metadata": {},
"execution_count": 263
}
],
"source": [
"r.headers"
]
},
{
"cell_type": "code",
"execution_count": 264,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:30:34.969712Z",
"start_time": "2021-04-11T15:30:33.026070Z"
},
"id": "Kj9A2F0lNP2A",
"outputId": "a096b30e-00fb-4753-d627-de922d43acef",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Text matches: [{'object_url': 'https://api.github.com/repositories/33210074', 'object_type': 'Repository', 'property': 'description', 'fragment': 'Set of Python scripts to perform SecRules language evaluation on a given http request.', 'matches': [{'text': 'Python', 'indices': [7, 13]}, {'text': 'language', 'indices': [42, 50]}, {'text': 'request', 'indices': [78, 85]}]}]\n"
]
}
],
"source": [
"#custimize header\n",
"response = requests.get(\n",
" 'https://api.github.com/search/repositories',\n",
" params={'q': 'requests+language:python'},\n",
" headers={'Accept': 'application/vnd.github.v3.text-match+json'},\n",
")\n",
"\n",
"# View the new `text-matches` array which provides information\n",
"# about your search term within the results\n",
"json_response = response.json()\n",
"repository = json_response['items'][0]\n",
"print(f'Text matches: {repository[\"text_matches\"]}')"
]
},
{
"cell_type": "code",
"execution_count": 265,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:32:08.420664Z",
"start_time": "2021-04-11T15:32:04.440680Z"
},
"id": "J8llQRkZNP2B",
"outputId": "6be386b6-0ab9-4389-9880-e13c803bad38",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 265
}
],
"source": [
"requests.post('https://httpbin.org/post', data={'key':'value'})\n",
"requests.put('https://httpbin.org/put', data={'key':'value'})\n",
"requests.delete('https://httpbin.org/delete')\n",
"requests.head('https://httpbin.org/get')\n",
"requests.patch('https://httpbin.org/patch', data={'key':'value'})\n",
"requests.options('https://httpbin.org/get')"
]
},
{
"cell_type": "code",
"execution_count": 266,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:38:34.572083Z",
"start_time": "2021-04-11T15:38:33.892213Z"
},
"id": "d5dkc-WuNP2B",
"outputId": "7ff58a19-b1b7-43b7-b015-38caa766d0d4",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'application/json'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 266
}
],
"source": [
"response = requests.head('https://httpbin.org/get')\n",
"response.headers['Content-Type']"
]
},
{
"cell_type": "code",
"execution_count": 267,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:38:35.242197Z",
"start_time": "2021-04-11T15:38:34.581059Z"
},
"id": "WYFFyWK5NP2B",
"outputId": "c28564c0-9cfa-41be-c4ae-50360092a752",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{}"
]
},
"metadata": {},
"execution_count": 267
}
],
"source": [
"response = requests.delete('https://httpbin.org/delete')\n",
"json_response = response.json()\n",
"json_response['args']"
]
},
{
"cell_type": "code",
"execution_count": 267,
"metadata": {
"id": "uBIXUnWINP2B"
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "JBq0Jus3NP2B"
},
"source": [
"According to the HTTP specification, POST, PUT, and the less common PATCH requests pass their data through the message body rather than through parameters in the query string."
]
},
{
"cell_type": "code",
"execution_count": 268,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:42:05.930360Z",
"start_time": "2021-04-11T15:42:05.214746Z"
},
"id": "TEJ5QWWINP2B",
"outputId": "c5b8451b-8960-4af7-ab43-7156f92fa0e2",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 268
}
],
"source": [
"requests.post('https://httpbin.org/post', data={'key':'value'}) #veya data=[('key', 'value')]"
]
},
{
"cell_type": "code",
"execution_count": 269,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:42:05.930360Z",
"start_time": "2021-04-11T15:42:05.214746Z"
},
"id": "mzxTUWMyNP2C",
"outputId": "061fdd6b-ef46-42ad-ed26-cbf287da833f",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'{\"key\": \"value\"}'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 269
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'application/json'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 269
}
],
"source": [
"response = requests.post('https://httpbin.org/post', json={'key':'value'})\n",
"json_response = response.json()\n",
"json_response['data']\n",
"json_response['headers']['Content-Type']"
]
},
{
"cell_type": "code",
"execution_count": 270,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:43:12.381811Z",
"start_time": "2021-04-11T15:43:10.781580Z"
},
"id": "HkoeyFP8NP2C",
"outputId": "a44efcf5-d338-4e21-a047-706fa48e8471",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 71
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'application/json'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 270
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'https://httpbin.org/post'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 270
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"b'{\"key\": \"value\"}'"
]
},
"metadata": {},
"execution_count": 270
}
],
"source": [
"response = requests.post('https://httpbin.org/post', json={'key':'value'})\n",
"response.request.headers['Content-Type']\n",
"response.request.url\n",
"response.request.body"
]
},
{
"cell_type": "code",
"execution_count": 271,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:44:21.560506Z",
"start_time": "2021-04-11T15:44:21.551487Z"
},
"id": "WkwQy86INP2C",
"outputId": "cb742d6b-a725-47a0-cbc8-5a4780d4d3fd",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 125
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'https://httpbin.org/post'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 271
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'Date': 'Sun, 22 Sep 2024 15:27:06 GMT', 'Content-Type': 'application/json', 'Content-Length': '481', 'Connection': 'keep-alive', 'Server': 'gunicorn/19.9.0', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true'}"
]
},
"metadata": {},
"execution_count": 271
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'https://httpbin.org/post'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 271
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '16', 'Content-Type': 'application/json'}"
]
},
"metadata": {},
"execution_count": 271
}
],
"source": [
"response.url\n",
"response.headers\n",
"response.request.url\n",
"response.request.headers"
]
},
{
"cell_type": "code",
"execution_count": 272,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T15:46:11.366531Z",
"start_time": "2021-04-11T15:46:07.443303Z"
},
"id": "Ar-7Lm2INP2C",
"outputId": "66148973-0f66-4780-9b7c-134a196d23e0",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"··········\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 272
}
],
"source": [
"#authentication\n",
"from getpass import getpass\n",
"requests.get('https://api.github.com/user', auth=('username', getpass()))"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UEBYM_WtNP2C"
},
"source": [
"### webserive"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TxzHfG0uNP2D"
},
"source": [
"## BeautifulSoup"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "vx_97dK0NP2D"
},
"source": [
"https://realpython.com/beautiful-soup-web-scraper-python/"
]
},
{
"cell_type": "code",
"execution_count": 273,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:36:30.137338Z",
"start_time": "2021-05-15T15:36:28.992174Z"
},
"id": "Si95rGouNP2D"
},
"outputs": [],
"source": [
"URL = 'https://www.monster.com/jobs/search/?q=Software-Developer&where=Australia'\n",
"page = requests.get(URL)"
]
},
{
"cell_type": "code",
"execution_count": 274,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:36:31.477395Z",
"start_time": "2021-05-15T15:36:30.887143Z"
},
"id": "GJ-K5HruNP2D"
},
"outputs": [],
"source": [
"import requests\n",
"from bs4 import BeautifulSoup\n",
"\n",
"URL = 'https://www.excelinefendisi.com/Konular/Excel/Giris_PratikKisayollar.aspx'\n",
"page = requests.get(URL)\n",
"\n",
"soup = BeautifulSoup(page.content, 'html.parser')"
]
},
{
"cell_type": "code",
"execution_count": 275,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-15T15:36:33.839511Z",
"start_time": "2021-05-15T15:36:33.831531Z"
},
"scrolled": true,
"id": "K-NWhchbNP2E",
"outputId": "cb6ba55a-a6af-4558-ff6d-9aa2b4f646b1",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"Amaç | \n",
"Kısayol | \n",
"\n",
"Sayfalar arasında dolaşmak | \n",
"CTRL + PgUp/PgDn | \n",
"
\n",
"\n",
"Bugünün Tarihini yazmak | \n",
"CTRL + SHIFT +, | \n",
"
\n",
"\n",
"Tüm açık dosyalarda calculation yapmak | \n",
"F9 | \n",
"
\n",
"\n",
"Seçili kısmın değerini hesaplayıp göstermek | \n",
"Hücre içindeki formül seçilip F9 | \n",
"
\n",
"\n",
"Aktif sayfada calculation yapmak | \n",
"SHIFT+F9 | \n",
"
\n",
"\n",
"Sadece belli range için calculation yapmak | \n",
"VBA ile yapılır. Burdan bakın. | \n",
"
\n",
"\n",
"Bulunduğun hücrenin CurrentRegion'ını seçme | \n",
"CTRL+ A | \n",
"
\n",
"\n",
"Bulunduğun hücreden CurrentRegion'ın uç noktlarına gitmek | \n",
"CTRL+ Ok tuşları | \n",
"
\n",
"\n",
"Bulunduğun hücreden itibaren belli bir yöne doğru seçim yapmak | \n",
"SHIFT+Ok tuşları | \n",
"
\n",
"Bulunduğun hücreden itibaren CurrentRegion bir ucuna doğru toplu seçim yapmak | \n",
"CTRL+SHIFT+Ok tuşları | \n",
"
\n",
"\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına gitmek | \n",
"CTRL+END | \n",
"
\n",
"\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına kadar seçmek | \n",
"CTRL+SHIFT+END | \n",
"
\n",
"\n",
"Bulunduğun hücreden A1 hücresine kadar olan alanı(sol yukarı) seçmek | \n",
"CTRL+SHIFT+HOME | \n",
"
\n",
"\n",
"Bir hücre içinde veri girerken, aynı hücre içinde yeni bir satır açıp oradan devam etmek | \n",
"ALT+ENTER | \n",
"
\n",
"\n",
"Veri/Formül girişi yaptığınız hücrede alt hücreye geçmeden giriş tamamlamak | \n",
"CTRL+ENTER | \n",
"
\n",
"\n",
" Ekranda bir sayfa sağa kaymak. | \n",
"ALT+PGE DOWN | \n",
"
\n",
"\n",
"AutoFilter'ı aktif/pasif hale getirmek | \n",
"CTRL+SHIFT+L | \n",
"
\n",
"\n",
"Bulunduğunuz hücrenin satır ve sütununa aynı anda freeze uygulamak/kaldırmak | \n",
"Alt+W+FF | \n",
"
\n",
"\n",
"VBA editörünü açmak | \n",
"Alt+F11 | \n",
"
\n",
"\n",
"Ribbonu küçültüp/büyütmek | \n",
"CTRL+F1 | \n",
"
\n",
"\n",
"Üst hücrelerdeki tüm rakamların toplamını almak | \n",
"ALT+= | \n",
"
\n",
"\n",
"Flash Fill uygulamak | \n",
"CTRL+E | \n",
"
\n",
"\n",
"Sadece görünen hücreleri seçmek | \n",
"ALT+; | \n",
"
\n",
"
\n",
"\n"
]
}
],
"source": [
"results = soup.find_all(class_='alterantelitable')\n",
"for r in results:\n",
" print(r, end='\\n'*2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "51f4k7lrNP2E"
},
"source": [
"Gereksiz elementlerden ve taglerden kurtulalım"
]
},
{
"cell_type": "code",
"execution_count": 276,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T16:29:28.266800Z",
"start_time": "2021-04-11T16:29:28.257824Z"
},
"scrolled": true,
"id": "pYqhdq3DNP2E",
"outputId": "226501c1-8de7-4801-cac5-05b138ffbb53",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Sayfalar arasında dolaşmak\n",
"CTRL + PgUp/PgDn\n",
"Bugünün Tarihini yazmak\n",
"CTRL + SHIFT +, \n",
"Tüm açık dosyalarda calculation yapmak\n",
"F9\n",
"Seçili kısmın değerini hesaplayıp göstermek\n",
"Hücre içindeki formül seçilip F9\n",
"Aktif sayfada calculation yapmak\n",
"SHIFT+F9\n",
"Sadece belli range için calculation yapmak\n",
"VBA ile yapılır. Burdan bakın.\n",
"Bulunduğun hücrenin CurrentRegion'ını seçme\n",
"CTRL+ A\n",
"Bulunduğun hücreden CurrentRegion'ın uç noktlarına gitmek\n",
"CTRL+ Ok tuşları\n",
"Bulunduğun hücreden itibaren belli bir yöne doğru seçim yapmak\n",
"SHIFT+Ok tuşları\n",
"Bulunduğun hücreden itibaren CurrentRegion bir ucuna doğru toplu seçim yapmak\n",
"CTRL+SHIFT+Ok tuşları\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına gitmek\n",
"CTRL+END\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına kadar seçmek\n",
"CTRL+SHIFT+END\n",
"Bulunduğun hücreden A1 hücresine kadar olan alanı(sol yukarı) seçmek\n",
"CTRL+SHIFT+HOME\n",
"Bir hücre içinde veri girerken, aynı hücre içinde yeni bir satır açıp oradan devam etmek\n",
"ALT+ENTER\n",
"Veri/Formül girişi yaptığınız hücrede alt hücreye geçmeden giriş tamamlamak \n",
"CTRL+ENTER\n",
" Ekranda bir sayfa sağa kaymak.\n",
"ALT+PGE DOWN\n",
"AutoFilter'ı aktif/pasif hale getirmek\n",
"CTRL+SHIFT+L\n",
"Bulunduğunuz hücrenin satır ve sütununa aynı anda freeze uygulamak/kaldırmak\n",
"Alt+W+FF\n",
"VBA editörünü açmak\n",
"Alt+F11\n",
"Ribbonu küçültüp/büyütmek\n",
"CTRL+F1\n",
"Üst hücrelerdeki tüm rakamların toplamını almak\n",
"ALT+=\n",
"Flash Fill uygulamak\n",
"CTRL+E\n",
"Sadece görünen hücreleri seçmek\n",
"ALT+;\n"
]
}
],
"source": [
"results = soup.find_all(class_='alterantelitable')\n",
"for r in results:\n",
" tds=r.find_all(\"td\")\n",
" for td in tds:\n",
" print(td.text)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8R_PjPfHNP2E"
},
"source": [
"İşlemle ilgili kısayolu altalta değil de yanyana yazmasını sağlayalım,"
]
},
{
"cell_type": "code",
"execution_count": 277,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-11T16:43:05.446075Z",
"start_time": "2021-04-11T16:43:05.431291Z"
},
"id": "csDNZGeHNP2F",
"outputId": "de4eefe6-b523-4db6-e90d-d0d269f85f8b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Sayfalar arasında dolaşmak : CTRL + PgUp/PgDn\n",
"Bugünün Tarihini yazmak : CTRL + SHIFT +, \n",
"Tüm açık dosyalarda calculation yapmak : F9\n",
"Seçili kısmın değerini hesaplayıp göstermek : Hücre içindeki formül seçilip F9\n",
"Aktif sayfada calculation yapmak : SHIFT+F9\n",
"Sadece belli range için calculation yapmak : VBA ile yapılır. Burdan bakın.\n",
"Bulunduğun hücrenin CurrentRegion'ını seçme : CTRL+ A\n",
"Bulunduğun hücreden CurrentRegion'ın uç noktlarına gitmek : CTRL+ Ok tuşları\n",
"Bulunduğun hücreden itibaren belli bir yöne doğru seçim yapmak : SHIFT+Ok tuşları\n",
"Bulunduğun hücreden itibaren CurrentRegion bir ucuna doğru toplu seçim yapmak : CTRL+SHIFT+Ok tuşları\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına gitmek : CTRL+END\n",
"Bulunduğun hücreden CurrentRegion'ın Sağ Aşağı uç noktlasına kadar seçmek : CTRL+SHIFT+END\n",
"Bulunduğun hücreden A1 hücresine kadar olan alanı(sol yukarı) seçmek : CTRL+SHIFT+HOME\n",
"Bir hücre içinde veri girerken, aynı hücre içinde yeni bir satır açıp oradan devam etmek : ALT+ENTER\n",
"Veri/Formül girişi yaptığınız hücrede alt hücreye geçmeden giriş tamamlamak : CTRL+ENTER\n",
" Ekranda bir sayfa sağa kaymak. : ALT+PGE DOWN\n",
"AutoFilter'ı aktif/pasif hale getirmek : CTRL+SHIFT+L\n",
"Bulunduğunuz hücrenin satır ve sütununa aynı anda freeze uygulamak/kaldırmak : Alt+W+FF\n",
"VBA editörünü açmak : Alt+F11\n",
"Ribbonu küçültüp/büyütmek : CTRL+F1\n",
"Üst hücrelerdeki tüm rakamların toplamını almak : ALT+=\n",
"Flash Fill uygulamak : CTRL+E\n",
"Sadece görünen hücreleri seçmek : ALT+;\n"
]
}
],
"source": [
"results = soup.find_all(class_='alterantelitable')\n",
"for r in results:\n",
" trs=r.find_all(\"tr\")\n",
" for tr in trs:\n",
" td1=tr.select(\"td\")[0] #tr.find(\"td\") de olurdu ama aşağıdakiyle bütünlük olması adına ikisini de select ile yaptık\n",
" td2=tr.select(\"td\")[1]\n",
" print(td1.text,\":\",td2.text)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UAMBIdNvNP2G"
},
"source": [
"Bunun bir de MechanicalSoup versiyonu var, onda websitelerindeki formları da otomatik doldurma işlemi yaptırabiliyorsunuz."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MhE55BdvNP2G"
},
"source": [
"## Logging"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bka1Z3k2NP2G"
},
"source": [
"Programınızı test ederken print değil bunu kullanmanız önerilir."
]
},
{
"cell_type": "code",
"execution_count": 278,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T20:51:08.220308Z",
"start_time": "2021-05-12T20:51:08.214322Z"
},
"scrolled": true,
"id": "5O9wEIgdNP2G",
"outputId": "f041b6b9-13a9-48f0-9ea3-601527e97c13",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"WARNING:root:This is a warning message\n",
"ERROR:root:This is an error message\n",
"CRITICAL:root:This is a critical message\n"
]
}
],
"source": [
"import logging\n",
"\n",
"logging.debug('This is a debug message')\n",
"logging.info('This is an info message')\n",
"#by default, the logging module logs the messages with a severity level of WARNING or above\n",
"logging.warning('This is a warning message')\n",
"logging.error('This is an error message')\n",
"logging.critical('This is a critical message')"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xk3DLOV3NP2G"
},
"source": [
"root= default logger"
]
},
{
"cell_type": "code",
"execution_count": 279,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T20:55:46.385664Z",
"start_time": "2021-05-12T20:55:46.381676Z"
},
"id": "mg7IqQ4ONP2G",
"outputId": "be829d2c-5910-4b89-c11c-833dc01ecd5a",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"DEBUG:root:This will get logged\n"
]
}
],
"source": [
"logging.basicConfig(level=logging.DEBUG,force=True) #son parametre gerekli. Detay için: https://stackoverflow.com/questions/30861524/logging-basicconfig-not-creating-log-file-when-i-run-in-pycharm/42210221\n",
"logging.debug('This will get logged')"
]
},
{
"cell_type": "code",
"execution_count": 280,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T20:56:20.598673Z",
"start_time": "2021-05-12T20:56:20.592689Z"
},
"id": "wfoAAVXPNP2G"
},
"outputs": [],
"source": [
"logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s',force=True)\n",
"logging.warning('This will get logged to a file')"
]
},
{
"cell_type": "code",
"execution_count": 281,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T21:01:25.865412Z",
"start_time": "2021-05-12T21:01:25.861458Z"
},
"id": "4Pr6c5K-NP2G",
"outputId": "669451d9-de35-47b3-db05-3cc28263ecab",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"root - INFO - 2024-09-22 15:27:21,768 - Admin logged in\n"
]
}
],
"source": [
"logging.basicConfig(format='%(name)s - %(levelname)s - %(asctime)s - %(message)s', level=logging.INFO,force=True)\n",
"logging.info('Admin logged in')"
]
},
{
"cell_type": "code",
"execution_count": 282,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T21:01:28.566129Z",
"start_time": "2021-05-12T21:01:28.561176Z"
},
"id": "7ix2oUooNP2H",
"outputId": "680775a0-88d8-48ea-a7d3-2ca323bbf378",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"root - ERROR - 2024-09-22 15:27:21,801 - John raised an error\n"
]
}
],
"source": [
"name = 'John'\n",
"logging.error(f'{name} raised an error')"
]
},
{
"cell_type": "code",
"execution_count": 283,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-12T21:02:03.896954Z",
"start_time": "2021-05-12T21:02:03.892964Z"
},
"id": "e8kdrYAINP2H",
"outputId": "84511400-71fb-4713-cd41-66df36e571e3",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"root - ERROR - 2024-09-22 15:27:21,848 - Exception occurred\n",
"Traceback (most recent call last):\n",
" File \"\", line 5, in \n",
" c = a / b\n",
"ZeroDivisionError: division by zero\n"
]
}
],
"source": [
"a = 5\n",
"b = 0\n",
"\n",
"try:\n",
" c = a / b\n",
"except Exception as e:\n",
" logging.error(\"Exception occurred\", exc_info=True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "LshsfDgTNP2H"
},
"source": [
"## tqdm"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DJtLjr4tNP2H"
},
"source": [
"Döngüsel işlemlerde progressbar sağlar"
]
},
{
"cell_type": "code",
"execution_count": 284,
"metadata": {
"id": "KrYPCMN9NP2H",
"outputId": "1761a60f-4bc2-4b90-a2bb-e356dd9132fd",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 10/10 [00:01<00:00, 9.61it/s]\n"
]
}
],
"source": [
"from tqdm import tqdm, trange\n",
"from time import sleep\n",
"\n",
"for i in tqdm(range(10)):\n",
" sleep(.1)"
]
},
{
"cell_type": "code",
"execution_count": 285,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "UKdGnJCmNP2I",
"outputId": "4dc2bbd6-2e97-4188-ceb3-27059532243d"
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 100/100 [00:01<00:00, 96.83it/s]\n"
]
}
],
"source": [
"# Simple loop\n",
"for i in range(100):\n",
" pass\n",
"\n",
"# Loop with a progress bar\n",
"for i in trange(100):\n",
" time.sleep(0.01)"
]
},
{
"cell_type": "code",
"execution_count": 286,
"metadata": {
"colab": {
"referenced_widgets": [
"751edc7876624c858be3920a656bbe5a",
"a17d5706940d471c8def62d24b380451",
"94759083162b4ba7882beb31f5f5c0e6",
"da19b67ccfca40f0ac6fea0079279b45",
"451f673b411e45c89ba06581e24f3632",
"34289f2781b94924ab52dcc7accc4f9b",
"1178361d7b984b039fd0e5ee6a569adb",
"125bc33900574ed692c44040871f04d0",
"c26eb70f93b248e2b78df67a5b6ccc65",
"13308604b83b4ff881bf2e86f199a654",
"286b1c469c4f48c9b4dca098d506e0e2",
"4b45e53206ac4335ad64c1bc76cf0a54",
"94b5dcb00309447db4caf1ca5f2bca6c",
"f34d953ef0f04222800959bad565983a",
"4a35b3bf482b483bbe7f3979968b2b57",
"f21bf8ef6c2543e5b9bd3a2006f37d99",
"898d07425ae6424d9b373bcb23388625",
"2ce64cb4ef464074a58d8d3985b7a4c3",
"a30f9a14b37949aea2fe0577940e22d3",
"803c924d944242399095d29937f7e046",
"bd81728b56694c7493e07276209917a8",
"e1a40e5aab3f40ebbb01cd40c1994a8b",
"55a59a782aa84a98a6ae9a131707e7e4",
"a2adb592ff3245869a0d6379148a97fa",
"d9fb51af123045bfb01c0ca4ff71aadf",
"f057770d640d4d768887b58b24a05698",
"b2b1f12e421249369d42dee4ee11ff55",
"c017e47d80f04575872ee21fa7dc9271",
"1f31528beea8479db1929519dc36ebe0",
"ff25dde586244614852fb29ffd51dac9",
"2ad95d0a26034b62ad7a0941045a8bd6",
"5dc1487f2b6a4a339d103355b6209569",
"2193d83b7019419c86f9915866b79247",
"a57d90da18644950b9ffc8517fe1df7b",
"da5f50d542c14d8f898c9f76abd9709d",
"8e86a15ad03845ed93fc85c7b82487d4",
"0aa16e4c1d1d4059841e36d8b325971f",
"9fd3dc999c6d4270a9ecfe2d8e8f5e1d",
"6ec9be16d0354a8d87c177f2f68c49da",
"10a3331d6fec4345a45b8f8f9d0a8146",
"f125a24c6cf347a3b296a2906556be7a",
"e618cb21d1d6458ca0374e8618dd4ca8",
"2ddf420ed3dc4d429495f5ba7f922956",
"1516a50c3d4342f693aefe40460d6dd2"
],
"base_uri": "https://localhost:8080/",
"height": 145
},
"id": "wgi0kDEPNP2J",
"outputId": "a1d4a42d-6796-4150-e40e-65b47545c015"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"1st loop: 0%| | 0/3 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "751edc7876624c858be3920a656bbe5a"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "4b45e53206ac4335ad64c1bc76cf0a54"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "55a59a782aa84a98a6ae9a131707e7e4"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "a57d90da18644950b9ffc8517fe1df7b"
}
},
"metadata": {}
}
],
"source": [
"#notebook versiyonları daha canlı\n",
"from tqdm.notebook import trange, tqdm\n",
"from time import sleep\n",
"\n",
"for i in trange(3, desc='1st loop'):\n",
" for j in tqdm(range(100), desc='2nd loop'):\n",
" sleep(0.01)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XK4X1bcCNP2J"
},
"source": [
"Eğer progresbar görünmüyorsa mıuhtemelen nbextensionstaki bi widget üyüzndendir, şuraya bakın :\n",
"https://stackoverflow.com/questions/57343134/jupyter-notebooks-not-displaying-progress-bars"
]
},
{
"cell_type": "code",
"execution_count": 287,
"metadata": {
"id": "SECgykdpNP2J"
},
"outputs": [],
"source": [
"# !jupyter nbextension enable --py widgetsnbextension"
]
},
{
"cell_type": "code",
"execution_count": 288,
"metadata": {
"scrolled": true,
"colab": {
"referenced_widgets": [
"2a723646e62b4dd0b4f147b66b704a02",
"7f56935b36514d2980be356a24f24b84",
"dfcfb947b6824327a3aeeb6461e06165",
"8118d9ea4ff74f60819e662d8d5df91f",
"8994340799334930b1cd7409ae0b0727",
"90169b29d6014841a489708e49a74083",
"0776cd338bc1482f965b660491c6afd0",
"e0cd072898dd47c5a217204603ad31c7",
"75b1e79b2bfa42f0a92507207515c487",
"b474aa16bfd54d168f294424bfee7fe8",
"a340f22aac384496a41d9a645ffcb7b7",
"46b5e5dda0304f758c60b6f94051325f",
"d0df97328d7b433dbb72b61b9743a34c",
"8268fc90ebd94eab8dddfc11e1bb1aa2",
"220049b6b28d405b9d1010805501f50f",
"dc194839fc494e5d925d26561f9b32e3",
"2014f467dc8249e09936b3dff8a4e95e",
"10abace2675141db9dcdf6ed9dd7a218",
"ef47ccd577ea49a98c99ab3721c3a7f7",
"e7075953580844248beb6a73c7b3bc36",
"3dbd6933866c45e7b71f0e7c9b22ad02",
"03914bef2ebb436ab254aa4f315009e1",
"2f7c7946c1fc40388172d25cd16d3f7e",
"c2bfc664050b47d888888b8bb0fc08ef",
"8ebdf5f0455c489ca970872f0670f1ee",
"18c4539041eb48e1a6fc3be4a251eb10",
"1f77f1cc085d423a9580200e96c34758",
"9198335e467b43f3b8690c5bbaf58618",
"5f6ad924e3dd45d5821e33dbc0249f1c",
"71a02681e9264458b860ecca3fb7e69c",
"a59b6f2054dc4e948180bfd09d0ba00b",
"1c2a20f640f242feb3e54612df97f56a",
"e3e89e68dc3d4144a9cf20ad8257a9d4",
"4d288466b05f48728173f1351087d17c",
"c4560d87d77a44ed9b5ebdbf994375c6",
"a9ad6adbb75447a6884c12a8e7ced40a",
"02a9a607bc4041f4ac417118d866b608",
"19f3115c55c24bef93ae99e8c5c45529",
"d6b6d63fe6ed4cb58659ae2711c5a94f",
"d4e641c56552460c87905887e70829c2",
"385c2a546fc244f688bfdf32047b2ee3",
"a465664b6da74a9b9913164c05890785",
"384f5336a7f949c586744448645f05df",
"b7454e3fc74b4b00b96f407748ec88f2",
"9677ba9be9d143b2930801e7b88f38d3",
"d0007ff716e04689855fee5ee46f5d11",
"a622553bbe27473dbc5c5b98e9ee7fc6",
"f9876579fc9f4273aa4666944675c22a",
"ab7d4ac726f34d348159d82b8cceb6e1",
"29e2fa26a1994d57a2c04a8e2dc1c1af",
"2940b68710a34f449e8c37f4fff9b8fc",
"7ec17ed3d1c148b0920358d15a61c3d3",
"f8aab6bc3841431e89899f78a149de09",
"077e73ca35334ea993803d0184fa8259",
"c99f9790d8ab4455b7cc4cc0761fbe15"
],
"base_uri": "https://localhost:8080/",
"height": 177
},
"id": "rRh973GCNP2J",
"outputId": "7c3f44ea-04e5-4553-dcdf-f47f52939fa9"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"1st loop: 0%| | 0/4 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "2a723646e62b4dd0b4f147b66b704a02"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "46b5e5dda0304f758c60b6f94051325f"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "2f7c7946c1fc40388172d25cd16d3f7e"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "4d288466b05f48728173f1351087d17c"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"2nd loop: 0%| | 0/100 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "9677ba9be9d143b2930801e7b88f38d3"
}
},
"metadata": {}
}
],
"source": [
"from tqdm import tqdm_notebook\n",
"from tqdm.notebook import trange\n",
"from time import sleep\n",
"\n",
"for i in trange(4, desc='1st loop'):\n",
" for j in trange(100, desc='2nd loop'):\n",
" sleep(0.01)"
]
},
{
"cell_type": "code",
"execution_count": 289,
"metadata": {
"colab": {
"referenced_widgets": [
"d9b31269f6a44179ae92bf432bd54c5b",
"91af54bc0c9e49629a65cacf67bda104",
"b21f17e916c94580b7cfd25805d26323",
"3162987da282497bb2f2821cc8f292c7",
"ab3eaed1d20547628991f415d5adad0c",
"545c51443b2a443d9d37eb10b18d35cc",
"b32c0170cc1a4dff91ff074d123f9d52",
"f0001ddf3d4a45d2869803414894c983",
"e73c46a77b91498980a942d778d961ba",
"dbd2d97b660d4c9d9de92471b1796331",
"1db4bc7a804e41b7838bc069695eddf5"
],
"base_uri": "https://localhost:8080/",
"height": 49
},
"id": "obKbHfJINP2J",
"outputId": "cd32460c-09f5-4dd0-a955-06b280371dbd"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
" 0%| | 0/10 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "d9b31269f6a44179ae92bf432bd54c5b"
}
},
"metadata": {}
}
],
"source": [
"from tqdm.notebook import tqdm_notebook\n",
"import time\n",
"\n",
"for i in tqdm_notebook(range(10)):\n",
" time.sleep(0.5)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "GV9QJSJVNP2J"
},
"source": [
"### looplarda tqdm"
]
},
{
"cell_type": "code",
"execution_count": 290,
"metadata": {
"id": "BTCVBgiyNP2J",
"outputId": "23a00a9a-898d-400e-e8bc-d8689ef8c355",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"Loop 1: 0%| | 0/2 [00:00, ?it/s]\n",
"Loop 2: 0%| | 0/5 [00:00, ?it/s]\u001b[A\n",
"Loop 2: 20%|██ | 1/5 [00:00<00:02, 2.00it/s]\u001b[A\n",
"Loop 2: 40%|████ | 2/5 [00:01<00:01, 1.99it/s]\u001b[A\n",
"Loop 2: 60%|██████ | 3/5 [00:01<00:01, 1.98it/s]\u001b[A\n",
"Loop 2: 80%|████████ | 4/5 [00:02<00:00, 1.98it/s]\u001b[A\n",
"Loop 2: 100%|██████████| 5/5 [00:02<00:00, 1.98it/s]\n",
"Loop 1: 50%|█████ | 1/2 [00:02<00:02, 2.53s/it]\n",
"Loop 2: 0%| | 0/5 [00:00, ?it/s]\u001b[A\n",
"Loop 2: 20%|██ | 1/5 [00:00<00:02, 2.00it/s]\u001b[A\n",
"Loop 2: 40%|████ | 2/5 [00:01<00:01, 1.99it/s]\u001b[A\n",
"Loop 2: 60%|██████ | 3/5 [00:01<00:01, 1.99it/s]\u001b[A\n",
"Loop 2: 80%|████████ | 4/5 [00:02<00:00, 1.99it/s]\u001b[A\n",
"Loop 2: 100%|██████████| 5/5 [00:02<00:00, 1.98it/s]\n",
"Loop 1: 100%|██████████| 2/2 [00:05<00:00, 2.54s/it]\n"
]
}
],
"source": [
"from tqdm import tqdm\n",
"for i in tqdm(range(2), desc = 'Loop 1'):\n",
" for j in tqdm(range(20,25), desc = 'Loop 2'):\n",
" time.sleep(0.5)"
]
},
{
"cell_type": "code",
"execution_count": 291,
"metadata": {
"colab": {
"referenced_widgets": [
"6112246249584fb2a73cbd6e5086c89a",
"f0f7078f01c1405ab75ef477a106cb36",
"bf947e1161974b07af1bc216fa50b2aa",
"ce038aec570a478c8fd770a7f074722f",
"44c1cbfc30b64530a84c464ad263e8df",
"b00f63067158418db9527771958313c4",
"c337f94c20f140cab906d51a2890da49",
"40af719cb62c49c2a1632876b2ae865f",
"034ed767050d41c7937b0476bfdb3c87",
"5e1bf1ec9d6048e2b553a72bb3777b0a",
"58cdd4903a62471d9ecec9cf40fc0d7a",
"7ec0f3f7a707490da8becdb283ad3b9f",
"3cd168f631ae4ad7be7d36c0ae813c73",
"78903c3560be4623acce5faf7d4a3ad8",
"3280d0e326ad4a779126819711c92e5c",
"e2d46d21e9534ba49d5bee5f8aa3050e",
"d76b0dac3b4c4b358846f5600e439e85",
"77a56e87b70e4d7aa22ca1cf7e575c04",
"ebdc3f6de85c4b0282da3334f73cfabc",
"276f4f8d45ed4f568c08093803d3ae50",
"2bf2bbe865c14190b24c1c0e566d4044",
"c2d09620e1e447988e2136a493af25c3",
"3ebff4dd167448a4bce6f6bf21760c1e",
"e8274af5bb9944bda83685457191eed5",
"0904a06cda6f491c943416e11ad262ae",
"9e597674145246fba1e2813aa5722ea7",
"631ecaafa15d44d6b45a0182f5427e29",
"a7afbf7a190d412a8a1531576e84383f",
"9af068e5e72743dcbc18ed9f6dde794e",
"a0eb297817774dd8a45e506109c068cd",
"cf27a49e481e47048174be88277fe3be",
"313edfa26f8f43a6835dc5eeb390c152",
"a914c7dd6ef64656a6ca0287af2b6c36"
],
"base_uri": "https://localhost:8080/",
"height": 113
},
"id": "YEGIGpiKNP2K",
"outputId": "39b0b58a-2658-4da4-b202-a23784ab822f"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loop 1: 0%| | 0/2 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "6112246249584fb2a73cbd6e5086c89a"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loop 2: 0%| | 0/5 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "7ec0f3f7a707490da8becdb283ad3b9f"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loop 2: 0%| | 0/5 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "3ebff4dd167448a4bce6f6bf21760c1e"
}
},
"metadata": {}
}
],
"source": [
"from tqdm.notebook import tqdm_notebook\n",
"for i in tqdm_notebook(range(2), desc = 'Loop 1'):\n",
" for j in tqdm_notebook(range(20,25), desc = 'Loop 2'):\n",
" time.sleep(0.5)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MJfY_64_NP2K"
},
"source": [
"# I/O (Dosya okuma yazma) işlemleri"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "VMK5HaS6NP2L"
},
"source": [
"## Okuma"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qE3Lts8KNP2L"
},
"source": [
"dosya = open(dosya_adı, kip)"
]
},
{
"cell_type": "code",
"execution_count": 292,
"metadata": {
"id": "jPC3A2D_NP2L"
},
"outputs": [],
"source": [
"os.chdir(\"/content/drive/MyDrive/Programming/PythonRocks/mypyext\")"
]
},
{
"cell_type": "code",
"execution_count": 293,
"metadata": {
"id": "jRD4pdwoNP2M"
},
"outputs": [],
"source": [
"import io\n",
"dp = io.open(\"pythonutility.py\", \"r\")"
]
},
{
"cell_type": "code",
"execution_count": 294,
"metadata": {
"id": "r1EpMCKfNP2M",
"outputId": "4a9aafa3-ae2b-4937-f549-7a535bed9a94",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"f\n",
"----\n",
"rom __future__ import print_function\n",
"import inspect\n",
"import os, sys, site\n",
"import functools\n",
"import time\n",
"from forbiddenfruit import curse\n",
"\n",
"try:\n",
" import __builtin__\n",
"except ImportError:\n",
" import builtins as __builtin__\n",
"\n",
"# *************************************************************************************************************\n",
"#Module level methods\n",
"\n",
" \n",
"def lineno():\n",
" previous_frame = inspect.currentframe().f_back.f_back\n",
" (filename, line_number, function_name, lines, index) = inspect.getframeinfo(previous_frame)\n",
" return (line_number, lines)\n",
" #return inspect.currentframe().f_back.f_back.f_lineno, str(inspect.currentframe().f_back)\n",
"\n",
"def printy(*args, **kwargs):\n",
" print(lineno(),\"\\n----------\")\n",
" print(*args, **kwargs)\n",
" print(\" \",end=\"\\n\")\n",
"\n",
"\n",
"def timeElapse(func):\n",
" \"\"\"\n",
" usage:\n",
" @timeElapse\n",
" def somefunc():\n",
" ...\n",
" ...\n",
"\n",
" somefunc()\n",
" \"\"\"\n",
" @functools.wraps(func)\n",
" def wrapper(*args,**kwargs):\n",
" start=time.time()\n",
" value=func(*args,**kwargs)\n",
" func()\n",
" finito=time.time()\n",
" print(\"Time elapsed:{}\".format(finito-start))\n",
" return value\n",
" return wrapper \n",
"\n",
"\n",
"def multioutput(type=\"all\"):\n",
" from IPython.core.interactiveshell import InteractiveShell\n",
" InteractiveShell.ast_node_interactivity = type\n",
" \n",
"def scriptforReload():\n",
" print(\"\"\"\n",
" %load_ext autoreload\n",
" %autoreload 2\"\"\")\n",
" \n",
"def scriptforTraintest():\n",
" print(\"X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.25,random_state=42)\")\n",
" \n",
"def scriptForCitation():\n",
" print(\"\"\" Görsel bu sayfadan alınmıştır \"\"\")\n",
" \n",
"def pythonSomeInfo():\n",
" print(\"system packages folder:\",sys.prefix, end=\"\\n\\n\")\n",
" print(\"pip install folder:\",site.getsitepackages(), end=\"\\n\\n\") \n",
" print(\"python version:\", sys.version, end=\"\\n\\n\")\n",
" print(\"executables location:\",sys.executable, end=\"\\n\\n\")\n",
" print(\"pip version:\", os.popen('pip version').read(), end=\"\\n\\n\")\n",
" pathes= sys.path\n",
" print(\"Python pathes\")\n",
" for p in pathes:\n",
" print(p)\n",
"\n",
"\n",
"def showMemoryUsage():\n",
" dict_={}\n",
" global_vars = list(globals().items())\n",
" for var, obj in global_vars:\n",
" if not var.startswith('_'):\n",
" dict_[var]=sys.getsizeof(obj)\n",
" \n",
" final={k: v for k, v in sorted(dict_.items(), key=lambda item: item[1],reverse=True)} \n",
" print(final)\n",
" \n",
"def readfile(path,enc='cp1254'):\n",
" with io.open(path, \"r\", encoding=enc) as f:\n",
" return f.read()\n",
"\n",
"def getFirstItemFromDictionary(dict_):\n",
" return next(iter(dict_)),next(iter(dict_.values()))\n",
" \n",
"\n",
"\n",
"def removeItemsFromList(self,list2,inplace=True): \n",
" \"\"\"\n",
" Extension method for list type. Removes items from list2 from list1.\n",
" First, forbiddenfruit must be installed via https://pypi.org/project/forbiddenfruit/\n",
" \"\"\" \n",
" if inplace:\n",
" for x in set(list2):\n",
" self.remove(x)\n",
" return self\n",
" else:\n",
" temp=self.copy()\n",
" for x in set(list2):\n",
" temp.remove(x)\n",
" return temp\n",
" \n",
"curse(list, \"removeItemsFromList\", removeItemsFromList)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"----\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0"
]
},
"metadata": {},
"execution_count": 294
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"fr\n"
]
}
],
"source": [
"#oku\n",
"#import io #normalde bu satıra gerek yok, open=io.open için bi alias\n",
"dosya = io.open(\"pythonutility.py\", \"r\") #yine bunda da başta io yazmazdık normalde ama os'nin open'ından ayırmak için ekledik\n",
"print(dosya.readline(1))\n",
"print(\"----\")\n",
"print(dosya.read()) #ilk satırı okuduğumuz için ikinci satırdan okumaya devam ediyor\n",
"print(\"----\")\n",
"dosya.seek(0) #başa konumlanalım tekrar\n",
"print(dosya.readline(2)) #baştan ilk 2 karakter"
]
},
{
"cell_type": "code",
"execution_count": 295,
"metadata": {
"id": "NYJPrI_9NP2M",
"outputId": "cda78192-025c-4574-baa5-472ee9fc3b99",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0"
]
},
"metadata": {},
"execution_count": 295
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"1-from __future__ import print_function\n",
"2-import inspect\n",
"3-import os, sys, site\n",
"4-import functools\n",
"5-import time\n",
"6-from forbiddenfruit import curse\n",
"7-\n",
"8-try:\n",
"9- import __builtin__\n",
"10-except ImportError:\n",
"11- import builtins as __builtin__\n",
"12-\n",
"13-# *************************************************************************************************************\n",
"14-#Module level methods\n",
"15-\n",
"16- \n",
"17-def lineno():\n",
"18- previous_frame = inspect.currentframe().f_back.f_back\n",
"19- (filename, line_number, function_name, lines, index) = inspect.getframeinfo(previous_frame)\n",
"20- return (line_number, lines)\n",
"21- #return inspect.currentframe().f_back.f_back.f_lineno, str(inspect.currentframe().f_back)\n",
"22-\n",
"23-def printy(*args, **kwargs):\n",
"24- print(lineno(),\"\\n----------\")\n",
"25- print(*args, **kwargs)\n",
"26- print(\" \",end=\"\\n\")\n",
"27-\n",
"28-\n",
"29-def timeElapse(func):\n",
"30- \"\"\"\n",
"31- usage:\n",
"32- @timeElapse\n",
"33- def somefunc():\n",
"34- ...\n",
"35- ...\n",
"36-\n",
"37- somefunc()\n",
"38- \"\"\"\n",
"39- @functools.wraps(func)\n",
"40- def wrapper(*args,**kwargs):\n",
"41- start=time.time()\n",
"42- value=func(*args,**kwargs)\n",
"43- func()\n",
"44- finito=time.time()\n",
"45- print(\"Time elapsed:{}\".format(finito-start))\n",
"46- return value\n",
"47- return wrapper \n",
"48-\n",
"49-\n",
"50-def multioutput(type=\"all\"):\n",
"51- from IPython.core.interactiveshell import InteractiveShell\n",
"52- InteractiveShell.ast_node_interactivity = type\n",
"53- \n",
"54-def scriptforReload():\n",
"55- print(\"\"\"\n",
"56- %load_ext autoreload\n",
"57- %autoreload 2\"\"\")\n",
"58- \n",
"59-def scriptforTraintest():\n",
"60- print(\"X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.25,random_state=42)\")\n",
"61- \n",
"62-def scriptForCitation():\n",
"63- print(\"\"\"Görsel bu sayfadan alınmıştır \"\"\")\n",
"64- \n",
"65-def pythonSomeInfo():\n",
"66- print(\"system packages folder:\",sys.prefix, end=\"\\n\\n\")\n",
"67- print(\"pip install folder:\",site.getsitepackages(), end=\"\\n\\n\") \n",
"68- print(\"python version:\", sys.version, end=\"\\n\\n\")\n",
"69- print(\"executables location:\",sys.executable, end=\"\\n\\n\")\n",
"70- print(\"pip version:\", os.popen('pip version').read(), end=\"\\n\\n\")\n",
"71- pathes= sys.path\n",
"72- print(\"Python pathes\")\n",
"73- for p in pathes:\n",
"74- print(p)\n",
"75-\n",
"76-\n",
"77-def showMemoryUsage():\n",
"78- dict_={}\n",
"79- global_vars = list(globals().items())\n",
"80- for var, obj in global_vars:\n",
"81- if not var.startswith('_'):\n",
"82- dict_[var]=sys.getsizeof(obj)\n",
"83- \n",
"84- final={k: v for k, v in sorted(dict_.items(), key=lambda item: item[1],reverse=True)} \n",
"85- print(final)\n",
"86- \n",
"87-def readfile(path,enc='cp1254'):\n",
"88- with io.open(path, \"r\", encoding=enc) as f:\n",
"89- return f.read()\n",
"90-\n",
"91-def getFirstItemFromDictionary(dict_):\n",
"92- return next(iter(dict_)),next(iter(dict_.values()))\n",
"93- \n",
"94-\n",
"95-\n",
"96-def removeItemsFromList(self,list2,inplace=True): \n",
"97- \"\"\"\n",
"98- Extension method for list type. Removes items from list2 from list1.\n",
"99- First, forbiddenfruit must be installed via https://pypi.org/project/forbiddenfruit/\n",
"100- \"\"\" \n",
"101- if inplace:\n",
"102- for x in set(list2):\n",
"103- self.remove(x)\n",
"104- return self\n",
"105- else:\n",
"106- temp=self.copy()\n",
"107- for x in set(list2):\n",
"108- temp.remove(x)\n",
"109- return temp\n",
"110- \n",
"111-curse(list, \"removeItemsFromList\", removeItemsFromList)\n",
"112-\n",
"113-\n",
"114-\n",
"115-\n",
"116-\n"
]
}
],
"source": [
"#her satırın başına satır no ekleyelim\n",
"dosya.seek(0)\n",
"i=1\n",
"for satır in dosya.readlines():\n",
" print(\"{}-{}\".format(i,satır),end=\"\")\n",
" i+=1"
]
},
{
"cell_type": "code",
"execution_count": 296,
"metadata": {
"id": "Obwq_iNjNP2M"
},
"outputs": [],
"source": [
"#yarat\n",
"yenidosya=io.open(\"test.txt\",\"w\")\n",
"yenidosya.close()"
]
},
{
"cell_type": "code",
"execution_count": 297,
"metadata": {
"id": "jWwIjeIKNP2M",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "f2b5d520-bd8a-49f1-87e1-deb9155ba69e"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"6"
]
},
"metadata": {},
"execution_count": 297
}
],
"source": [
"#varolana yaz, sonuna ekleme\n",
"yenidosya=io.open(\"test.txt\",\"a\")\n",
"yenidosya.write(\"\\nselam\")\n",
"yenidosya.flush() #hemen yazsın. bunu kullanmazsak yaptığımız değişiklikleri hemen görmeyiz"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_FPZJr39NP2N"
},
"source": [
"Güvenli dosya işlemleri"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xjGs2hFlNP2N"
},
"source": [
"Dosyalarla işiniz bitince kapatmak önemlidir. Kapandığından emin olmak için with bloğu içinde yazmak gerekir"
]
},
{
"cell_type": "code",
"execution_count": 298,
"metadata": {
"scrolled": true,
"id": "TuNhM5TlNP2N",
"outputId": "7fed268e-fadd-4228-dcc9-cc917e176789",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"selam\n"
]
}
],
"source": [
"with io.open(\"test.txt\", \"r\") as dosya:\n",
" print(dosya.read())"
]
},
{
"cell_type": "code",
"execution_count": 299,
"metadata": {
"id": "gefRFUIKNP2N",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "6228198b-92de-4558-e601-4e48c71e5477"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0"
]
},
"metadata": {},
"execution_count": 299
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"13"
]
},
"metadata": {},
"execution_count": 299
}
],
"source": [
"#hem okuma hem yazma moduyla açıp başa bilgi ekleme\n",
"with io.open(\"test.txt\", \"r+\") as f:\n",
" content = f.read()\n",
" f.seek(0) #Dosyayı başa sarıyoruz\n",
" f.write(\"volkan\\n\"+content)"
]
},
{
"cell_type": "code",
"source": [
"!rm test.txt"
],
"metadata": {
"id": "6tyKo6fQSnRi"
},
"execution_count": 300,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "OijGzgTxNP2N"
},
"source": [
"**Türkçe karakter**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WJ1vPazkNP2O"
},
"source": [
"\n",
"utf-8 mi cp1254 mü? \n",
"\n",
"https://python-istihza.yazbel.com/karakter_kodlama.html"
]
},
{
"cell_type": "code",
"execution_count": 301,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T13:53:00.576889Z",
"start_time": "2020-11-22T13:53:00.572903Z"
},
"id": "Yn5SWIheNP2O",
"outputId": "89047128-7dba-4908-c962-37a3d4994ab1",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'UTF-8'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 301
}
],
"source": [
"import locale\n",
"locale.getpreferredencoding()"
]
},
{
"cell_type": "code",
"execution_count": 302,
"metadata": {
"ExecuteTime": {
"end_time": "2020-11-22T13:53:07.023663Z",
"start_time": "2020-11-22T13:53:07.017681Z"
},
"id": "nzTj3YM8NP2O",
"outputId": "4d1b3682-7a90-4162-b804-34518a74cc23",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"import numpy as np\n",
"import pandas as pd\n",
"from sklearn.metrics import silhouette_samples, silhouette_score\n",
"from sklearn.metrics import confusion_matrix, accuracy_score, recall_score, precision_score, f1_score\n",
"from sklearn.metrics import roc_curve, precision_recall_curve, auc\n",
"from sklearn.metrics import mean_squared_error,mean_absolute_error,r2_score\n",
"import matplotlib.cm as cm\n",
"import matplotlib.pyplot as plt\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"from sklearn.cluster import KMeans\n",
"from sklearn.neighbors import NearestNeighbors\n",
"from sklearn.preprocessing import LabelEncoder, OneHotEncoder,binarize\n",
"from sklearn.pipeline import Pipeline \n",
"import os, sys, site\n",
"import itertools \n",
"from numpy.random import uniform\n",
"from random import sample, seed\n",
"from math import isnan\n",
"from multiprocessing import Pool\n",
"from scipy.spatial import distance\n",
"from sklearn.metrics.pairwise import cosine_similarity\n",
"from sklearn.model_selection import learning_curve\n",
"import networkx as nx\n",
"from sklearn.experimental import enable_halving_search_cv \n",
"from sklearn.model_selection import RandomizedSearchCV,GridSearchCV,HalvingGridSearchCV,HalvingRandomSearchCV\n",
"import warnings\n",
"import statsmodels.api as sm\n",
"import statsmodels.stats.api as sms\n",
"import statsmodels.formula.api as smf\n",
"\n",
"def adjustedr2(R_sq,y,y_pred,x):\n",
" return 1 - (1-R_sq)*(len(y)-1)/(len(y_pred)-x.shape[1]-1)\n",
"\n",
"def calculate_aic_bic(n, mse, num_params):\n",
" \"\"\"\n",
" n=number of instances in y \n",
" \"\"\" \n",
" aic = n *np.log(mse) + 2 * num_params\n",
" bic = n * np.log(mse) + num_params * np.log(n)\n",
" # ssr = fitted.ssr #residual sum of squares\n",
" # AIC = N + N*np.log(2.0*np.pi*ssr/N)+2.0*(p+1)\n",
" # print(AIC)\n",
" # BIC = N + N*np.log(2.0*np.pi*ssr/N) + p*np.log(N)\n",
" # print(BIC)\n",
" return aic, bic \n",
"\n",
" \n",
"def printScores(y_test,y_pred,x=None,*, alg_type='c',f1avg=None):\n",
" \"\"\" \n",
" prints the available performanse scores.\n",
" Args:\n",
" alg_type: c for classfication, r for regressin\n",
" f1avg: if None, taken as binary.\n",
" \"\"\"\n",
" if alg_type=='c':\n",
" acc=accuracy_score(y_test,y_pred)\n",
" print(\"Accuracy:\",acc)\n",
" recall=recall_score(y_test,y_pred)\n",
" print(\"Recall:\",recall)\n",
" precision=precision_score(y_test,y_pred)\n",
" print(\"Precision:\",precision)\n",
" if f1avg is None:\n",
" f1=f1_score(y_test,y_pred)\n",
" else:\n",
" f1=f1_score(y_test,y_pred,average=f1avg)\n",
" print(\"F1:\",f1)\n",
" return acc,recall,precision,f1\n",
" else:\n",
" mse=mean_squared_error(y_test,y_pred) #RMSE için squared=False yapılabilir ama bize mse de lazım\n",
" rmse=round(np.sqrt(mse),2)\n",
" print(\"RMSE:\",rmse)\n",
" mae=round(mean_absolute_error(y_test,y_pred),2)\n",
" print(\"MAE:\",mae) \n",
" r2=round(r2_score(y_test,y_pred),2)\n",
" print(\"r2:\",r2)\n",
" adjr2=round(adjustedr2(r2_score(y_test,y_pred),y_test,y_pred,x),2)\n",
" print(\"Adjusted R2:\",adjr2)\n",
" aic, bic=calculate_aic_bic(len(y_test),mse,len(x))\n",
" print(\"AIC:\",round(aic,2))\n",
" print(\"BIC:\",round(bic,2))\n",
" return (rmse,mae,r2,adjr2,round(aic,2),round(bic,2))\n",
"\n",
"def draw_sihoutte(range_n_clusters,data,isbasic=True,printScores=True,random_state=42):\n",
" \"\"\"\n",
" - isbasic:if True, plots scores as line chart whereas false, plots the sihoutte chart.\n",
" - taken from https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html and modified as needed.\n",
" \"\"\"\n",
" if isbasic==False:\n",
" silhouette_max=0\n",
" for n_clusters in range_n_clusters:\n",
" # Create a subplot with 1 row and 2 columns\n",
" fig, (ax1, ax2) = plt.subplots(1, 2)\n",
" fig.set_size_inches(12,4)\n",
"\n",
" ax1.set_xlim([-1, 1])\n",
" # The (n_clusters+1)*10 is for inserting blank space between silhouette\n",
" # plots of individual clusters, to demarcate them clearly.\n",
" ax1.set_ylim([0, len(data) + (n_clusters + 1) * 10])\n",
"\n",
" # Initialize the clusterer with n_clusters value and a random generator\n",
" # seed of 10 for reproducibility.\n",
" clusterer = KMeans(n_clusters=n_clusters, random_state=random_state)\n",
" cluster_labels = clusterer.fit_predict(data)\n",
"\n",
" # The silhouette_score gives the average value for all the samples.\n",
" # This gives a perspective into the density and separation of the formed\n",
" # clusters\n",
" silhouette_avg = silhouette_score(data, cluster_labels)\n",
" if silhouette_avg>silhouette_max:\n",
" silhouette_max,nc=silhouette_avg,n_clusters\n",
" print(\"For n_clusters =\", n_clusters,\n",
" \"The average silhouette_score is :\", silhouette_avg)\n",
"\n",
" # Compute the silhouette scores for each sample\n",
" sample_silhouette_values = silhouette_samples(data, cluster_labels)\n",
"\n",
" y_lower = 10\n",
" for i in range(n_clusters):\n",
" # Aggregate the silhouette scores for samples belonging to\n",
" # cluster i, and sort them\n",
" ith_cluster_silhouette_values = \\\n",
" sample_silhouette_values[cluster_labels == i]\n",
"\n",
" ith_cluster_silhouette_values.sort()\n",
"\n",
" size_cluster_i = ith_cluster_silhouette_values.shape[0]\n",
" y_upper = y_lower + size_cluster_i\n",
"\n",
" color = cm.nipy_spectral(float(i) / n_clusters)\n",
" ax1.fill_betweenx(np.arange(y_lower, y_upper),\n",
" 0, ith_cluster_silhouette_values,\n",
" facecolor=color, edgecolor=color, alpha=0.7)\n",
"\n",
" # Label the silhouette plots with their cluster numbers at the middle\n",
" ax1.text(-0.05, y_lower + 0.5 * size_cluster_i, str(i))\n",
"\n",
" # Compute the new y_lower for next plot\n",
" y_lower = y_upper + 10 # 10 for the 0 samples\n",
"\n",
" ax1.set_title(\"The silhouette plot for the various clusters.\")\n",
" ax1.set_xlabel(\"The silhouette coefficient values\")\n",
" ax1.set_ylabel(\"Cluster label\")\n",
"\n",
" # The vertical line for average silhouette score of all the values\n",
" ax1.axvline(x=silhouette_avg, color=\"red\", linestyle=\"--\")\n",
"\n",
" ax1.set_yticks([]) # Clear the yaxis labels / ticks\n",
" ax1.set_xticks([-0.1, 0, 0.2, 0.4, 0.6, 0.8, 1])\n",
"\n",
" # 2nd Plot showing the actual clusters formed\n",
" colors = cm.nipy_spectral(cluster_labels.astype(float) / n_clusters)\n",
" ax2.scatter(data[:, 0], data[:, 1], marker='.', s=30, lw=0, alpha=0.7,\n",
" c=colors, edgecolor='k')\n",
"\n",
" # Labeling the clusters\n",
" centers = clusterer.cluster_centers_\n",
" # Draw white circles at cluster centers\n",
" ax2.scatter(centers[:, 0], centers[:, 1], marker='o',\n",
" c=\"white\", alpha=1, s=200, edgecolor='k')\n",
"\n",
" for i, c in enumerate(centers):\n",
" ax2.scatter(c[0], c[1], marker='$%d$' % i, alpha=1,\n",
" s=50, edgecolor='k')\n",
"\n",
" ax2.set_title(\"The visualization of the clustered data.\")\n",
" ax2.set_xlabel(\"Feature space for the 1st feature\")\n",
" ax2.set_ylabel(\"Feature space for the 2nd feature\")\n",
"\n",
" plt.suptitle((\"Silhouette analysis for KMeans clustering on sample data \"\n",
" \"with n_clusters = %d\" % n_clusters),\n",
" fontsize=14, fontweight='bold') \n",
" plt.show()\n",
" print(f\"Best score is {silhouette_max} for {nc}\")\n",
" else:\n",
" ss = []\n",
" for n in range_n_clusters:\n",
" kmeans = KMeans(n_clusters=n, random_state=random_state)\n",
" kmeans.fit_transform(data)\n",
" labels = kmeans.labels_\n",
" score = silhouette_score(data, labels)\n",
" ss.append(score)\n",
" if printScores==True:\n",
" print(n,score)\n",
" plt.plot(range_n_clusters,ss)\n",
" plt.xticks(range_n_clusters) #so it shows all the ticks\n",
"\n",
"def drawEpsilonDecider(data,n):\n",
" \"\"\"\n",
" for DBSCAN\n",
" n: # of neighbours(in the nearest neighbour calculation, the point itself will appear as the first nearest neighbour. so, this should be\n",
" given as min_samples+1.\n",
" data:numpy array\n",
" \"\"\"\n",
" neigh = NearestNeighbors(n_neighbors=n)\n",
" nbrs = neigh.fit(data)\n",
" distances, indices = nbrs.kneighbors(data)\n",
" distances = np.sort(distances, axis=0)\n",
" distances = distances[:,1]\n",
" plt.ylabel(\"eps\")\n",
" plt.xlabel(\"number of data points\")\n",
" plt.plot(distances)\n",
" \n",
"def draw_elbow(ks,data):\n",
" wcss = []\n",
" for i in ks:\n",
" kmeans = KMeans(n_clusters=i, init='k-means++', max_iter=300, n_init=10, random_state=0) \n",
" kmeans.fit(data)\n",
" wcss.append(kmeans.inertia_)\n",
" plt.plot(ks, wcss)\n",
" plt.title('Elbow Method')\n",
" plt.xlabel('# of clusters')\n",
" plt.ylabel('WCSS')\n",
" plt.xticks(ks)\n",
" plt.show()\n",
" \n",
"def biplot(score,coeff,y,variance,labels=None):\n",
" \"\"\"\n",
" PCA biplot.\n",
" Found at https://stackoverflow.com/questions/39216897/plot-pca-loadings-and-loading-in-biplot-in-sklearn-like-rs-autoplot\n",
" \"\"\"\n",
" xs = score[:,0]\n",
" ys = score[:,1]\n",
" n = coeff.shape[0]\n",
" scalex = 1.0/(xs.max() - xs.min())\n",
" scaley = 1.0/(ys.max() - ys.min())\n",
" plt.scatter(xs * scalex,ys * scaley, c = y)\n",
" for i in range(n):\n",
" plt.arrow(0, 0, coeff[i,0], coeff[i,1],color = 'r',alpha = 0.5)\n",
" if labels is None:\n",
" plt.text(coeff[i,0]* 1.15, coeff[i,1] * 1.15, \"Var\"+str(i+1), color = 'g', ha = 'center', va = 'center')\n",
" else:\n",
" plt.text(coeff[i,0]* 1.15, coeff[i,1] * 1.15, labels[i], color = 'g', ha = 'center', va = 'center')\n",
" plt.xlim(-1,1)\n",
" plt.ylim(-1,1)\n",
" plt.xlabel(\"PC{},Variance:{}\".format(1,variance[0]))\n",
" plt.ylabel(\"PC{},Variance:{}\".format(2,variance[1]))\n",
" plt.grid()\n",
"\n",
" \n",
" \n",
"\n",
"def get_feature_names_from_columntransformer(ct):\n",
" \"\"\"\n",
" returns feature names in a dataframe passet to a column transformer. Useful if you have lost the names due to conversion to numpy.\n",
" if it doesn't work, try out the one at https://johaupt.github.io/blog/columnTransformer_feature_names.html or at https://lifesaver.codes/answer/cannot-get-feature-names-after-columntransformer-12525\n",
" \"\"\"\n",
" final_features=[]\n",
" try:\n",
" \n",
" for trs in ct.transformers_:\n",
" trName=trs[0]\n",
" trClass=trs[1]\n",
" features=trs[2]\n",
" if isinstance(trClass,Pipeline): \n",
" n,tr=zip(*trClass.steps)\n",
" for t in tr: #t is a transformator object, tr is the list of all transoformators in the pipeline \n",
" if isinstance(t,OneHotEncoder):\n",
" for f in t.get_feature_names_out(features):\n",
" final_features.append(\"OHE_\"+f) \n",
" break\n",
" else: #if not found onehotencoder, add the features directly\n",
" for f in features:\n",
" final_features.append(f) \n",
" elif isinstance(trClass,OneHotEncoder): #?type(trClass)==OneHotEncoder:\n",
" for f in trClass.get_feature_names_out(features):\n",
" final_features.append(\"OHE_\"+f) \n",
" else:\n",
" #remainders\n",
" if trName==\"remainder\":\n",
" for i in features:\n",
" final_features.append(ct.feature_names_in_[i])\n",
" #all the others\n",
" else:\n",
" for f in features:\n",
" final_features.append(f) \n",
" except AttributeError:\n",
" print(\"Your sklearn version may be old and you may need to upgrade it via 'python -m pip install scikit-learn -U'\")\n",
"\n",
" return final_features \n",
"\n",
"def featureImportanceEncoded(feature_importance_array,feature_names,figsize=(8,6)):\n",
" \"\"\"\n",
" plots the feature importance plot.\n",
" feature_importance_array:feature_importance_ attribute\n",
" \"\"\"\n",
" plt.figure(figsize=figsize)\n",
" dfimp=pd.DataFrame(feature_importance_array.reshape(-1,1).T,columns=feature_names).T\n",
" dfimp.index.name=\"Encoded\"\n",
" dfimp.rename(columns={0: \"Importance\"},inplace=True)\n",
" dfimp.reset_index(inplace=True)\n",
" dfimp[\"Feature\"]=dfimp[\"Encoded\"].apply(lambda x:x[4:].split('_')[0] if \"OHE\" in x else x)\n",
" dfimp.groupby(by='Feature')[\"Importance\"].sum().sort_values().plot(kind='barh');\n",
" \n",
" \n",
"def compareEstimatorsInGridSearch(gs,tableorplot='plot',figsize=(10,5),est=\"param_clf\"):\n",
" \"\"\"\n",
" Gives a comparison table/plot of the estimators in a gridsearch.\n",
" \"\"\"\n",
" cvres = gs.cv_results_\n",
" cv_results = pd.DataFrame(cvres)\n",
" cv_results[est]=cv_results[est].apply(lambda x:str(x).split('(')[0])\n",
" cols={\"mean_test_score\":\"MAX of mean_test_score\",\"mean_fit_time\":\"MIN of mean_fit_time\"}\n",
" summary=cv_results.groupby(by=est).agg({\"mean_test_score\":\"max\", \"mean_fit_time\":\"min\"}).rename(columns=cols)\n",
" summary.sort_values(by='MAX of mean_test_score', ascending=False,inplace=True)\n",
" \n",
" \n",
" if tableorplot=='table':\n",
" return summary\n",
" else:\n",
" _, ax1 = plt.subplots(figsize=figsize)\n",
" color = 'tab:red'\n",
" ax1.xaxis.set_ticks(range(len(summary)))\n",
" ax1.set_xticklabels(summary.index, rotation=45,ha='right')\n",
" \n",
" ax1.set_ylabel('MAX of mean_test_score', color=color)\n",
" ax1.bar(summary.index, summary['MAX of mean_test_score'], color=color)\n",
" ax1.tick_params(axis='y', labelcolor=color)\n",
" ax1.set_ylim(0,summary[\"MAX of mean_test_score\"].max()*1.1)\n",
"\n",
" ax2 = ax1.twinx() \n",
" color = 'tab:blue'\n",
" ax2.set_ylabel('MIN of mean_fit_time', color=color) \n",
" ax2.plot(summary.index, summary['MIN of mean_fit_time'], color=color)\n",
" ax2.tick_params(axis='y', labelcolor=color) \n",
" ax2.set_ylim(0,summary[\"MIN of mean_fit_time\"].max()*1.1)\n",
"\n",
" plt.show() \n",
"\n",
"def plot_confusion_matrix(cm, classes,\n",
" normalize=False,\n",
" title='Confusion matrix',\n",
" cmap=plt.cm.Blues):\n",
" \"\"\"\n",
" Depreceated. use 'sklearn.metrics.ConfusionMatrixDisplay(cm).plot();'\n",
" \"\"\"\n",
" warnings.warn(\"use 'sklearn.metrics.ConfusionMatrixDisplay(cm).plot();'\") \n",
" \n",
"def CheckForClusteringTendencyWithHopkins(X,random_state=42): \n",
" \"\"\"\n",
" taken from https://matevzkunaver.wordpress.com/2017/06/20/hopkins-test-for-cluster-tendency/\n",
" X:numpy array or dataframe\n",
" the closer to 1, the higher probability of clustering tendency \n",
" X must be scaled priorly.\n",
" \"\"\"\n",
" \n",
" d = X.shape[1]\n",
" #d = len(vars) # columns\n",
" n = len(X) # rows\n",
" m = int(0.1 * n) # heuristic from article [1]\n",
" if type(X)==np.ndarray:\n",
" nbrs = NearestNeighbors(n_neighbors=1).fit(X)\n",
" else:\n",
" nbrs = NearestNeighbors(n_neighbors=1).fit(X.values)\n",
" seed(random_state) \n",
" rand_X = sample(range(0, n, 1), m)\n",
" \n",
" ujd = []\n",
" wjd = []\n",
" for j in range(0, m):\n",
" #-------------------bi ara random state yap----------\n",
" u_dist, _ = nbrs.kneighbors(uniform(np.amin(X,axis=0),np.amax(X,axis=0),d).reshape(1, -1), 2, return_distance=True)\n",
" ujd.append(u_dist[0][1])\n",
" if type(X)==np.ndarray:\n",
" w_dist, _ = nbrs.kneighbors(X[rand_X[j]].reshape(1, -1), 2, return_distance=True)\n",
" else:\n",
" w_dist, _ = nbrs.kneighbors(X.iloc[rand_X[j]].values.reshape(1, -1), 2, return_distance=True)\n",
" wjd.append(w_dist[0][1])\n",
" \n",
" H = sum(ujd) / (sum(ujd) + sum(wjd))\n",
" if isnan(H):\n",
" print(ujd, wjd)\n",
" H = 0\n",
" \n",
" return H \n",
"\n",
"def getNumberofCatsAndNumsFromDatasets(path,size=10_000_000):\n",
" \"\"\"\n",
" returns the number of features by their main type(i.e categorical or numeric or datetime)\n",
" args:\n",
" path:path of the files residing in.\n",
" size:size of the file(default is ~10MB). if chosen larger, it will take longer to return.\n",
" \"\"\"\n",
" os.chdir(path)\n",
" files=os.listdir()\n",
" liste=[]\n",
" for d in files: \n",
" try:\n",
" if os.path.isfile(d) and os.path.getsize(d)` for the various\n",
" cross-validators that can be used here.\n",
"\n",
" n_jobs : int or None, default=None\n",
" Number of jobs to run in parallel.\n",
" ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.\n",
" ``-1`` means using all processors. See :term:`Glossary `\n",
" for more details.\n",
"\n",
" train_sizes : array-like of shape (n_ticks,)\n",
" Relative or absolute numbers of training examples that will be used to\n",
" generate the learning curve. If the ``dtype`` is float, it is regarded\n",
" as a fraction of the maximum size of the training set (that is\n",
" determined by the selected validation method), i.e. it has to be within\n",
" (0, 1]. Otherwise it is interpreted as absolute sizes of the training\n",
" sets. Note that for classification the number of samples usually have\n",
" to be big enough to contain at least one sample from each class.\n",
" (default: np.linspace(0.1, 1.0, 5))\n",
" \"\"\"\n",
" if axes is None:\n",
" _, axes = plt.subplots(1, 3, figsize=(20, 5))\n",
"\n",
" axes[0].set_title(title)\n",
" if ylim is not None:\n",
" axes[0].set_ylim(*ylim)\n",
" axes[0].set_xlabel(\"Training examples\")\n",
" axes[0].set_ylabel(\"Score\")\n",
"\n",
" train_sizes, train_scores, test_scores, fit_times, _ = learning_curve(\n",
" estimator,\n",
" X,\n",
" y,\n",
" cv=cv,\n",
" n_jobs=n_jobs,\n",
" train_sizes=train_sizes,\n",
" return_times=True,\n",
" random_state=random_state\n",
" )\n",
" train_scores_mean = np.mean(train_scores, axis=1)\n",
" train_scores_std = np.std(train_scores, axis=1)\n",
" test_scores_mean = np.mean(test_scores, axis=1)\n",
" test_scores_std = np.std(test_scores, axis=1)\n",
" fit_times_mean = np.mean(fit_times, axis=1)\n",
" fit_times_std = np.std(fit_times, axis=1)\n",
"\n",
" # Plot learning curve\n",
" axes[0].grid()\n",
" axes[0].fill_between(\n",
" train_sizes,\n",
" train_scores_mean - train_scores_std,\n",
" train_scores_mean + train_scores_std,\n",
" alpha=0.1,\n",
" color=\"r\",\n",
" )\n",
" axes[0].fill_between(\n",
" train_sizes,\n",
" test_scores_mean - test_scores_std,\n",
" test_scores_mean + test_scores_std,\n",
" alpha=0.1,\n",
" color=\"g\",\n",
" )\n",
" axes[0].plot(\n",
" train_sizes, train_scores_mean, \"o-\", color=\"r\", label=\"Training score\"\n",
" )\n",
" axes[0].plot(\n",
" train_sizes, test_scores_mean, \"o-\", color=\"g\", label=\"Cross-validation score\"\n",
" )\n",
" axes[0].legend(loc=\"best\")\n",
"\n",
" # Plot n_samples vs fit_times\n",
" axes[1].grid()\n",
" axes[1].plot(train_sizes, fit_times_mean, \"o-\")\n",
" axes[1].fill_between(\n",
" train_sizes,\n",
" fit_times_mean - fit_times_std,\n",
" fit_times_mean + fit_times_std,\n",
" alpha=0.1,\n",
" )\n",
" axes[1].set_xlabel(\"Training examples\")\n",
" axes[1].set_ylabel(\"fit_times\")\n",
" axes[1].set_title(\"Scalability of the model\")\n",
"\n",
" # Plot fit_time vs score\n",
" fit_time_argsort = fit_times_mean.argsort()\n",
" fit_time_sorted = fit_times_mean[fit_time_argsort]\n",
" test_scores_mean_sorted = test_scores_mean[fit_time_argsort]\n",
" test_scores_std_sorted = test_scores_std[fit_time_argsort]\n",
" axes[2].grid()\n",
" axes[2].plot(fit_time_sorted, test_scores_mean_sorted, \"o-\")\n",
" axes[2].fill_between(\n",
" fit_time_sorted,\n",
" test_scores_mean_sorted - test_scores_std_sorted,\n",
" test_scores_mean_sorted + test_scores_std_sorted,\n",
" alpha=0.1,\n",
" )\n",
" axes[2].set_xlabel(\"fit_times\")\n",
" axes[2].set_ylabel(\"Score\")\n",
" axes[2].set_title(\"Performance of the model\")\n",
"\n",
" plt.show()\n",
"\n",
"\n",
"def drawNeuralNetwork(layers,figsize=(10,8)):\n",
" \"\"\"\n",
" Draws a represantion of the neural network using networkx.\n",
" layers:list of the # of layers including input and output.\n",
" \"\"\" \n",
" plt.figure(figsize=figsize)\n",
" pos={} \n",
" for e,l in enumerate(layers):\n",
" for i in range(l):\n",
" pos[str(l)+\"_\"+str(i)]=((e+1)*50,i*5+50)\n",
"\n",
"\n",
" X=nx.Graph()\n",
" nx.draw_networkx_nodes(X,pos,nodelist=pos.keys(),node_color='r')\n",
" X.add_nodes_from(pos.keys())\n",
"\n",
" edgelist=[] #list of tuple\n",
" for e,l in enumerate(layers):\n",
" for i in range(l):\n",
" try:\n",
" for k in range(layers[e+1]):\n",
" try:\n",
" edgelist.append((str(l)+\"_\"+str(i),str(layers[e+1])+\"_\"+str(k)))\n",
" except:\n",
" pass\n",
" except:\n",
" pass\n",
"\n",
"\n",
" X.add_edges_from(edgelist)\n",
" for n, p in pos.items():\n",
" X.nodes[n]['pos'] = p \n",
"\n",
" nx.draw(X, pos); \n",
"\n",
"def draw_network_graph(ws):\n",
" \"\"\"\n",
" Draws a network graph of a neural network with dynamic weights.\n",
"\n",
" Args:\n",
" ws: A list of weight matrices.\n",
" \"\"\"\n",
" # Create a directed graph\n",
" G = nx.DiGraph()\n",
"\n",
" # Add nodes\n",
" layer_count = len(ws) + 1 # Include input layer\n",
" node_count = [ws[0].shape[0]] + [w.shape[1] for w in ws]\n",
"\n",
" for layer in range(layer_count):\n",
" if layer == 0:\n",
" for i in range(node_count[layer]):\n",
" G.add_node(f\"Input {i+1}\", layer=layer)\n",
" elif layer == layer_count - 1:\n",
" for i in range(node_count[layer]):\n",
" G.add_node(f\"Output {i+1}\", layer=layer)\n",
" else:\n",
" for i in range(node_count[layer]):\n",
" G.add_node(f\"Hidden {layer}_{i+1}\", layer=layer)\n",
"\n",
" # Add edges with weights\n",
" for layer in range(layer_count - 1):\n",
" for i in range(node_count[layer]):\n",
" for j in range(node_count[layer + 1]):\n",
" if layer == 0:\n",
" G.add_edge(f\"Input {i+1}\", f\"Hidden {layer + 1}_{j+1}\", weight=ws[layer][i, j])\n",
" elif layer == layer_count - 2:\n",
" G.add_edge(f\"Hidden {layer}_{i+1}\", f\"Output {j+1}\", weight=ws[layer][i, j])\n",
" else:\n",
" G.add_edge(f\"Hidden {layer}_{i+1}\", f\"Hidden {layer + 1}_{j+1}\", weight=ws[layer][i, j])\n",
"\n",
" # Draw the graph\n",
" pos = {}\n",
" pos.update({node: (0, i) for i, node in enumerate(\n",
" [f\"Input {i+1}\" for i in range(node_count[0])]\n",
" )})\n",
" pos.update({node: (layer, i) for layer in range(1, layer_count -1) for i, node in enumerate(\n",
" [f\"Hidden {layer}_{i+1}\" for i in range(node_count[layer])]\n",
" )})\n",
" pos.update({node: (layer_count - 1, i) for i, node in enumerate(\n",
" [f\"Output {i+1}\" for i in range(node_count[-1])]\n",
" )})\n",
"\n",
" nx.draw(G, pos, with_labels=True, node_size=1000, node_color='lightblue', font_size=10)\n",
"\n",
" # Add edge labels with weights\n",
" edge_labels = {(u, v): f\"{d['weight']:.2f}\" for u, v, d in G.edges(data=True)}\n",
" nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels)\n",
"\n",
" plt.show()\n",
"\n",
"def plotROC(y_test,X_test,estimator,pos_label=1,figsize=(6,6)):\n",
" cm = confusion_matrix(y_test, estimator.predict(X_test)) \n",
" fpr, tpr, _ = roc_curve(y_test, estimator.predict_proba(X_test)[:,1],pos_label=pos_label)\n",
" roc_auc = auc(fpr, tpr) #or roc_auc_score(y_test, y_scores)\n",
" plt.figure(figsize=figsize)\n",
" plt.plot(fpr, tpr, label='(ROC-AUC = %0.2f)' % roc_auc)\n",
" plt.plot([0, 1], [0, 1], 'k--')\n",
" tn, fp, fn, tp = [i for i in cm.ravel()]\n",
" plt.plot(fp/(fp+tn), tp/(tp+fn), 'ro', markersize=8, label='Decision Point(Optimal threshold)')\n",
" plt.xlim([0.0, 1.0])\n",
" plt.ylim([0.0, 1.05])\n",
" plt.xlabel('False Positive Rate(1-sepecifity)')\n",
" plt.ylabel('True Positive Rate(Recall/Sensitivity)')\n",
" plt.title('ROC Curve (TPR vs FPR at each probability threshold)')\n",
" plt.legend(loc=\"lower right\")\n",
" plt.show();\n",
"\n",
"def plot_precision_recall_curve(y_test_encoded,X_test,estimator,threshs=np.linspace(0.0, 0.98, 40),figsize=(16,6)):\n",
" \"\"\"\n",
" y_test should be labelencoded.\n",
" \"\"\"\n",
" pred_prob = estimator.predict_proba(X_test) \n",
" precision, recall, thresholds = precision_recall_curve(y_test_encoded, pred_prob[:,1])\n",
" pr_auc = auc(recall, precision) \n",
"\n",
" Xt = [] ; Yp = [] ; Yr = [] \n",
" for thresh in threshs:\n",
" with warnings.catch_warnings():\n",
" warnings.filterwarnings(\"error\")\n",
" try:\n",
" y_pred = binarize(pred_prob, threshold=thresh)[:,1]\n",
" Xt.append(thresh)\n",
" Yp.append(precision_score(y_test_encoded, y_pred)) #,zero_division=1\n",
" Yr.append(recall_score(y_test_encoded, y_pred))\n",
" except Warning as e:\n",
" print(f\"{thresh:.2f}, error , probably division by zero\")\n",
"\n",
" \n",
" plt.figure(figsize=figsize)\n",
" plt.subplot(121)\n",
" plt.plot(Xt, Yp, \"--\", label='Precision', color='red')\n",
" plt.plot(Xt, Yr, \"--\", label='Recall', color='blue')\n",
" plt.title(\"Precision vs Recall based on decision threshold\")\n",
" plt.xlabel('Decision threshold') ; plt.ylabel('Precision - Recall')\n",
" plt.legend()\n",
" plt.subplot(122)\n",
" plt.step(Yr, Yp, color='black', label='LR (PR-AUC = %0.2f)' % pr_auc)\n",
" # calculate the no skill line as the proportion of the positive class (0.145)\n",
" no_skill = len(y_test_encoded[y_test_encoded==1]) / len(y_test_encoded)\n",
" # plot the no skill precision-recall curve\n",
" plt.plot([0, 1], [no_skill, no_skill], linestyle='--', color='green', label='No Skill')\n",
" # plot the perfect PR curve\n",
" plt.plot([0, 1],[1, 1], color='blue', label='Perfect')\n",
" plt.plot([1, 1],[1, len(y_test_encoded[y_test_encoded==1]) / len(y_test_encoded)], color='blue')\n",
" plt.title('PR Curve')\n",
" plt.xlabel('Recall: TP / (TP+FN)') ; plt.ylabel('Precison: TP / (TP+FP)')\n",
" plt.legend(loc=\"upper right\")\n",
" plt.show();\n",
"\n",
"\n",
"def find_best_cutoff_for_classification(estimator, y_test_le, X_test, costlist,threshs=np.linspace(0., 0.98, 20)): \n",
" \"\"\"\n",
" y_test should be labelencoded as y_test_le\n",
" costlist=cost list for TN, TP, FN, FP\n",
" \"\"\"\n",
" y_pred_prob = estimator.predict_proba(X_test)\n",
" y_pred = estimator.predict(X_test)\n",
" Xp = [] ; Yp = [] # initialization\n",
"\n",
" print(\"Cutoff\\t Cost/Instance\\t Accuracy\\t FN\\t FP\\t TP\\t TN\\t Recall\\t Precision F1-score\")\n",
" for cutoff in threshs:\n",
" with warnings.catch_warnings():\n",
" warnings.filterwarnings(\"error\")\n",
" try:\n",
" y_pred = binarize(y_pred_prob, threshold=cutoff)[:,1]\n",
" cm = confusion_matrix(y_test_le, y_pred)\n",
" TP = cm[1,1]\n",
" TN = cm[0,0]\n",
" FP = cm[0,1]\n",
" FN = cm[1,0]\n",
" cost = costlist[0]*TN + costlist[1]*TP + costlist[2]*FN + costlist[3]*FP\n",
" cost_per_instance = cost/len(y_test_le)\n",
" Xp.append(cutoff)\n",
" Yp.append(cost_per_instance)\n",
" acc=accuracy_score(y_test_le, y_pred)\n",
" rec = cm[1,1]/(cm[1,1]+cm[1,0])\n",
" pre = cm[1,1]/(cm[1,1]+cm[0,1])\n",
" f1 = 2*pre*rec/(pre+rec)\n",
" print(f\"{cutoff:.2f}\\t {cost_per_instance:.2f}\\t\\t {acc:.3f}\\t\\t {FN}\\t {FP}\\t {TP}\\t {TN}\\t {rec:.3f}\\t {pre:.3f}\\t {f1:.3f}\")\n",
" except Warning as e:\n",
" print(f\"{cutoff:.2f}\\t {cost_per_instance:.2f}\\t\\t {acc:.3f}\\t\\t {FN}\\t {FP}\\t {TP}\\t {TN}\\t error might have happened from here anywhere\")\n",
"\n",
" plt.figure(figsize=(10,6))\n",
" plt.plot(Xp, Yp)\n",
" plt.xlabel('Threshold value for probability')\n",
" plt.ylabel('Cost per instance')\n",
" plt.axhline(y=min(Yp), xmin=0., xmax=1., linewidth=1, color = 'r')\n",
" plt.show();\n",
"\n",
"\n",
"def plot_gain_and_lift(estimator,X_test,y_test,pos_label=\"Yes\",figsize=(16,6)):\n",
" \"\"\" \n",
" y_test as numpy array\n",
" prints the gain and lift values and plots the charts. \n",
" \"\"\"\n",
" prob_df=pd.DataFrame({\"Prob\":estimator.predict_proba(X_test)[:,1]})\n",
" prob_df[\"label\"]=np.where(y_test==pos_label,1,0)\n",
" prob_df = prob_df.sort_values(by=\"Prob\",ascending=False)\n",
" prob_df['Decile'] = pd.qcut(prob_df['Prob'], 10, labels=list(range(1,11))[::-1])\n",
"\n",
" #Calculate the actual churn in each decile\n",
" res = pd.crosstab(prob_df['Decile'], prob_df['label'])[1].reset_index().rename(columns = {1: 'Number of Responses'})\n",
" lg = prob_df['Decile'].value_counts(sort = False).reset_index().rename(columns = {'Decile': 'Number of Cases', 'index': 'Decile'})\n",
" lg = pd.merge(lg, res, on = 'Decile').sort_values(by = 'Decile', ascending = False).reset_index(drop = True)\n",
" #Calculate the cumulative\n",
" lg['Cumulative Responses'] = lg['Number of Responses'].cumsum()\n",
" #Calculate the percentage of positive in each decile compared to the total nu\n",
" lg['% of Events'] = np.round(((lg['Number of Responses']/lg['Number of Responses'].sum())*100),2)\n",
" #Calculate the Gain in each decile\n",
" lg['Gain'] = lg['% of Events'].cumsum()\n",
" lg['Decile'] = lg['Decile'].astype('int')\n",
" lg['lift'] = np.round((lg['Gain']/(lg['Decile']*10)),2)\n",
" display(lg)\n",
"\n",
" plt.figure(figsize=figsize)\n",
" plt.subplot(121)\n",
" plt.plot(lg[\"Decile\"],lg[\"lift\"],label=\"Model\")\n",
" plt.plot(lg[\"Decile\"],[1 for i in range(10)],label=\"Random\")\n",
" plt.title(\"Lift Chart\")\n",
" plt.legend()\n",
" plt.xlabel(\"Decile\")\n",
" plt.ylabel(\"Lift\") \n",
" \n",
" plt.subplot(122)\n",
" plt.plot(lg[\"Decile\"],lg[\"Gain\"],label=\"Model\")\n",
" plt.plot(lg[\"Decile\"],[10*(i+1) for i in range(10)],label=\"Random\")\n",
" plt.title(\"Gain Chart\")\n",
" plt.legend()\n",
" plt.xlabel(\"Decile\")\n",
" plt.ylabel(\"Gain\")\n",
" plt.xlim(0,11)\n",
" plt.ylim(0,110)\n",
" plt.show(); \n",
"\n",
"def plot_gain_and_lift_orj(estimator,X_test,y_test,pos_label=\"Yes\"):\n",
" \"\"\" \n",
" y_test as numpy array\n",
" prints the gain and lift values and plots the charts. \n",
" \"\"\"\n",
" prob_df=pd.DataFrame({\"Prob\":estimator.predict_proba(X_test)[:,1]})\n",
" prob_df[\"label\"]=np.where(y_test==pos_label,1,0)\n",
" prob_df = prob_df.sort_values(by=\"Prob\",ascending=False)\n",
" prob_df['Decile'] = pd.qcut(prob_df['Prob'], 10, labels=list(range(1,11))[::-1])\n",
"\n",
" #Calculate the actual churn in each decile\n",
" res = pd.crosstab(prob_df['Decile'], prob_df['label'])[1].reset_index().rename(columns = {1: 'Number of Responses'})\n",
" lg = prob_df['Decile'].value_counts(sort = False).reset_index().rename(columns = {'Decile': 'Number of Cases', 'index': 'Decile'})\n",
" lg = pd.merge(lg, res, on = 'Decile').sort_values(by = 'Decile', ascending = False).reset_index(drop = True)\n",
" #Calculate the cumulative\n",
" lg['Cumulative Responses'] = lg['Number of Responses'].cumsum()\n",
" #Calculate the percentage of positive in each decile compared to the total nu\n",
" lg['% of Events'] = np.round(((lg['Number of Responses']/lg['Number of Responses'].sum())*100),2)\n",
" #Calculate the Gain in each decile\n",
" lg['Gain'] = lg['% of Events'].cumsum()\n",
" lg['Decile'] = lg['Decile'].astype('int')\n",
" lg['lift'] = np.round((lg['Gain']/(lg['Decile']*10)),2)\n",
" display(lg)\n",
" \n",
" plt.plot(lg[\"Decile\"],lg[\"lift\"],label=\"Model\")\n",
" plt.plot(lg[\"Decile\"],[1 for i in range(10)],label=\"Random\")\n",
" plt.title(\"Lift Chart\")\n",
" plt.legend()\n",
" plt.xlabel(\"Decile\")\n",
" plt.ylabel(\"Lift\")\n",
" plt.show();\n",
" \n",
" plt.plot(lg[\"Decile\"],lg[\"Gain\"],label=\"Model\")\n",
" plt.plot(lg[\"Decile\"],[10*(i+1) for i in range(10)],label=\"Random\")\n",
" plt.title(\"Gain Chart\")\n",
" plt.legend()\n",
" plt.xlabel(\"Decile\")\n",
" plt.ylabel(\"Gain\")\n",
" plt.xlim(0,11)\n",
" plt.ylim(0,110)\n",
" plt.show(); \n",
"\n",
"def linear_model_feature_importance(estimator,preprocessor,feature_selector=None,clfreg_name=\"clf\"):\n",
" \"\"\"\n",
" plots the feature importance, namely coefficients for linear models.\n",
" args:\n",
" estimator:either pipeline or gridsearch/randomizedsearch object\n",
" preprocessor:variable name of the preprocessor, which is a columtransformer\n",
" feature_selector:if there is a feature selector step, its name.\n",
" clfreg_name:name of the linear model, usually clf for a classifier, reg for a regressor \n",
" \"\"\"\n",
" \n",
" if feature_selector is not None:\n",
" if isinstance(estimator,GridSearchCV) or isinstance(estimator,RandomizedSearchCV)\\\n",
" or isinstance(estimator,HalvingGridSearchCV) or isinstance(estimator,HalvingRandomSearchCV):\n",
" est=estimator.best_estimator_\n",
" elif isinstance(estimator,Pipeline):\n",
" est=estimator\n",
" else:\n",
" print(\"Either pipeline or gridsearch/randomsearch should be passes for estimator\")\n",
" return\n",
" \n",
" selecteds=est[feature_selector].get_support()\n",
" final_features=[x for e,x in enumerate(get_feature_names_from_columntransformer(preprocessor)) if e in np.argwhere(selecteds==True).ravel()]\n",
" else:\n",
" final_features=get_feature_names_from_columntransformer(preprocessor)\n",
"\n",
" importance=est[clfreg_name].coef_[0]\n",
" plt.bar(final_features, importance)\n",
" plt.xticks(rotation= 45,horizontalalignment=\"right\"); \n",
"\n",
"\n",
"\n",
"def gridsearch_to_df(searcher,topN=5):\n",
" \"\"\"\n",
" searcher: any of grid/randomized searcher objects or their halving versions\n",
" \"\"\"\n",
" cvresultdf = pd.DataFrame(searcher.cv_results_)\n",
" cvresultdf = cvresultdf.sort_values(\"mean_test_score\", ascending=False)\n",
" cols=[x for x in searcher.cv_results_.keys() if \"param_\" in x]+[\"mean_test_score\",\"std_test_score\"]\n",
" return cvresultdf[cols].head(topN) \n",
"\n",
"\n",
"def getAnotherEstimatorFromGridSearch(gs_object,estimator):\n",
" cvres = gs_object.cv_results_\n",
" cv_results = pd.DataFrame(cvres)\n",
" cv_results[\"param_clf\"]=cv_results[\"param_clf\"].apply(lambda x:str(x).split('(')[0])\n",
"\n",
" dtc=cv_results[cv_results[\"param_clf\"]==estimator]\n",
" return dtc.getRowOnAggregation_(\"mean_test_score\",\"max\")[\"params\"].values \n",
"\n",
"def cooksdistance(X,y,figsize=(8,6),ylim=0.5): \n",
" model = sm.OLS(y,X)\n",
" fitted = model.fit()\n",
" # Cook's distance\n",
" pr=X.shape[1]\n",
" CD = 4.0/(X.shape[0]-pr-1)\n",
" influence = fitted.get_influence()\n",
" #c is the distance and p is p-value\n",
" (c, p) = influence.cooks_distance\n",
" plt.figure(figsize=figsize)\n",
" plt.stem(np.arange(len(c)), c, markerfmt=\",\")\n",
" plt.axhline(y=CD, color='r')\n",
" plt.ylabel('Cook\\'s D')\n",
" plt.xlabel('Observation Number')\n",
" plt.ylim(0,ylim)\n",
" plt.show();\n",
"\n"
]
}
],
"source": [
"with io.open(\"/content/drive/MyDrive/Programming/PythonRocks/mypyext/ml.py\", \"r\", encoding='cp1254') as f:\n",
" print(f.read())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "suEJ8XztNP2O"
},
"source": [
"## Yazma"
]
},
{
"cell_type": "code",
"execution_count": 303,
"metadata": {
"id": "055w2MM7NP2O",
"outputId": "8d6326fd-2706-42f4-a5e6-14a43b11e344",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"execution_count": 303
}
],
"source": [
"yenidosya=io.open(\"writetest.txt\",\"w\") #x\n",
"yenidosya.write(\"merhaba\\n\")\n",
"lines=[\"satır1\\n\",\"satır2\\n\"]\n",
"yenidosya.writelines(lines)\n",
"yenidosya.close()"
]
},
{
"cell_type": "code",
"execution_count": 304,
"metadata": {
"id": "GUbenUslNP2O",
"outputId": "801d967b-4cbb-4f9e-dfd6-cf42afa67d18",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"6"
]
},
"metadata": {},
"execution_count": 304
}
],
"source": [
"#varolana yaz, sonuna ekleme\n",
"yenidosya=io.open(\"writetest.txt\",\"a\")\n",
"yenidosya.write(\"\\nselam\")\n",
"yenidosya.flush() #hemen yazsın. bunu kullanmazsak yaptığımız değişiklikleri hemen görmeyiz\n",
"yenidosya.close()"
]
},
{
"cell_type": "code",
"source": [
"!rm writetest.txt"
],
"metadata": {
"id": "6e04xrowTOeF"
},
"execution_count": 305,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "lofzAC10NP2Q"
},
"source": [
"# Veritabanı işlemleri"
]
},
{
"cell_type": "code",
"execution_count": 306,
"metadata": {
"id": "EgfOzPiPNP2Q"
},
"outputs": [],
"source": [
"import sqlite3 as sql #python içinde otomatikman gelir"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7vGExp6mNP2Q"
},
"source": [
"sqlite sayfasından chinook databaseini indirin"
]
},
{
"cell_type": "code",
"execution_count": 307,
"metadata": {
"id": "6pgtkIIlNP2R"
},
"outputs": [],
"source": [
"vt = sql.connect('/content/drive/MyDrive/Programming/PythonRocks/dataset/chinook.db')"
]
},
{
"cell_type": "code",
"execution_count": 308,
"metadata": {
"id": "51kSF6MbNP2R"
},
"outputs": [],
"source": [
"cur=vt.cursor()"
]
},
{
"cell_type": "code",
"execution_count": 309,
"metadata": {
"scrolled": true,
"id": "QYENBSRZNP2R",
"outputId": "0bbdea17-d1f4-4637-976b-dd02da428eeb",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 309
}
],
"source": [
"cur.execute(\"select * from albums\")"
]
},
{
"cell_type": "code",
"execution_count": 310,
"metadata": {
"id": "wIlYv6fENP2S",
"outputId": "0abaa3e1-62da-4a27-f961-abd80f39e181",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[(1, 'For Those About To Rock We Salute You', 1),\n",
" (2, 'Balls to the Wall', 2),\n",
" (3, 'Restless and Wild', 2)]"
]
},
"metadata": {},
"execution_count": 310
}
],
"source": [
"cur.fetchmany(3)"
]
},
{
"cell_type": "code",
"execution_count": 311,
"metadata": {
"id": "2vkd8fvdNP2S"
},
"outputs": [],
"source": [
"veriler = cur.fetchall()"
]
},
{
"cell_type": "code",
"execution_count": 312,
"metadata": {
"scrolled": true,
"id": "KpHtTp8GNP2S",
"outputId": "fb30f204-9963-41be-b053-82ed1429d974",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[(4, 'Let There Be Rock', 1),\n",
" (5, 'Big Ones', 3),\n",
" (6, 'Jagged Little Pill', 4),\n",
" (7, 'Facelift', 5),\n",
" (8, 'Warner 25 Anos', 6)]"
]
},
"metadata": {},
"execution_count": 312
}
],
"source": [
"veriler[:5] #ilk 3ünü çektiğimiz için 4ten devam ediyor"
]
},
{
"cell_type": "code",
"execution_count": 313,
"metadata": {
"id": "bbmc2UcjNP2S"
},
"outputs": [],
"source": [
"vt.close()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XF2lNJ1jNP2S"
},
"source": [
"NOT:sqlite3 çok basit bir veritabanı olup, oracle veya sql server gibi güçlü veritabanlarını sorgulamak için sqlalchemy veya pyodbc gibi modülleri kullanırız ve buradan aldığmız datayı pandas ile işleyebiliriz. Bunun için benim github repomdaki Python Veri Analizi notebookuna bakmanızı tavsiye ederim. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7yl4D60NNP2S"
},
"source": [
"http://sqlitebrowser.org/. sitesi de incelenebilir"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "aWdQ3O35NP2S"
},
"source": [
"# Classlar"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dsnWXgT5NP2T"
},
"source": [
"Python nesne yönelimli(oo) bir dildir ve tüm oo dillerde olduğu gibi sınıflar yaratılabilir. Örnek bir sınıf yaratımı aşağıdaki gibi olup detaylar için googlelamanızı rica ederim."
]
},
{
"cell_type": "code",
"execution_count": 314,
"metadata": {
"id": "ISjW6xL4NP2T",
"outputId": "3a6022fe-62c6-464f-e478-3f7c80b24c16",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"yeni araç hazır\n",
"yeni araç hazır\n",
"yeni araç hazır\n",
"<__main__.Araba object at 0x7d45a4bfff70>\n",
"çalışıyor\n",
"durdu\n",
"Mekanik\n",
"Mekanik\n"
]
}
],
"source": [
"class Araba:\n",
" aractipi=\"Mekanik\" #class seviyesinde, tüm Arabalar tarafından paylaşılan bir değer\n",
" def __init__(self,model,marka,km):\n",
" self.model=model\n",
" self.marka=marka\n",
" self.km=km\n",
" print(\"yeni araç hazır\")\n",
" def run(self):\n",
" print(\"çalışıyor\")\n",
" def stop(self):\n",
" print(\"durdu\")\n",
"\n",
"bmw0=Araba(2011,\"bmw\",0)\n",
"bmw1=Araba(2014,\"bmw\",0)\n",
"audi=Araba(2011,\"audi\",0)\n",
"print(bmw0)\n",
"bmw0.run()\n",
"bmw0.stop()\n",
"print(bmw0.aractipi)\n",
"print(audi.aractipi)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jy6MGCozNP2T"
},
"source": [
"## Paralelleştirme"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4vVeILX-NP2T"
},
"source": [
"Özellikle analitik model kurma sırasında çok işimize yarayan bir olgudur. Bunun için ayrı bir notebook'um olacak. Önden araştırmak isteyenler şu kavramları araştırabilir. Multi-threading, multiprocessing, conccurency ve parallelism"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fabSEm7ANP2T"
},
"source": [
"# Verimlilik ve Diğer"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ocn1iv8JNP2U"
},
"source": [
"## debugging"
]
},
{
"cell_type": "code",
"execution_count": 315,
"metadata": {
"scrolled": true,
"id": "CDamCKWINP2U",
"outputId": "ce10d6b7-bded-43af-80a1-84bda466c6ca",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"\n",
"PYDEV DEBUGGER WARNING:\n",
"sys.settrace() should not be used when the debugger is being used.\n",
"This may cause the debugger to stop working correctly.\n",
"If this is needed, please check: \n",
"http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html\n",
"to see how to restore the debug tracing back correctly.\n",
"Call Location:\n",
" File \"/usr/lib/python3.10/bdb.py\", line 336, in set_trace\n",
" sys.settrace(self.trace_dispatch)\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"4\n",
"--Call--\n",
"> \u001b[0;32m/usr/local/lib/python3.10/dist-packages/IPython/core/displayhook.py\u001b[0m(252)\u001b[0;36m__call__\u001b[0;34m()\u001b[0m\n",
"\u001b[0;32m 250 \u001b[0;31m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mflush\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[0;32m 251 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[0;32m--> 252 \u001b[0;31m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[0;32m 253 \u001b[0;31m \"\"\"Printing with history cache management.\n",
"\u001b[0m\u001b[0;32m 254 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\n",
"ipdb> c\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"\n",
"PYDEV DEBUGGER WARNING:\n",
"sys.settrace() should not be used when the debugger is being used.\n",
"This may cause the debugger to stop working correctly.\n",
"If this is needed, please check: \n",
"http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html\n",
"to see how to restore the debug tracing back correctly.\n",
"Call Location:\n",
" File \"/usr/lib/python3.10/bdb.py\", line 347, in set_continue\n",
" sys.settrace(None)\n",
"\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"asda\n"
]
}
],
"source": [
"import pdb\n",
"print(4)\n",
"pdb.set_trace() #c devam, n:next gibi seçenekler var\n",
"print(\"asda\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "won9XpBlNP2U"
},
"source": [
"## memory yönetimi"
]
},
{
"cell_type": "code",
"execution_count": 317,
"metadata": {
"scrolled": true,
"id": "AdmijMKPNP2V",
"outputId": "e654c22f-8181-4b11-b6fa-64b2e449a166",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"64\n",
"88\n",
"104\n"
]
}
],
"source": [
"import sys\n",
"import array\n",
"t=(1,2,3)\n",
"l=[1,2,\"3\"]\n",
"a=array.array(\"l\",[1,2,3])\n",
"print(sys.getsizeof(t)) #immutabel olduğu için daha az\n",
"print(sys.getsizeof(l)) #mutable olduğu için tupldan daha çok, içine farklı tipler alabileceğim için arraydan daha çok\n",
"print(sys.getsizeof(a)) #eleman tipi belli olduğu için listten daha az"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "C0XtcQ6ONP2V"
},
"source": [
"# Cheatsheet"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UE-hIG00NP2V"
},
"source": [
"![cheatsheet.png](cheatsheet.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1YeCwWllNP2V"
},
"source": [
"# Kendinizi test edin"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "uj1XC9KjNP2V"
},
"source": [
"Aşağıdaki adreslerden birinden challange sorularını görebilirsiniz.\n",
"* https://mybinder.org/v2/gh/VolkiTheDreamer/PythonRocks/master (Interaktiftir, download etmenize gerek yok)\n",
"* üstteki açılmazsa: https://nbviewer.org/github/VolkiTheDreamer/PythonRocks/blob/master/Python%20Challenges.ipynb\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bI3tbqMJNP2V"
},
"source": [
"Bunun dışında şu sitelerde de pratik yapma imkanı bulabilirsiniz.\n",
"\n",
"- https://www.w3resource.com/python-exercises/\n",
"- https://www.practicepython.org/\n",
"- https://www.w3schools.com/python/python_exercises.asp\n",
"- https://pynative.com/python-exercises-with-solutions/"
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {
"height": "708px",
"left": "300px",
"top": "148px",
"width": "305.625px"
},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
},
"colab": {
"provenance": [],
"toc_visible": true,
"include_colab_link": true
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"751edc7876624c858be3920a656bbe5a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_a17d5706940d471c8def62d24b380451",
"IPY_MODEL_94759083162b4ba7882beb31f5f5c0e6",
"IPY_MODEL_da19b67ccfca40f0ac6fea0079279b45"
],
"layout": "IPY_MODEL_451f673b411e45c89ba06581e24f3632"
}
},
"a17d5706940d471c8def62d24b380451": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_34289f2781b94924ab52dcc7accc4f9b",
"placeholder": "",
"style": "IPY_MODEL_1178361d7b984b039fd0e5ee6a569adb",
"value": "1st loop: 100%"
}
},
"94759083162b4ba7882beb31f5f5c0e6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_125bc33900574ed692c44040871f04d0",
"max": 3,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_c26eb70f93b248e2b78df67a5b6ccc65",
"value": 3
}
},
"da19b67ccfca40f0ac6fea0079279b45": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_13308604b83b4ff881bf2e86f199a654",
"placeholder": "",
"style": "IPY_MODEL_286b1c469c4f48c9b4dca098d506e0e2",
"value": " 3/3 [00:03<00:00, 1.08s/it]"
}
},
"451f673b411e45c89ba06581e24f3632": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"34289f2781b94924ab52dcc7accc4f9b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1178361d7b984b039fd0e5ee6a569adb": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"125bc33900574ed692c44040871f04d0": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c26eb70f93b248e2b78df67a5b6ccc65": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"13308604b83b4ff881bf2e86f199a654": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"286b1c469c4f48c9b4dca098d506e0e2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"4b45e53206ac4335ad64c1bc76cf0a54": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_94b5dcb00309447db4caf1ca5f2bca6c",
"IPY_MODEL_f34d953ef0f04222800959bad565983a",
"IPY_MODEL_4a35b3bf482b483bbe7f3979968b2b57"
],
"layout": "IPY_MODEL_f21bf8ef6c2543e5b9bd3a2006f37d99"
}
},
"94b5dcb00309447db4caf1ca5f2bca6c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_898d07425ae6424d9b373bcb23388625",
"placeholder": "",
"style": "IPY_MODEL_2ce64cb4ef464074a58d8d3985b7a4c3",
"value": "2nd loop: 100%"
}
},
"f34d953ef0f04222800959bad565983a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_a30f9a14b37949aea2fe0577940e22d3",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_803c924d944242399095d29937f7e046",
"value": 100
}
},
"4a35b3bf482b483bbe7f3979968b2b57": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_bd81728b56694c7493e07276209917a8",
"placeholder": "",
"style": "IPY_MODEL_e1a40e5aab3f40ebbb01cd40c1994a8b",
"value": " 100/100 [00:01<00:00, 97.19it/s]"
}
},
"f21bf8ef6c2543e5b9bd3a2006f37d99": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"898d07425ae6424d9b373bcb23388625": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2ce64cb4ef464074a58d8d3985b7a4c3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"a30f9a14b37949aea2fe0577940e22d3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"803c924d944242399095d29937f7e046": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"bd81728b56694c7493e07276209917a8": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e1a40e5aab3f40ebbb01cd40c1994a8b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"55a59a782aa84a98a6ae9a131707e7e4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_a2adb592ff3245869a0d6379148a97fa",
"IPY_MODEL_d9fb51af123045bfb01c0ca4ff71aadf",
"IPY_MODEL_f057770d640d4d768887b58b24a05698"
],
"layout": "IPY_MODEL_b2b1f12e421249369d42dee4ee11ff55"
}
},
"a2adb592ff3245869a0d6379148a97fa": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_c017e47d80f04575872ee21fa7dc9271",
"placeholder": "",
"style": "IPY_MODEL_1f31528beea8479db1929519dc36ebe0",
"value": "2nd loop: 100%"
}
},
"d9fb51af123045bfb01c0ca4ff71aadf": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_ff25dde586244614852fb29ffd51dac9",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_2ad95d0a26034b62ad7a0941045a8bd6",
"value": 100
}
},
"f057770d640d4d768887b58b24a05698": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_5dc1487f2b6a4a339d103355b6209569",
"placeholder": "",
"style": "IPY_MODEL_2193d83b7019419c86f9915866b79247",
"value": " 100/100 [00:01<00:00, 94.61it/s]"
}
},
"b2b1f12e421249369d42dee4ee11ff55": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c017e47d80f04575872ee21fa7dc9271": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1f31528beea8479db1929519dc36ebe0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"ff25dde586244614852fb29ffd51dac9": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2ad95d0a26034b62ad7a0941045a8bd6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"5dc1487f2b6a4a339d103355b6209569": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2193d83b7019419c86f9915866b79247": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"a57d90da18644950b9ffc8517fe1df7b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_da5f50d542c14d8f898c9f76abd9709d",
"IPY_MODEL_8e86a15ad03845ed93fc85c7b82487d4",
"IPY_MODEL_0aa16e4c1d1d4059841e36d8b325971f"
],
"layout": "IPY_MODEL_9fd3dc999c6d4270a9ecfe2d8e8f5e1d"
}
},
"da5f50d542c14d8f898c9f76abd9709d": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_6ec9be16d0354a8d87c177f2f68c49da",
"placeholder": "",
"style": "IPY_MODEL_10a3331d6fec4345a45b8f8f9d0a8146",
"value": "2nd loop: 100%"
}
},
"8e86a15ad03845ed93fc85c7b82487d4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f125a24c6cf347a3b296a2906556be7a",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_e618cb21d1d6458ca0374e8618dd4ca8",
"value": 100
}
},
"0aa16e4c1d1d4059841e36d8b325971f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2ddf420ed3dc4d429495f5ba7f922956",
"placeholder": "",
"style": "IPY_MODEL_1516a50c3d4342f693aefe40460d6dd2",
"value": " 100/100 [00:01<00:00, 95.69it/s]"
}
},
"9fd3dc999c6d4270a9ecfe2d8e8f5e1d": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"6ec9be16d0354a8d87c177f2f68c49da": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"10a3331d6fec4345a45b8f8f9d0a8146": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"f125a24c6cf347a3b296a2906556be7a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e618cb21d1d6458ca0374e8618dd4ca8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"2ddf420ed3dc4d429495f5ba7f922956": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1516a50c3d4342f693aefe40460d6dd2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"2a723646e62b4dd0b4f147b66b704a02": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_7f56935b36514d2980be356a24f24b84",
"IPY_MODEL_dfcfb947b6824327a3aeeb6461e06165",
"IPY_MODEL_8118d9ea4ff74f60819e662d8d5df91f"
],
"layout": "IPY_MODEL_8994340799334930b1cd7409ae0b0727"
}
},
"7f56935b36514d2980be356a24f24b84": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_90169b29d6014841a489708e49a74083",
"placeholder": "",
"style": "IPY_MODEL_0776cd338bc1482f965b660491c6afd0",
"value": "1st loop: 100%"
}
},
"dfcfb947b6824327a3aeeb6461e06165": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e0cd072898dd47c5a217204603ad31c7",
"max": 4,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_75b1e79b2bfa42f0a92507207515c487",
"value": 4
}
},
"8118d9ea4ff74f60819e662d8d5df91f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_b474aa16bfd54d168f294424bfee7fe8",
"placeholder": "",
"style": "IPY_MODEL_a340f22aac384496a41d9a645ffcb7b7",
"value": " 4/4 [00:04<00:00, 1.06s/it]"
}
},
"8994340799334930b1cd7409ae0b0727": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"90169b29d6014841a489708e49a74083": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"0776cd338bc1482f965b660491c6afd0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"e0cd072898dd47c5a217204603ad31c7": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"75b1e79b2bfa42f0a92507207515c487": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"b474aa16bfd54d168f294424bfee7fe8": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a340f22aac384496a41d9a645ffcb7b7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"46b5e5dda0304f758c60b6f94051325f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_d0df97328d7b433dbb72b61b9743a34c",
"IPY_MODEL_8268fc90ebd94eab8dddfc11e1bb1aa2",
"IPY_MODEL_220049b6b28d405b9d1010805501f50f"
],
"layout": "IPY_MODEL_dc194839fc494e5d925d26561f9b32e3"
}
},
"d0df97328d7b433dbb72b61b9743a34c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2014f467dc8249e09936b3dff8a4e95e",
"placeholder": "",
"style": "IPY_MODEL_10abace2675141db9dcdf6ed9dd7a218",
"value": "2nd loop: 100%"
}
},
"8268fc90ebd94eab8dddfc11e1bb1aa2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_ef47ccd577ea49a98c99ab3721c3a7f7",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_e7075953580844248beb6a73c7b3bc36",
"value": 100
}
},
"220049b6b28d405b9d1010805501f50f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_3dbd6933866c45e7b71f0e7c9b22ad02",
"placeholder": "",
"style": "IPY_MODEL_03914bef2ebb436ab254aa4f315009e1",
"value": " 100/100 [00:01<00:00, 96.32it/s]"
}
},
"dc194839fc494e5d925d26561f9b32e3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2014f467dc8249e09936b3dff8a4e95e": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"10abace2675141db9dcdf6ed9dd7a218": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"ef47ccd577ea49a98c99ab3721c3a7f7": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e7075953580844248beb6a73c7b3bc36": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"3dbd6933866c45e7b71f0e7c9b22ad02": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"03914bef2ebb436ab254aa4f315009e1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"2f7c7946c1fc40388172d25cd16d3f7e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_c2bfc664050b47d888888b8bb0fc08ef",
"IPY_MODEL_8ebdf5f0455c489ca970872f0670f1ee",
"IPY_MODEL_18c4539041eb48e1a6fc3be4a251eb10"
],
"layout": "IPY_MODEL_1f77f1cc085d423a9580200e96c34758"
}
},
"c2bfc664050b47d888888b8bb0fc08ef": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_9198335e467b43f3b8690c5bbaf58618",
"placeholder": "",
"style": "IPY_MODEL_5f6ad924e3dd45d5821e33dbc0249f1c",
"value": "2nd loop: 100%"
}
},
"8ebdf5f0455c489ca970872f0670f1ee": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_71a02681e9264458b860ecca3fb7e69c",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_a59b6f2054dc4e948180bfd09d0ba00b",
"value": 100
}
},
"18c4539041eb48e1a6fc3be4a251eb10": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_1c2a20f640f242feb3e54612df97f56a",
"placeholder": "",
"style": "IPY_MODEL_e3e89e68dc3d4144a9cf20ad8257a9d4",
"value": " 100/100 [00:01<00:00, 95.50it/s]"
}
},
"1f77f1cc085d423a9580200e96c34758": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"9198335e467b43f3b8690c5bbaf58618": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"5f6ad924e3dd45d5821e33dbc0249f1c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"71a02681e9264458b860ecca3fb7e69c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a59b6f2054dc4e948180bfd09d0ba00b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"1c2a20f640f242feb3e54612df97f56a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e3e89e68dc3d4144a9cf20ad8257a9d4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"4d288466b05f48728173f1351087d17c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_c4560d87d77a44ed9b5ebdbf994375c6",
"IPY_MODEL_a9ad6adbb75447a6884c12a8e7ced40a",
"IPY_MODEL_02a9a607bc4041f4ac417118d866b608"
],
"layout": "IPY_MODEL_19f3115c55c24bef93ae99e8c5c45529"
}
},
"c4560d87d77a44ed9b5ebdbf994375c6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_d6b6d63fe6ed4cb58659ae2711c5a94f",
"placeholder": "",
"style": "IPY_MODEL_d4e641c56552460c87905887e70829c2",
"value": "2nd loop: 100%"
}
},
"a9ad6adbb75447a6884c12a8e7ced40a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_385c2a546fc244f688bfdf32047b2ee3",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_a465664b6da74a9b9913164c05890785",
"value": 100
}
},
"02a9a607bc4041f4ac417118d866b608": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_384f5336a7f949c586744448645f05df",
"placeholder": "",
"style": "IPY_MODEL_b7454e3fc74b4b00b96f407748ec88f2",
"value": " 100/100 [00:01<00:00, 97.21it/s]"
}
},
"19f3115c55c24bef93ae99e8c5c45529": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"d6b6d63fe6ed4cb58659ae2711c5a94f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"d4e641c56552460c87905887e70829c2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"385c2a546fc244f688bfdf32047b2ee3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a465664b6da74a9b9913164c05890785": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"384f5336a7f949c586744448645f05df": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b7454e3fc74b4b00b96f407748ec88f2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"9677ba9be9d143b2930801e7b88f38d3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_d0007ff716e04689855fee5ee46f5d11",
"IPY_MODEL_a622553bbe27473dbc5c5b98e9ee7fc6",
"IPY_MODEL_f9876579fc9f4273aa4666944675c22a"
],
"layout": "IPY_MODEL_ab7d4ac726f34d348159d82b8cceb6e1"
}
},
"d0007ff716e04689855fee5ee46f5d11": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_29e2fa26a1994d57a2c04a8e2dc1c1af",
"placeholder": "",
"style": "IPY_MODEL_2940b68710a34f449e8c37f4fff9b8fc",
"value": "2nd loop: 100%"
}
},
"a622553bbe27473dbc5c5b98e9ee7fc6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_7ec17ed3d1c148b0920358d15a61c3d3",
"max": 100,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_f8aab6bc3841431e89899f78a149de09",
"value": 100
}
},
"f9876579fc9f4273aa4666944675c22a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_077e73ca35334ea993803d0184fa8259",
"placeholder": "",
"style": "IPY_MODEL_c99f9790d8ab4455b7cc4cc0761fbe15",
"value": " 100/100 [00:01<00:00, 97.15it/s]"
}
},
"ab7d4ac726f34d348159d82b8cceb6e1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"29e2fa26a1994d57a2c04a8e2dc1c1af": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2940b68710a34f449e8c37f4fff9b8fc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"7ec17ed3d1c148b0920358d15a61c3d3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"f8aab6bc3841431e89899f78a149de09": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"077e73ca35334ea993803d0184fa8259": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c99f9790d8ab4455b7cc4cc0761fbe15": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"d9b31269f6a44179ae92bf432bd54c5b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_91af54bc0c9e49629a65cacf67bda104",
"IPY_MODEL_b21f17e916c94580b7cfd25805d26323",
"IPY_MODEL_3162987da282497bb2f2821cc8f292c7"
],
"layout": "IPY_MODEL_ab3eaed1d20547628991f415d5adad0c"
}
},
"91af54bc0c9e49629a65cacf67bda104": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_545c51443b2a443d9d37eb10b18d35cc",
"placeholder": "",
"style": "IPY_MODEL_b32c0170cc1a4dff91ff074d123f9d52",
"value": "100%"
}
},
"b21f17e916c94580b7cfd25805d26323": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f0001ddf3d4a45d2869803414894c983",
"max": 10,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_e73c46a77b91498980a942d778d961ba",
"value": 10
}
},
"3162987da282497bb2f2821cc8f292c7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_dbd2d97b660d4c9d9de92471b1796331",
"placeholder": "",
"style": "IPY_MODEL_1db4bc7a804e41b7838bc069695eddf5",
"value": " 10/10 [00:05<00:00, 1.99it/s]"
}
},
"ab3eaed1d20547628991f415d5adad0c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"545c51443b2a443d9d37eb10b18d35cc": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b32c0170cc1a4dff91ff074d123f9d52": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"f0001ddf3d4a45d2869803414894c983": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e73c46a77b91498980a942d778d961ba": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"dbd2d97b660d4c9d9de92471b1796331": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1db4bc7a804e41b7838bc069695eddf5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"6112246249584fb2a73cbd6e5086c89a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_f0f7078f01c1405ab75ef477a106cb36",
"IPY_MODEL_bf947e1161974b07af1bc216fa50b2aa",
"IPY_MODEL_ce038aec570a478c8fd770a7f074722f"
],
"layout": "IPY_MODEL_44c1cbfc30b64530a84c464ad263e8df"
}
},
"f0f7078f01c1405ab75ef477a106cb36": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_b00f63067158418db9527771958313c4",
"placeholder": "",
"style": "IPY_MODEL_c337f94c20f140cab906d51a2890da49",
"value": "Loop 1: 100%"
}
},
"bf947e1161974b07af1bc216fa50b2aa": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_40af719cb62c49c2a1632876b2ae865f",
"max": 2,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_034ed767050d41c7937b0476bfdb3c87",
"value": 2
}
},
"ce038aec570a478c8fd770a7f074722f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_5e1bf1ec9d6048e2b553a72bb3777b0a",
"placeholder": "",
"style": "IPY_MODEL_58cdd4903a62471d9ecec9cf40fc0d7a",
"value": " 2/2 [00:05<00:00, 2.55s/it]"
}
},
"44c1cbfc30b64530a84c464ad263e8df": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b00f63067158418db9527771958313c4": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c337f94c20f140cab906d51a2890da49": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"40af719cb62c49c2a1632876b2ae865f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"034ed767050d41c7937b0476bfdb3c87": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"5e1bf1ec9d6048e2b553a72bb3777b0a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"58cdd4903a62471d9ecec9cf40fc0d7a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"7ec0f3f7a707490da8becdb283ad3b9f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_3cd168f631ae4ad7be7d36c0ae813c73",
"IPY_MODEL_78903c3560be4623acce5faf7d4a3ad8",
"IPY_MODEL_3280d0e326ad4a779126819711c92e5c"
],
"layout": "IPY_MODEL_e2d46d21e9534ba49d5bee5f8aa3050e"
}
},
"3cd168f631ae4ad7be7d36c0ae813c73": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_d76b0dac3b4c4b358846f5600e439e85",
"placeholder": "",
"style": "IPY_MODEL_77a56e87b70e4d7aa22ca1cf7e575c04",
"value": "Loop 2: 100%"
}
},
"78903c3560be4623acce5faf7d4a3ad8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_ebdc3f6de85c4b0282da3334f73cfabc",
"max": 5,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_276f4f8d45ed4f568c08093803d3ae50",
"value": 5
}
},
"3280d0e326ad4a779126819711c92e5c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2bf2bbe865c14190b24c1c0e566d4044",
"placeholder": "",
"style": "IPY_MODEL_c2d09620e1e447988e2136a493af25c3",
"value": " 5/5 [00:02<00:00, 1.98it/s]"
}
},
"e2d46d21e9534ba49d5bee5f8aa3050e": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"d76b0dac3b4c4b358846f5600e439e85": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"77a56e87b70e4d7aa22ca1cf7e575c04": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"ebdc3f6de85c4b0282da3334f73cfabc": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"276f4f8d45ed4f568c08093803d3ae50": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"2bf2bbe865c14190b24c1c0e566d4044": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c2d09620e1e447988e2136a493af25c3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"3ebff4dd167448a4bce6f6bf21760c1e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_e8274af5bb9944bda83685457191eed5",
"IPY_MODEL_0904a06cda6f491c943416e11ad262ae",
"IPY_MODEL_9e597674145246fba1e2813aa5722ea7"
],
"layout": "IPY_MODEL_631ecaafa15d44d6b45a0182f5427e29"
}
},
"e8274af5bb9944bda83685457191eed5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_a7afbf7a190d412a8a1531576e84383f",
"placeholder": "",
"style": "IPY_MODEL_9af068e5e72743dcbc18ed9f6dde794e",
"value": "Loop 2: 100%"
}
},
"0904a06cda6f491c943416e11ad262ae": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_a0eb297817774dd8a45e506109c068cd",
"max": 5,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_cf27a49e481e47048174be88277fe3be",
"value": 5
}
},
"9e597674145246fba1e2813aa5722ea7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_313edfa26f8f43a6835dc5eeb390c152",
"placeholder": "",
"style": "IPY_MODEL_a914c7dd6ef64656a6ca0287af2b6c36",
"value": " 5/5 [00:02<00:00, 1.99it/s]"
}
},
"631ecaafa15d44d6b45a0182f5427e29": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a7afbf7a190d412a8a1531576e84383f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"9af068e5e72743dcbc18ed9f6dde794e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"a0eb297817774dd8a45e506109c068cd": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"cf27a49e481e47048174be88277fe3be": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"313edfa26f8f43a6835dc5eeb390c152": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a914c7dd6ef64656a6ca0287af2b6c36": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
}
}
}
},
"nbformat": 4,
"nbformat_minor": 0
} |