File size: 24,642 Bytes
5ab8a9f |
1 |
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyN7XBdrJC7vDkLfGHN21HeS"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","source":["# `Module and Packages`"],"metadata":{"id":"Z37XvMpG7ZcS"}},{"cell_type":"markdown","source":["# Importing standard modules"],"metadata":{"id":"Id_Y3wQX7bR2"}},{"cell_type":"code","execution_count":5,"metadata":{"id":"hZsqY54c7SWg","executionInfo":{"status":"ok","timestamp":1735400786328,"user_tz":-360,"elapsed":513,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"outputs":[],"source":["# Basic Syntax for Importing Modules\n","\n","# Importing an entire module\n","import tensorflow\n","\n","# Importing a specific function or class from a module\n","from tensorflow import keras\n","\n","# Importing a module and aliasing it\n","import tensorflow as tf\n","\n","# Importing multiple functions or classes from a module\n","from tensorflow import keras, initializers"]},{"cell_type":"code","source":["# Importing an Entire Module\n","import math\n","\n","result = math.sqrt(25)\n","print(result)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"AMMUiM8I8uag","executionInfo":{"status":"ok","timestamp":1735400847620,"user_tz":-360,"elapsed":503,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"7abed226-188a-4430-ab3c-1cbf7c92a18c"},"execution_count":9,"outputs":[{"output_type":"stream","name":"stdout","text":["5.0\n"]}]},{"cell_type":"code","source":["# Importing Specific Functions or Classes\n","from math import sqrt\n","\n","result = sqrt(25)\n","print(result)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"jFlFmUfd8xr9","executionInfo":{"status":"ok","timestamp":1735400876052,"user_tz":-360,"elapsed":9,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"d75bbe63-062e-4857-eb3f-f7eb5bb2456c"},"execution_count":10,"outputs":[{"output_type":"stream","name":"stdout","text":["5.0\n"]}]},{"cell_type":"code","source":["# Importing with Aliases\n","import math as m\n","\n","result = m.sqrt(25)\n","print(result)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"CFtYL04K9Lyv","executionInfo":{"status":"ok","timestamp":1735400973104,"user_tz":-360,"elapsed":563,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"bee3d0fb-1931-46a7-a553-35be48ddeea1"},"execution_count":11,"outputs":[{"output_type":"stream","name":"stdout","text":["5.0\n"]}]},{"cell_type":"code","source":["# Importing Multiple Functions or Classes\n","from math import sqrt, pi\n","\n","print(sqrt(16))\n","print(pi)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ez3jJY5N9V3Y","executionInfo":{"status":"ok","timestamp":1735401020635,"user_tz":-360,"elapsed":547,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"e82a131d-501b-49a7-c41b-7b859d9c3199"},"execution_count":12,"outputs":[{"output_type":"stream","name":"stdout","text":["4.0\n","3.141592653589793\n"]}]},{"cell_type":"markdown","source":["**Commonly Used Standard Python Modules**"],"metadata":{"id":"dcCpQQ2C9zwT"}},{"cell_type":"code","source":["# math - Mathematical operations (e.g., sqrt(), pow(), sin(), cos()).\n","import math\n","print(math.pi)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"rVerNP8w9iQd","executionInfo":{"status":"ok","timestamp":1735401148977,"user_tz":-360,"elapsed":595,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"5811dd60-235e-4588-c6a8-1a1924b5581e"},"execution_count":13,"outputs":[{"output_type":"stream","name":"stdout","text":["3.141592653589793\n"]}]},{"cell_type":"code","source":["# os - Interacting with the operating system (e.g., file management, directory structure).\n","import os\n","print(os.getcwd())"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"edCtiYxB-DLr","executionInfo":{"status":"ok","timestamp":1735401184386,"user_tz":-360,"elapsed":574,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"3f2b77a4-584e-495f-bee6-0ec4fa9f6c87"},"execution_count":14,"outputs":[{"output_type":"stream","name":"stdout","text":["/content\n"]}]},{"cell_type":"code","source":["# sys - Provides access to system-specific parameters and functions.\n","import sys\n","print(sys.version)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"X1yAaIRa-Jct","executionInfo":{"status":"ok","timestamp":1735401281841,"user_tz":-360,"elapsed":523,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"0212f863-c35e-4307-f495-c0d33b328d28"},"execution_count":15,"outputs":[{"output_type":"stream","name":"stdout","text":["3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]\n"]}]},{"cell_type":"code","source":["# random - Random number generation (e.g., randint(), choice()).\n","import random\n","print(random.randint(1, 100))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"SwHULM9_-hQI","executionInfo":{"status":"ok","timestamp":1735401329286,"user_tz":-360,"elapsed":544,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"27b37140-b489-4607-f0d1-4fb98dae5fb8"},"execution_count":17,"outputs":[{"output_type":"stream","name":"stdout","text":["59\n"]}]},{"cell_type":"code","source":["# time - Time-related functions (e.g., sleep(), time()).\n","import time\n","print(time.time())"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"8WjAC1U3-r7M","executionInfo":{"status":"ok","timestamp":1735402009119,"user_tz":-360,"elapsed":533,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"341b6e00-72b0-447d-e422-e570b39fdb83"},"execution_count":18,"outputs":[{"output_type":"stream","name":"stdout","text":["1735402009.4303534\n"]}]},{"cell_type":"code","source":["# datetime - Work with dates and times (e.g., datetime.now(), timedelta).\n","import datetime\n","print(datetime.datetime.now())"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"GAnwwYurBSzy","executionInfo":{"status":"ok","timestamp":1735402050961,"user_tz":-360,"elapsed":556,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"a1ae7c0f-26e8-48ba-ef9c-12c14b5cfbc9"},"execution_count":19,"outputs":[{"output_type":"stream","name":"stdout","text":["2024-12-28 16:07:31.230078\n"]}]},{"cell_type":"code","source":["# json - JSON parsing and serialization.\n","import json\n","data = {'name': 'Alice', 'age': 25, 'Student':True}\n","json_str = json.dumps(data)\n","print(json_str)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"bPdZewRRBdBI","executionInfo":{"status":"ok","timestamp":1735402166126,"user_tz":-360,"elapsed":499,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"50ad63fe-3938-411d-cb2b-a2833dde1710"},"execution_count":22,"outputs":[{"output_type":"stream","name":"stdout","text":["{\"name\": \"Alice\", \"age\": 25, \"Student\": true}\n"]}]},{"cell_type":"code","source":["# re - Regular expressions for pattern matching.\n","import re\n","pattern = r\"\\d+\"\n","text = \"There are 123 apples.\"\n","match = re.search(pattern, text)\n","if match:\n"," print(match.group())"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"3myRsdzBBhUQ","executionInfo":{"status":"ok","timestamp":1735402265106,"user_tz":-360,"elapsed":549,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"6ab711dc-3683-4777-de64-152e808ecb27"},"execution_count":25,"outputs":[{"output_type":"stream","name":"stdout","text":["123\n"]}]},{"cell_type":"code","source":["# collections - Specialized container datatypes (e.g., Counter, deque, defaultdict).\n","from collections import Counter\n","counts = Counter([1, 2, 2, 3, 3, 3])\n","print(counts)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ENfMSfgTCWDK","executionInfo":{"status":"ok","timestamp":1735402358246,"user_tz":-360,"elapsed":502,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"6465c064-37e3-49bb-e9f4-df5bd6e4077e"},"execution_count":26,"outputs":[{"output_type":"stream","name":"stdout","text":["Counter({3: 3, 2: 2, 1: 1})\n"]}]},{"cell_type":"code","source":["# Importing Multiple Modules\n","import math, sys, os"],"metadata":{"id":"nvXRP2MnCoBk","executionInfo":{"status":"ok","timestamp":1735406047156,"user_tz":-360,"elapsed":582,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"execution_count":27,"outputs":[]},{"cell_type":"code","source":["# Importing Submodules\n","import matplotlib.pyplot as plt"],"metadata":{"id":"RyTSRkfaQvkc","executionInfo":{"status":"ok","timestamp":1735406069368,"user_tz":-360,"elapsed":4,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"execution_count":28,"outputs":[]},{"cell_type":"markdown","source":["# Creating custom modules"],"metadata":{"id":"ERWFrzHzQ352"}},{"cell_type":"code","source":["# Create the Module (math_operations.py)\n","\n","def add(x, y):\n"," return x + y\n","\n","def subtract(x, y):\n"," return x - y\n","\n","def multiply(x, y):\n"," return x * y\n","\n","def divide(x, y):\n"," if y == 0:\n"," raise ValueError(\"Cannot divide by zero\")\n"," return x / y"],"metadata":{"id":"Y_MeOp0RQ6Gl","executionInfo":{"status":"ok","timestamp":1735406245536,"user_tz":-360,"elapsed":502,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"execution_count":29,"outputs":[]},{"cell_type":"code","source":["# Import the Module (main.py)\n","\n","# import math_operations\n","\n","# a = 10\n","# b = 5\n","\n","# print(\"Addition:\", math_operations.add(a, b))\n","# print(\"Subtraction:\", math_operations.subtract(a, b))\n","# print(\"Multiplication:\", math_operations.multiply(a, b))\n","# print(\"Division:\", math_operations.divide(a, b))\n"],"metadata":{"id":"TkPJzVLwRi_g","executionInfo":{"status":"ok","timestamp":1735406391004,"user_tz":-360,"elapsed":592,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"execution_count":30,"outputs":[]},{"cell_type":"markdown","source":["# Overview of popular packages (NumPy, Pandas)"],"metadata":{"id":"4R4kk1nASn4f"}},{"cell_type":"code","source":["import numpy as np\n","\n","# Create a NumPy array\n","arr = np.array([1, 2, 3, 4, 5])\n","\n","# Basic mathematical operations\n","arr_sum = np.sum(arr)\n","arr_mean = np.mean(arr)\n","arr_max = np.max(arr)\n","\n","# Element-wise operations (vectorized)\n","arr_squared = arr ** 2\n","\n","# Reshaping arrays\n","arr_reshaped = arr.reshape((1, 5))\n","\n","# Create a 2D array (matrix)\n","matrix = np.array([[1, 2], [3, 4]])\n","\n","# Matrix multiplication\n","result = np.dot(matrix, matrix)"],"metadata":{"id":"KIfIdM9nSpbp","executionInfo":{"status":"ok","timestamp":1735406573453,"user_tz":-360,"elapsed":544,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}}},"execution_count":31,"outputs":[]},{"cell_type":"code","source":["import pandas as pd\n","\n","# Create a DataFrame from a dictionary\n","data = {\n"," 'Name': ['Alice', 'Bob', 'Charlie', 'David'],\n"," 'Age': [24, 27, 22, 32],\n"," 'Salary': [50000, 55000, 40000, 60000]\n","}\n","df = pd.DataFrame(data)\n","\n","# View the first few rows of the DataFrame\n","df.head()\n","\n","# Filter rows based on conditions\n","df_filtered = df[df['Age'] > 25]\n","\n","# Grouping data and calculating aggregate statistics\n","df_grouped = df.groupby('Age')['Salary'].mean()\n","\n","# Sorting data\n","df_sorted = df.sort_values(by='Salary', ascending=False)\n","\n","# Handle missing data\n","df_filled = df.fillna(0)\n","\n","# Write data to a CSV file\n","df.to_csv('data.csv', index=False)\n","\n","# Read data from a CSV file\n","df_csv = pd.read_csv('data.csv')\n","df_csv"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":174},"id":"TA3AIsbVSt5j","executionInfo":{"status":"ok","timestamp":1735406669066,"user_tz":-360,"elapsed":20,"user":{"displayName":"44-271-Munsi Walid Al Hassan Nizhu","userId":"16216461530557409787"}},"outputId":"1308257c-306f-4856-9e2e-42055bc516ff"},"execution_count":34,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" Name Age Salary\n","0 Alice 24 50000\n","1 Bob 27 55000\n","2 Charlie 22 40000\n","3 David 32 60000"],"text/html":["\n"," <div id=\"df-75464680-d1d4-4e5a-8cad-0cdfc832791f\" class=\"colab-df-container\">\n"," <div>\n","<style scoped>\n"," .dataframe tbody tr th:only-of-type {\n"," vertical-align: middle;\n"," }\n","\n"," .dataframe tbody tr th {\n"," vertical-align: top;\n"," }\n","\n"," .dataframe thead th {\n"," text-align: right;\n"," }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n"," <thead>\n"," <tr style=\"text-align: right;\">\n"," <th></th>\n"," <th>Name</th>\n"," <th>Age</th>\n"," <th>Salary</th>\n"," </tr>\n"," </thead>\n"," <tbody>\n"," <tr>\n"," <th>0</th>\n"," <td>Alice</td>\n"," <td>24</td>\n"," <td>50000</td>\n"," </tr>\n"," <tr>\n"," <th>1</th>\n"," <td>Bob</td>\n"," <td>27</td>\n"," <td>55000</td>\n"," </tr>\n"," <tr>\n"," <th>2</th>\n"," <td>Charlie</td>\n"," <td>22</td>\n"," <td>40000</td>\n"," </tr>\n"," <tr>\n"," <th>3</th>\n"," <td>David</td>\n"," <td>32</td>\n"," <td>60000</td>\n"," </tr>\n"," </tbody>\n","</table>\n","</div>\n"," <div class=\"colab-df-buttons\">\n","\n"," <div class=\"colab-df-container\">\n"," <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-75464680-d1d4-4e5a-8cad-0cdfc832791f')\"\n"," title=\"Convert this dataframe to an interactive table.\"\n"," style=\"display:none;\">\n","\n"," <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n"," <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n"," </svg>\n"," </button>\n","\n"," <style>\n"," .colab-df-container {\n"," display:flex;\n"," gap: 12px;\n"," }\n","\n"," .colab-df-convert {\n"," background-color: #E8F0FE;\n"," border: none;\n"," border-radius: 50%;\n"," cursor: pointer;\n"," display: none;\n"," fill: #1967D2;\n"," height: 32px;\n"," padding: 0 0 0 0;\n"," width: 32px;\n"," }\n","\n"," .colab-df-convert:hover {\n"," background-color: #E2EBFA;\n"," box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n"," fill: #174EA6;\n"," }\n","\n"," .colab-df-buttons div {\n"," margin-bottom: 4px;\n"," }\n","\n"," [theme=dark] .colab-df-convert {\n"," background-color: #3B4455;\n"," fill: #D2E3FC;\n"," }\n","\n"," [theme=dark] .colab-df-convert:hover {\n"," background-color: #434B5C;\n"," box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n"," filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n"," fill: #FFFFFF;\n"," }\n"," </style>\n","\n"," <script>\n"," const buttonEl =\n"," document.querySelector('#df-75464680-d1d4-4e5a-8cad-0cdfc832791f button.colab-df-convert');\n"," buttonEl.style.display =\n"," google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n"," async function convertToInteractive(key) {\n"," const element = document.querySelector('#df-75464680-d1d4-4e5a-8cad-0cdfc832791f');\n"," const dataTable =\n"," await google.colab.kernel.invokeFunction('convertToInteractive',\n"," [key], {});\n"," if (!dataTable) return;\n","\n"," const docLinkHtml = 'Like what you see? Visit the ' +\n"," '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n"," + ' to learn more about interactive tables.';\n"," element.innerHTML = '';\n"," dataTable['output_type'] = 'display_data';\n"," await google.colab.output.renderOutput(dataTable, element);\n"," const docLink = document.createElement('div');\n"," docLink.innerHTML = docLinkHtml;\n"," element.appendChild(docLink);\n"," }\n"," </script>\n"," </div>\n","\n","\n","<div id=\"df-a9e455ba-95cd-470c-9760-e4af5161a0b2\">\n"," <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-a9e455ba-95cd-470c-9760-e4af5161a0b2')\"\n"," title=\"Suggest charts\"\n"," style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n"," width=\"24px\">\n"," <g>\n"," <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n"," </g>\n","</svg>\n"," </button>\n","\n","<style>\n"," .colab-df-quickchart {\n"," --bg-color: #E8F0FE;\n"," --fill-color: #1967D2;\n"," --hover-bg-color: #E2EBFA;\n"," --hover-fill-color: #174EA6;\n"," --disabled-fill-color: #AAA;\n"," --disabled-bg-color: #DDD;\n"," }\n","\n"," [theme=dark] .colab-df-quickchart {\n"," --bg-color: #3B4455;\n"," --fill-color: #D2E3FC;\n"," --hover-bg-color: #434B5C;\n"," --hover-fill-color: #FFFFFF;\n"," --disabled-bg-color: #3B4455;\n"," --disabled-fill-color: #666;\n"," }\n","\n"," .colab-df-quickchart {\n"," background-color: var(--bg-color);\n"," border: none;\n"," border-radius: 50%;\n"," cursor: pointer;\n"," display: none;\n"," fill: var(--fill-color);\n"," height: 32px;\n"," padding: 0;\n"," width: 32px;\n"," }\n","\n"," .colab-df-quickchart:hover {\n"," background-color: var(--hover-bg-color);\n"," box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n"," fill: var(--button-hover-fill-color);\n"," }\n","\n"," .colab-df-quickchart-complete:disabled,\n"," .colab-df-quickchart-complete:disabled:hover {\n"," background-color: var(--disabled-bg-color);\n"," fill: var(--disabled-fill-color);\n"," box-shadow: none;\n"," }\n","\n"," .colab-df-spinner {\n"," border: 2px solid var(--fill-color);\n"," border-color: transparent;\n"," border-bottom-color: var(--fill-color);\n"," animation:\n"," spin 1s steps(1) infinite;\n"," }\n","\n"," @keyframes spin {\n"," 0% {\n"," border-color: transparent;\n"," border-bottom-color: var(--fill-color);\n"," border-left-color: var(--fill-color);\n"," }\n"," 20% {\n"," border-color: transparent;\n"," border-left-color: var(--fill-color);\n"," border-top-color: var(--fill-color);\n"," }\n"," 30% {\n"," border-color: transparent;\n"," border-left-color: var(--fill-color);\n"," border-top-color: var(--fill-color);\n"," border-right-color: var(--fill-color);\n"," }\n"," 40% {\n"," border-color: transparent;\n"," border-right-color: var(--fill-color);\n"," border-top-color: var(--fill-color);\n"," }\n"," 60% {\n"," border-color: transparent;\n"," border-right-color: var(--fill-color);\n"," }\n"," 80% {\n"," border-color: transparent;\n"," border-right-color: var(--fill-color);\n"," border-bottom-color: var(--fill-color);\n"," }\n"," 90% {\n"," border-color: transparent;\n"," border-bottom-color: var(--fill-color);\n"," }\n"," }\n","</style>\n","\n"," <script>\n"," async function quickchart(key) {\n"," const quickchartButtonEl =\n"," document.querySelector('#' + key + ' button');\n"," quickchartButtonEl.disabled = true; // To prevent multiple clicks.\n"," quickchartButtonEl.classList.add('colab-df-spinner');\n"," try {\n"," const charts = await google.colab.kernel.invokeFunction(\n"," 'suggestCharts', [key], {});\n"," } catch (error) {\n"," console.error('Error during call to suggestCharts:', error);\n"," }\n"," quickchartButtonEl.classList.remove('colab-df-spinner');\n"," quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n"," }\n"," (() => {\n"," let quickchartButtonEl =\n"," document.querySelector('#df-a9e455ba-95cd-470c-9760-e4af5161a0b2 button');\n"," quickchartButtonEl.style.display =\n"," google.colab.kernel.accessAllowed ? 'block' : 'none';\n"," })();\n"," </script>\n","</div>\n","\n"," <div id=\"id_094caba6-abb2-4008-acbe-084a4adb234d\">\n"," <style>\n"," .colab-df-generate {\n"," background-color: #E8F0FE;\n"," border: none;\n"," border-radius: 50%;\n"," cursor: pointer;\n"," display: none;\n"," fill: #1967D2;\n"," height: 32px;\n"," padding: 0 0 0 0;\n"," width: 32px;\n"," }\n","\n"," .colab-df-generate:hover {\n"," background-color: #E2EBFA;\n"," box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n"," fill: #174EA6;\n"," }\n","\n"," [theme=dark] .colab-df-generate {\n"," background-color: #3B4455;\n"," fill: #D2E3FC;\n"," }\n","\n"," [theme=dark] .colab-df-generate:hover {\n"," background-color: #434B5C;\n"," box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n"," filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n"," fill: #FFFFFF;\n"," }\n"," </style>\n"," <button class=\"colab-df-generate\" onclick=\"generateWithVariable('df_csv')\"\n"," title=\"Generate code using this dataframe.\"\n"," style=\"display:none;\">\n","\n"," <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n"," width=\"24px\">\n"," <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n"," </svg>\n"," </button>\n"," <script>\n"," (() => {\n"," const buttonEl =\n"," document.querySelector('#id_094caba6-abb2-4008-acbe-084a4adb234d button.colab-df-generate');\n"," buttonEl.style.display =\n"," google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n"," buttonEl.onclick = () => {\n"," google.colab.notebook.generateWithVariable('df_csv');\n"," }\n"," })();\n"," </script>\n"," </div>\n","\n"," </div>\n"," </div>\n"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"dataframe","variable_name":"df_csv","summary":"{\n \"name\": \"df_csv\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"Bob\",\n \"David\",\n \"Alice\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Age\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4,\n \"min\": 22,\n \"max\": 32,\n \"num_unique_values\": 4,\n \"samples\": [\n 27,\n 32,\n 24\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Salary\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8539,\n \"min\": 40000,\n \"max\": 60000,\n \"num_unique_values\": 4,\n \"samples\": [\n 55000,\n 60000,\n 50000\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"}},"metadata":{},"execution_count":34}]}]} |