[
  {
    "path": ".gitignore",
    "content": "env\n\n# Created by https://www.gitignore.io/api/python,visualstudiocode\n# Edit at https://www.gitignore.io/?templates=python,visualstudiocode\n\n### Python ###\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\npip-wheel-metadata/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n.hypothesis/\n.pytest_cache/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# IPython\nprofile_default/\nipython_config.py\n\n# pyenv\n.python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don’t work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# celery beat schedule file\ncelerybeat-schedule\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n### VisualStudioCode ###\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n\n### VisualStudioCode Patch ###\n# Ignore all local history of files\n.history\n\n# End of https://www.gitignore.io/api/python,visualstudiocode\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Microsoft Open Source Code of Conduct\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/?WT.mc_id=python-c9-niner).\r\n\r\nResources:\r\n\r\n- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/?WT.mc_id=python-c9-niner)\r\n- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/?WT.mc_id=python-c9-niner)\r\n- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com?WT.mc_id=python-c9-niner) with questions or concerns\r\n"
  },
  {
    "path": "LICENSE",
    "content": "    MIT License\r\n\r\n    Copyright (c) Microsoft Corporation.\r\n\r\n    Permission is hereby granted, free of charge, to any person obtaining a copy\r\n    of this software and associated documentation files (the \"Software\"), to deal\r\n    in the Software without restriction, including without limitation the rights\r\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n    copies of the Software, and to permit persons to whom the Software is\r\n    furnished to do so, subject to the following conditions:\r\n\r\n    The above copyright notice and this permission notice shall be included in all\r\n    copies or substantial portions of the Software.\r\n\r\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n    SOFTWARE\r\n"
  },
  {
    "path": "README.md",
    "content": "# Getting started with Python\r\n\r\n## Overview\r\n\r\nThese three series on Channel 9 and YouTube are designed to help get you up to speed on Python. If you're a beginning developer looking to add Python to your quiver of languages or trying to get started on data science or web project which uses Python, these videos are here to help show you the foundations necessary to walk through a tutorial or other quick start.\r\n\r\nWe do assume you are familiar with another programming language, and some core programming concepts. For example, we highlight the syntax for boolean expressions and creating classes, but we don't dig into what a [boolean](https://en.wikipedia.org/wiki/Boolean_data_type) is or [object oriented design](https://en.wikipedia.org/wiki/Object-oriented_design). We show you how to perform the tasks you're familiar with in other languages in Python.\r\n\r\n### What you'll learn\r\n\r\n- The basics of Python\r\n- Common syntax\r\n- Popular packages\r\n\r\n## Prerequisites\r\n\r\n- Light experience with another programming language, such as [JavaScript](https://www.edx.org/course/javascript-introduction), [Java](https://www.java.com) or [C#](https://docs.microsoft.com/dotnet/csharp/)\r\n- [An understanding of Git](https://git-scm.com/book/en/v1/Getting-Started)\r\n\r\n## Courses\r\n\r\n### Getting started\r\n\r\n[Python for beginners](https://aka.ms/pythonbeginnerseries) is the perfect starting location for getting started. No Python experience is required! We'll show you how to set up [Visual Studio Code](https://code.visualstudio.com?WT.mc_id=python-c9-niner) as your code editor, and start creating Python code. You'll see how to manage create, structure and run your code, how to manage packages, and even make [REST calls](https://en.wikipedia.org/wiki/Representational_state_transfer).\r\n\r\n### Dig a little deeper\r\n\r\n[More Python for beginners](https://aka.ms/morepython) digs deeper into Python syntax. You'll explore how to create classes and mixins in Python, how to work with the file system, and introduce `async/await`. This is the perfect next step if you're looking to see a bit more of what Python can do.\r\n\r\n### Peek at data science tools\r\n\r\n[Even more Python for beginners](https://aka.ms/evenmorepython) is a practical exploration of a couple of the most common packages and tools you'll use when working with data and machine learning. While we won't dig into why you choose particular machine learning models (that's another course), you will get hands-on with Jupyter Notebooks, and create and test models using scikit-learn and pandas.\r\n\r\n\r\n## Next steps\r\n\r\nAs the goal of these courses is to help get you up to speed on Python so you can work through a quick start. The next step after completing the videos is to follow a tutorial! Here are a few of our favorites:\r\n\r\n- [Quickstart: Detect faces in an image using the Face REST API and Python](https://docs.microsoft.com/azure/cognitive-services/face/QuickStarts/Python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Quickstart: Analyze a local image using the Computer Vision REST API and Python](https://docs.microsoft.com/azure/cognitive-services/computer-vision/quickstarts/python-disk?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Quickstart: Using the Python REST API to call the Text Analytics Cognitive Service](https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/quickstarts/python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Tutorial: Build a Flask app with Azure Cognitive Services](https://docs.microsoft.com/azure/cognitive-services/translator/tutorial-build-flask-app-translation-synthesis?WT.mc_id=python-c9-niner)\r\n- [Flask tutorial in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask?WT.mc_id=python-c9-niner)\r\n- [Django tutorial in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-django?WT.mc_id=python-c9-niner)\r\n- [Predict flight delays by creating a machine learning model in Python](https://docs.microsoft.com/learn/modules/predict-flight-delays-with-python?WT.mc_id=python-c9-niner)\r\n\r\n## Contributing\r\n\r\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\r\n\r\n\r\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\r\n"
  },
  {
    "path": "SECURITY.md",
    "content": "<!-- BEGIN MICROSOFT SECURITY.MD V0.0.2 BLOCK -->\r\n\r\n## Security\r\n\r\nMicrosoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\nIf you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)?WT.mc_id=python-c9-niner) of a security vulnerability, please report it to us as described below.\r\n\r\n## Reporting Security Issues\r\n\r\n**Please do not report security vulnerabilities through public GitHub issues.**\r\n\r\nInstead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report?WT.mc_id=python-c9-niner).\r\n\r\nIf you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com).  If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/msrc/pgp-key-msrc?WT.mc_id=python-c9-niner).\r\n\r\nYou should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc?WT.mc_id=python-c9-niner).\r\n\r\nPlease include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:\r\n\r\n  * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)\r\n  * Full paths of source file(s) related to the manifestation of the issue\r\n  * The location of the affected source code (tag/branch/commit or direct URL)\r\n  * Any special configuration required to reproduce the issue\r\n  * Step-by-step instructions to reproduce the issue\r\n  * Proof-of-concept or exploit code (if possible)\r\n  * Impact of the issue, including how an attacker might exploit the issue\r\n\r\nThis information will help us triage your report more quickly.\r\n\r\nIf you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty?WT.mc_id=python-c9-niner) page for more details about our active programs.\r\n\r\n## Preferred Languages\r\n\r\nWe prefer all communications to be in English.\r\n\r\n## Policy\r\n\r\nMicrosoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/msrc/cvd?WT.mc_id=python-c9-niner).\r\n\r\n<!-- END MICROSOFT SECURITY.MD BLOCK -->\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/01 - Jupyter Notebooks/README.md",
    "content": "# Jupyter Notebooks\r\n\r\nJupyter Notebooks are an open source web application that allows you to create and share Python code. They are frequently used for data science. The code samples in this course are completed using Jupyter Notebooks which have a .ipynb file extension.\r\n\r\n## Documentation\r\n\r\n- [Jupyter](https://jupyter.org/) to install Jupyter so you can run Jupyter Notebooks locally on your computer\r\n- [Jupyter Notebook viewer](https://nbviewer.jupyter.org/) to view Jupyter Notebooks in this GitHub repository without installing Jupyter\r\n- [Azure Notebooks](https://notebooks.azure.com/) to create a free Azure Notebooks account to run Notebooks in the cloud\r\n- [Create and run a notebook](https://docs.microsoft.com/azure/notebooks/tutorial-create-run-jupyter-notebook?WT.mc_id=python-c9-niner) is a tutorial that walks you through the process of using Azure Notebooks to create a complete Jupyter Notebook that demonstrates linear regression\r\n- [How to create and clone projects](https://docs.microsoft.com/azure/notebooks/create-clone-jupyter-notebooks?WT.mc_id=python-c9-niner) to create a project\r\n- [Manage and configure projects in Azure Notebooks](https://docs.microsoft.com/azure/notebooks/configure-manage-azure-notebooks-projects?WT.mc_id=python-c9-niner) to upload Notebooks to your project\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/02 - Introduction to Anaconda and Conda/README.md",
    "content": "# Anaconda\r\n\r\n[Anaconda](https://www.anaconda.com/) is an open source distribution of Python and R for data science. It includes more than 1500 packages, a graphical interface called Anaconda Navigator, a command line interface called Anaconda prompt and a tool called Conda.\r\n\r\n## Conda\r\n\r\nPython code often relies on external libraries stored in packages. Conda is an open source package management system and environment management system. Conda helps you manage environments and install packages for Jupyter Notebooks.\r\n\r\n## Documentation\r\n\r\n- [Conda home page](https://docs.conda.io/)\r\n- [Managing Conda environments](https://docs.conda.io/projects/conda/latest/user-guide/tasks/manage-environments.html) to find links and instructions for creating Conda environments, activating, and de-activating Conda environments \r\n- [Managing packages](https://docs.conda.io/projects/conda/latest/user-guide/getting-started.html#managing-packages) to learn how to install packages in a Conda environment\r\n- [Conda cheat sheet](https://docs.conda.io/projects/conda/latest/user-guide/cheatsheet.html) is a handy quick reference of common Conda commands\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/03 - Intro to Pandas/03 - Pandas Series and DataFrame.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# pandas Series and DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## pandas\\n\",\n    \"**pandas** is an open source library providing data structures and data analysis tools for Python programmers\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Series\\n\",\n    \"The pandas **Series** is a one dimensional array, similar to a Python list\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"0     Seattle-Tacoma\\n\",\n       \"1             Dulles\\n\",\n       \"2    London Heathrow\\n\",\n       \"3           Schiphol\\n\",\n       \"4             Changi\\n\",\n       \"5            Pearson\\n\",\n       \"6             Narita\\n\",\n       \"dtype: object\"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports = pd.Series([\\n\",\n    \"                      'Seattle-Tacoma', \\n\",\n    \"                      'Dulles', \\n\",\n    \"                      'London Heathrow', \\n\",\n    \"                      'Schiphol', \\n\",\n    \"                      'Changi', \\n\",\n    \"                      'Pearson', \\n\",\n    \"                      'Narita'\\n\",\n    \"                      ])\\n\",\n    \"\\n\",\n    \"# When using a notebook, you can use the print statement\\n\",\n    \"# print(airports) to examine the contents of a variable\\n\",\n    \"# or you can print a value on the screen by just typing the object name\\n\",\n    \"airports\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"You can reference an individual value in a Series using it's index\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"'London Heathrow'\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports[2]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"You can use a loop to iterate through all the values in a Series\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"Seattle-Tacoma\\n\",\n      \"Dulles\\n\",\n      \"London Heathrow\\n\",\n      \"Schiphol\\n\",\n      \"Changi\\n\",\n      \"Pearson\\n\",\n      \"Narita\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"for value in airports:\\n\",\n    \"    print(value) \"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## DataFrame\\n\",\n    \"Most of the time when we are working with pandas we are dealing with two-dimensional arrays\\n\",\n    \"\\n\",\n    \"The pandas **DataFrame** can store two dimensional arrays\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <th>2</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"                 0           1               2\\n\",\n       \"0    Seatte-Tacoma     Seattle             USA\\n\",\n       \"1           Dulles  Washington             USA\\n\",\n       \"2  London Heathrow      London  United Kingdom\\n\",\n       \"3         Schiphol   Amsterdam     Netherlands\\n\",\n       \"4           Changi   Singapore       Singapore\\n\",\n       \"5          Pearson     Toronto          Canada\\n\",\n       \"6           Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 6,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports = pd.DataFrame([\\n\",\n    \"                        ['Seatte-Tacoma', 'Seattle', 'USA'],\\n\",\n    \"                        ['Dulles', 'Washington', 'USA'],\\n\",\n    \"                        ['London Heathrow', 'London', 'United Kingdom'],\\n\",\n    \"                        ['Schiphol', 'Amsterdam', 'Netherlands'],\\n\",\n    \"                        ['Changi', 'Singapore', 'Singapore'],\\n\",\n    \"                        ['Pearson', 'Toronto', 'Canada'],\\n\",\n    \"                        ['Narita', 'Tokyo', 'Japan']\\n\",\n    \"                        ])\\n\",\n    \"\\n\",\n    \"airports\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Use the **columns** parameter to specify names for the columns when you create the DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name        City         Country\\n\",\n       \"0    Seatte-Tacoma     Seattle             USA\\n\",\n       \"1           Dulles  Washington             USA\\n\",\n       \"2  London Heathrow      London  United Kingdom\\n\",\n       \"3         Schiphol   Amsterdam     Netherlands\\n\",\n       \"4           Changi   Singapore       Singapore\\n\",\n       \"5          Pearson     Toronto          Canada\\n\",\n       \"6           Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports = pd.DataFrame([\\n\",\n    \"                        ['Seatte-Tacoma', 'Seattle', 'USA'],\\n\",\n    \"                        ['Dulles', 'Washington', 'USA'],\\n\",\n    \"                        ['London Heathrow', 'London', 'United Kingdom'],\\n\",\n    \"                        ['Schiphol', 'Amsterdam', 'Netherlands'],\\n\",\n    \"                        ['Changi', 'Singapore', 'Singapore'],\\n\",\n    \"                        ['Pearson', 'Toronto', 'Canada'],\\n\",\n    \"                        ['Narita', 'Tokyo', 'Japan']\\n\",\n    \"                        ],\\n\",\n    \"                        columns = ['Name', 'City', 'Country']\\n\",\n    \"                        )\\n\",\n    \"\\n\",\n    \"airports \"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/03 - Intro to Pandas/README.md",
    "content": "# pandas\r\n\r\n[pandas](https://pandas/pydata.org​) is an open source Python library contains a number of high performance data structures and tools for data analysis.\r\n\r\n## Documentation\r\n\r\n- [Series](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html) stores one dimensional arrays\r\n- [DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/frame.html) stores two dimensional arrays and can contain different datatypes\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/04 - Examining Pandas DataFrame contents/04 - Exploring pandas DataFrame contents.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Examining pandas DataFrame contents\\n\",\n    \"It's useful to be able to quickly examine the contents of a DataFrame. \\n\",\n    \"\\n\",\n    \"Let's start by importing the pandas library and creating a DataFrame populated with information about airports\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"            Name        City         Country\\n\",\n       \"0  Seatte-Tacoma     Seattle             USA\\n\",\n       \"1         Dulles  Washington             USA\\n\",\n       \"2       Heathrow      London  United Kingdom\\n\",\n       \"3       Schiphol   Amsterdam     Netherlands\\n\",\n       \"4         Changi   Singapore       Singapore\\n\",\n       \"5        Pearson     Toronto          Canada\\n\",\n       \"6         Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports = pd.DataFrame([\\n\",\n    \"                        ['Seatte-Tacoma', 'Seattle', 'USA'],\\n\",\n    \"                        ['Dulles', 'Washington', 'USA'],\\n\",\n    \"                        ['Heathrow', 'London', 'United Kingdom'],\\n\",\n    \"                        ['Schiphol', 'Amsterdam', 'Netherlands'],\\n\",\n    \"                        ['Changi', 'Singapore', 'Singapore'],\\n\",\n    \"                        ['Pearson', 'Toronto', 'Canada'],\\n\",\n    \"                        ['Narita', 'Tokyo', 'Japan']\\n\",\n    \"                        ],\\n\",\n    \"                        columns = ['Name', 'City', 'Country']\\n\",\n    \"                        )\\n\",\n    \"\\n\",\n    \"airports \"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Returning first *n* rows\\n\",\n    \"If you have thousands of rows, you might just want to look at the first few rows\\n\",\n    \"\\n\",\n    \"* **head**(*n*) returns the top *n* rows \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"            Name        City         Country\\n\",\n       \"0  Seatte-Tacoma     Seattle             USA\\n\",\n       \"1         Dulles  Washington             USA\\n\",\n       \"2       Heathrow      London  United Kingdom\"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.head(3)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Returning last *n* rows\\n\",\n    \"Looking at the last rows in a DataFrame can be a good way to check that all your data loaded correctly\\n\",\n    \"* **tail**(*n*) returns the last *n* rows\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"      Name       City    Country\\n\",\n       \"4   Changi  Singapore  Singapore\\n\",\n       \"5  Pearson    Toronto     Canada\\n\",\n       \"6   Narita      Tokyo      Japan\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.tail(3)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Checkign number of rows and columns in DataFrame\\n\",\n    \"Sometimes you just need to know how much data you have in the DataFrame\\n\",\n    \"\\n\",\n    \"* **shape** returns the number of rows and columns\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(7, 3)\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Getting mroe detailed information about DataFrame contents\\n\",\n    \"\\n\",\n    \"* **info**() returns more detailed information about the DataFrame\\n\",\n    \"\\n\",\n    \"Information returned includes:\\n\",\n    \"* The number of rows, and the range of index values\\n\",\n    \"* The number of columns\\n\",\n    \"* For each column: column name, number of non-null values, the datatype\\n\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"<class 'pandas.core.frame.DataFrame'>\\n\",\n      \"RangeIndex: 7 entries, 0 to 6\\n\",\n      \"Data columns (total 3 columns):\\n\",\n      \"Name       7 non-null object\\n\",\n      \"City       7 non-null object\\n\",\n      \"Country    7 non-null object\\n\",\n      \"dtypes: object(3)\\n\",\n      \"memory usage: 148.0+ bytes\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"airports.info()\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/04 - Examining Pandas DataFrame contents/README.md",
    "content": "# Examining pandas DataFrame contents\r\n\r\nThe pandas [DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) is a structure for storing two-dimensional tabular data.\r\n\r\n## Common functions\r\n\r\n- [head](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.head.html) returns the first *n* rows from the DataFrame\r\n- [tail](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.tail.html) returns the last *n* rows from the DataFrame\r\n- [shape](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shape.html) returns the dimensions of the DataFrame (e.g. number of rows and columns)\r\n- [info](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.info.html) provides a summary of the DataFrame content including column names, their datatypes, and number of rows containing non-null values\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/05 - Query a pandas Dataframe/05 - Querying DataFrames.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Query a pandas DataFrame \\n\",\n    \"\\n\",\n    \"Returning a portion of the data in a DataFrame is called slicing or dicing the data\\n\",\n    \"\\n\",\n    \"There are many different ways to query a pandas DataFrame, here are a few to get you started\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name        City         Country\\n\",\n       \"0    Seatte-Tacoma     Seattle             USA\\n\",\n       \"1           Dulles  Washington             USA\\n\",\n       \"2  London Heathrow      London  United Kingdom\\n\",\n       \"3         Schiphol   Amsterdam     Netherlands\\n\",\n       \"4           Changi   Singapore       Singapore\\n\",\n       \"5          Pearson     Toronto          Canada\\n\",\n       \"6           Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports = pd.DataFrame([\\n\",\n    \"                        ['Seatte-Tacoma', 'Seattle', 'USA'],\\n\",\n    \"                        ['Dulles', 'Washington', 'USA'],\\n\",\n    \"                        ['London Heathrow', 'London', 'United Kingdom'],\\n\",\n    \"                        ['Schiphol', 'Amsterdam', 'Netherlands'],\\n\",\n    \"                        ['Changi', 'Singapore', 'Singapore'],\\n\",\n    \"                        ['Pearson', 'Toronto', 'Canada'],\\n\",\n    \"                        ['Narita', 'Tokyo', 'Japan']\\n\",\n    \"                        ],\\n\",\n    \"                        columns = ['Name', 'City', 'Country']\\n\",\n    \"                        )\\n\",\n    \"airports \"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Return one column\\n\",\n    \"Specify the name of the column you want to return\\n\",\n    \"* *DataFrameName*['*columnName*']\\n\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"0       Seattle\\n\",\n       \"1    Washington\\n\",\n       \"2        London\\n\",\n       \"3     Amsterdam\\n\",\n       \"4     Singapore\\n\",\n       \"5       Toronto\\n\",\n       \"6         Tokyo\\n\",\n       \"Name: City, dtype: object\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports['City']\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Return multiple columns\\n\",\n    \"Provide a list of the columns you want to return\\n\",\n    \"* *DataFrameName*[['*FirstColumnName*','*SecondColumnName*',...]]\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name         Country\\n\",\n       \"0    Seatte-Tacoma             USA\\n\",\n       \"1           Dulles             USA\\n\",\n       \"2  London Heathrow  United Kingdom\\n\",\n       \"3         Schiphol     Netherlands\\n\",\n       \"4           Changi       Singapore\\n\",\n       \"5          Pearson          Canada\\n\",\n       \"6           Narita           Japan\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports[['Name', 'Country']]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Using *iloc* to specify rows and columns to return\\n\",\n    \"**iloc**[*rows*,*columns*] allows you to access a group of rows or columns by row and column index positions.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"You specify the specific row and column you want returned\\n\",\n    \"* First row is row 0\\n\",\n    \"* First column is column 0\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"'Seatte-Tacoma'\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Return the value in the first row, first column\\n\",\n    \"airports.iloc[0,0]\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"'United Kingdom'\"\n      ]\n     },\n     \"execution_count\": 8,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Return the value in the third row, third column\\n\",\n    \"airports.iloc[2,2]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"A value of *:* returns all rows or all columns\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 9,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name        City         Country\\n\",\n       \"0    Seatte-Tacoma     Seattle             USA\\n\",\n       \"1           Dulles  Washington             USA\\n\",\n       \"2  London Heathrow      London  United Kingdom\\n\",\n       \"3         Schiphol   Amsterdam     Netherlands\\n\",\n       \"4           Changi   Singapore       Singapore\\n\",\n       \"5          Pearson     Toronto          Canada\\n\",\n       \"6           Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 9,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.iloc[:,:]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"You can request a range of rows or a range of columns\\n\",\n    \"* [x:y] will return rows or columns x through y\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 10,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"            Name        City Country\\n\",\n       \"0  Seatte-Tacoma     Seattle     USA\\n\",\n       \"1         Dulles  Washington     USA\"\n      ]\n     },\n     \"execution_count\": 10,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Return the first two rows and display all columns \\n\",\n    \"airports.iloc[0:2,:]\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 11,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name        City\\n\",\n       \"0    Seatte-Tacoma     Seattle\\n\",\n       \"1           Dulles  Washington\\n\",\n       \"2  London Heathrow      London\\n\",\n       \"3         Schiphol   Amsterdam\\n\",\n       \"4           Changi   Singapore\\n\",\n       \"5          Pearson     Toronto\\n\",\n       \"6           Narita       Tokyo\"\n      ]\n     },\n     \"execution_count\": 11,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Return all rows and display the first two columns\\n\",\n    \"airports.iloc[:,0:2]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"You can request a list of rows or a list of columns\\n\",\n    \"* [x,y,z] will return rows or columns x,y, and z\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 12,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name         Country\\n\",\n       \"0    Seatte-Tacoma             USA\\n\",\n       \"1           Dulles             USA\\n\",\n       \"2  London Heathrow  United Kingdom\\n\",\n       \"3         Schiphol     Netherlands\\n\",\n       \"4           Changi       Singapore\\n\",\n       \"5          Pearson          Canada\\n\",\n       \"6           Narita           Japan\"\n      ]\n     },\n     \"execution_count\": 12,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.iloc[:,[0,2]]\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Using *loc* to specify columns by name\\n\",\n    \"If you want to list the column names instead of the column positions use **loc** instead of **iloc**\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 13,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seatte-Tacoma</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>London Heathrow</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"              Name         Country\\n\",\n       \"0    Seatte-Tacoma             USA\\n\",\n       \"1           Dulles             USA\\n\",\n       \"2  London Heathrow  United Kingdom\\n\",\n       \"3         Schiphol     Netherlands\\n\",\n       \"4           Changi       Singapore\\n\",\n       \"5          Pearson          Canada\\n\",\n       \"6           Narita           Japan\"\n      ]\n     },\n     \"execution_count\": 13,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports.loc[:,['Name', 'Country']]\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/05 - Query a pandas Dataframe/README.md",
    "content": "# Query a pandas DataFrame\r\n\r\nThe pandas [DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html)  is a structure for storing two-dimensional tabular data.\r\n\r\n## Common properties\r\n\r\n- [loc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.loc.html) returns specific rows and columns by specifying column names\r\n- [iloc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html) returns specific rows and columns by specifying column positions\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/06 - CSV Files and Jupyter Notebooks/README.md",
    "content": "# CSV Files and Jupyter Notebooks\r\n\r\nCSV files are comma separated variable file. CSV files are frequently used to store data. In order to access the data in a CSV file from a Jupyter Notebook you must upload the file. \r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/06 - CSV Files and Jupyter Notebooks/airports.csv",
    "content": "﻿Name,City,Country\r\nSeattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nHeathrow,London,United Kingdom\r\nSchiphol,Amsterdam,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/07 - Read write CSV files.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Read and write CSV files with pandas DataFrames\\n\",\n    \"\\n\",\n    \"You can load data from a CSV file directly into a pandas DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Reading a CSV file into a pandas DataFrame\\n\",\n    \"**read_csv** allows you to read the contents of a csv file into a DataFrame\\n\",\n    \"\\n\",\n    \"airports.csv contains the following:  \\n\",\n    \"\\n\",\n    \"Name,City,Country  \\n\",\n    \"Seattle-Tacoma,Seattle,USA  \\n\",\n    \"Dulles,Washington,USA  \\n\",\n    \"Heathrow,London,United Kingdom  \\n\",\n    \"Schiphol,Amsterdam,Netherlands  \\n\",\n    \"Changi,Singapore,Singapore  \\n\",\n    \"Pearson,Toronto,Canada  \\n\",\n    \"Narita,Tokyo,Japan\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2        Heathrow      London  United Kingdom\\n\",\n       \"3        Schiphol   Amsterdam     Netherlands\\n\",\n       \"4          Changi   Singapore       Singapore\\n\",\n       \"5         Pearson     Toronto          Canada\\n\",\n       \"6          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv('Data/airports.csv')\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Handling rows with errors\\n\",\n    \"By default rows with an extra , or other issues cause an error\\n\",\n    \"\\n\",\n    \"Note the extra , in the row for Heathrow London in airportsInvalidRows.csv:  \\n\",\n    \"\\n\",\n    \"Name,City,Country  \\n\",\n    \"Seattle-Tacoma,Seattle,USA  \\n\",\n    \"Dulles,Washington,USA  \\n\",\n    \"Heathrow,London,,United Kingdom  \\n\",\n    \"Schiphol,Amsterdam,Netherlands  \\n\",\n    \"Changi,Singapore,Singapore  \\n\",\n    \"Pearson,Toronto,Canada  \\n\",\n    \"Narita,Tokyo,Japan  \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"ename\": \"ParserError\",\n     \"evalue\": \"Error tokenizing data. C error: Expected 3 fields in line 4, saw 4\\n\",\n     \"output_type\": \"error\",\n     \"traceback\": [\n      \"\\u001b[1;31m---------------------------------------------------------------------------\\u001b[0m\",\n      \"\\u001b[1;31mParserError\\u001b[0m                               Traceback (most recent call last)\",\n      \"\\u001b[1;32m<ipython-input-3-73bdf61a29e1>\\u001b[0m in \\u001b[0;36m<module>\\u001b[1;34m\\u001b[0m\\n\\u001b[1;32m----> 1\\u001b[1;33m \\u001b[0mairports_df\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mpd\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mread_csv\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[1;34m'Data/airportsInvalidRows.csv'\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[0;32m      2\\u001b[0m \\u001b[0mairports_df\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\",\n      \"\\u001b[1;32m~\\\\Anaconda3\\\\lib\\\\site-packages\\\\pandas\\\\io\\\\parsers.py\\u001b[0m in \\u001b[0;36mparser_f\\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)\\u001b[0m\\n\\u001b[0;32m    683\\u001b[0m         )\\n\\u001b[0;32m    684\\u001b[0m \\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m--> 685\\u001b[1;33m         \\u001b[1;32mreturn\\u001b[0m \\u001b[0m_read\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mfilepath_or_buffer\\u001b[0m\\u001b[1;33m,\\u001b[0m \\u001b[0mkwds\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[0;32m    686\\u001b[0m \\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m    687\\u001b[0m     \\u001b[0mparser_f\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0m__name__\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mname\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\",\n      \"\\u001b[1;32m~\\\\Anaconda3\\\\lib\\\\site-packages\\\\pandas\\\\io\\\\parsers.py\\u001b[0m in \\u001b[0;36m_read\\u001b[1;34m(filepath_or_buffer, kwds)\\u001b[0m\\n\\u001b[0;32m    461\\u001b[0m \\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m    462\\u001b[0m     \\u001b[1;32mtry\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m--> 463\\u001b[1;33m         \\u001b[0mdata\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mparser\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mread\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mnrows\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[0;32m    464\\u001b[0m     \\u001b[1;32mfinally\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m    465\\u001b[0m         \\u001b[0mparser\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mclose\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\",\n      \"\\u001b[1;32m~\\\\Anaconda3\\\\lib\\\\site-packages\\\\pandas\\\\io\\\\parsers.py\\u001b[0m in \\u001b[0;36mread\\u001b[1;34m(self, nrows)\\u001b[0m\\n\\u001b[0;32m   1152\\u001b[0m     \\u001b[1;32mdef\\u001b[0m \\u001b[0mread\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mself\\u001b[0m\\u001b[1;33m,\\u001b[0m \\u001b[0mnrows\\u001b[0m\\u001b[1;33m=\\u001b[0m\\u001b[1;32mNone\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m   1153\\u001b[0m         \\u001b[0mnrows\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0m_validate_integer\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[1;34m\\\"nrows\\\"\\u001b[0m\\u001b[1;33m,\\u001b[0m \\u001b[0mnrows\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m-> 1154\\u001b[1;33m         \\u001b[0mret\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mself\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0m_engine\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mread\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mnrows\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[0;32m   1155\\u001b[0m \\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m   1156\\u001b[0m         \\u001b[1;31m# May alter columns / col_dict\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\",\n      \"\\u001b[1;32m~\\\\Anaconda3\\\\lib\\\\site-packages\\\\pandas\\\\io\\\\parsers.py\\u001b[0m in \\u001b[0;36mread\\u001b[1;34m(self, nrows)\\u001b[0m\\n\\u001b[0;32m   2046\\u001b[0m     \\u001b[1;32mdef\\u001b[0m \\u001b[0mread\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mself\\u001b[0m\\u001b[1;33m,\\u001b[0m \\u001b[0mnrows\\u001b[0m\\u001b[1;33m=\\u001b[0m\\u001b[1;32mNone\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m   2047\\u001b[0m         \\u001b[1;32mtry\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m-> 2048\\u001b[1;33m             \\u001b[0mdata\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mself\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0m_reader\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mread\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[0mnrows\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[0;32m   2049\\u001b[0m         \\u001b[1;32mexcept\\u001b[0m \\u001b[0mStopIteration\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m   2050\\u001b[0m             \\u001b[1;32mif\\u001b[0m \\u001b[0mself\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0m_first_chunk\\u001b[0m\\u001b[1;33m:\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\",\n      \"\\u001b[1;32mpandas\\\\_libs\\\\parsers.pyx\\u001b[0m in \\u001b[0;36mpandas._libs.parsers.TextReader.read\\u001b[1;34m()\\u001b[0m\\n\",\n      \"\\u001b[1;32mpandas\\\\_libs\\\\parsers.pyx\\u001b[0m in \\u001b[0;36mpandas._libs.parsers.TextReader._read_low_memory\\u001b[1;34m()\\u001b[0m\\n\",\n      \"\\u001b[1;32mpandas\\\\_libs\\\\parsers.pyx\\u001b[0m in \\u001b[0;36mpandas._libs.parsers.TextReader._read_rows\\u001b[1;34m()\\u001b[0m\\n\",\n      \"\\u001b[1;32mpandas\\\\_libs\\\\parsers.pyx\\u001b[0m in \\u001b[0;36mpandas._libs.parsers.TextReader._tokenize_rows\\u001b[1;34m()\\u001b[0m\\n\",\n      \"\\u001b[1;32mpandas\\\\_libs\\\\parsers.pyx\\u001b[0m in \\u001b[0;36mpandas._libs.parsers.raise_parser_error\\u001b[1;34m()\\u001b[0m\\n\",\n      \"\\u001b[1;31mParserError\\u001b[0m: Error tokenizing data. C error: Expected 3 fields in line 4, saw 4\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv('Data/airportsInvalidRows.csv')\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Specify **error_bad_lines=False** to skip any rows with errors\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"b'Skipping line 4: expected 3 fields, saw 4\\\\n'\\n\"\n     ]\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City      Country\\n\",\n       \"0  Seattle-Tacoma     Seattle          USA\\n\",\n       \"1          Dulles  Washington          USA\\n\",\n       \"2        Schiphol   Amsterdam  Netherlands\\n\",\n       \"3          Changi   Singapore    Singapore\\n\",\n       \"4         Pearson     Toronto       Canada\\n\",\n       \"5          Narita       Tokyo        Japan\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv(\\n\",\n    \"                          'Data/airportsInvalidRows.csv', \\n\",\n    \"                           error_bad_lines=False\\n\",\n    \"                           )\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Handling files which do not contain column headers\\n\",\n    \"If your file does not have the column headers in the first row by default, the first row of data is treated as headers\\n\",\n    \"\\n\",\n    \"airportsNoHeaderRows.csv contains airport data but does not have a row specifying the column headers:\\n\",\n    \"\\n\",\n    \"Seattle-Tacoma,Seattle,USA  \\n\",\n    \"Dulles,Washington,USA  \\n\",\n    \"Heathrow,London,United Kingdom  \\n\",\n    \"Schiphol,Amsterdam,Netherlands  \\n\",\n    \"Changi,Singapore,Singapore  \\n\",\n    \"Pearson,Toronto,Canada  \\n\",\n    \"Narita,Tokyo,Japan  \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Seattle-Tacoma</th>\\n\",\n       \"      <th>Seattle</th>\\n\",\n       \"      <th>USA</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"  Seattle-Tacoma     Seattle             USA\\n\",\n       \"0         Dulles  Washington             USA\\n\",\n       \"1       Heathrow      London  United Kingdom\\n\",\n       \"2       Schiphol   Amsterdam     Netherlands\\n\",\n       \"3         Changi   Singapore       Singapore\\n\",\n       \"4        Pearson     Toronto          Canada\\n\",\n       \"5         Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv('Data/airportsNoHeaderRows.csv')\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Specify **header=None** if you do not have a Header row to avoid having the first row of data treated as a header row\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <th>2</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"                0           1               2\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2        Heathrow      London  United Kingdom\\n\",\n       \"3        Schiphol   Amsterdam     Netherlands\\n\",\n       \"4          Changi   Singapore       Singapore\\n\",\n       \"5         Pearson     Toronto          Canada\\n\",\n       \"6          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 6,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv(\\n\",\n    \"                          'Data/airportsNoHeaderRows.csv', \\n\",\n    \"                           header=None\\n\",\n    \"                           )\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"If you do not have a header row you can use the **names** parameter to specify column names when data is loaded\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2        Heathrow      London  United Kingdom\\n\",\n       \"3        Schiphol   Amsterdam     Netherlands\\n\",\n       \"4          Changi   Singapore       Singapore\\n\",\n       \"5         Pearson     Toronto          Canada\\n\",\n       \"6          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv(\\n\",\n    \"                          'Data/airportsNoHeaderRows.csv', \\n\",\n    \"                          header=None, \\n\",\n    \"                          names=['Name', 'City', 'Country']\\n\",\n    \"                          )\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Missing values in Data files\\n\",\n    \"Missing values appear in DataFrames as **NaN**\\n\",\n    \"\\n\",\n    \"There is no city listed for Schiphol airport in airportsBlankValues.csv :\\n\",\n    \"\\n\",\n    \"Name,City,Country  \\n\",\n    \"Seattle-Tacoma,Seattle,USA  \\n\",\n    \"Dulles,Washington,USA  \\n\",\n    \"Heathrow,London,United Kingdom  \\n\",\n    \"Schiphol,,Netherlands  \\n\",\n    \"Changi,Singapore,Singapore  \\n\",\n    \"Pearson,Toronto,Canada  \\n\",\n    \"Narita,Tokyo,Japan\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>NaN</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2        Heathrow      London  United Kingdom\\n\",\n       \"3        Schiphol         NaN     Netherlands\\n\",\n       \"4          Changi   Singapore       Singapore\\n\",\n       \"5         Pearson     Toronto          Canada\\n\",\n       \"6          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 8,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv('Data/airportsBlankValues.csv')\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Writing DataFrame contents to a CSV file\\n\",\n    \"**to_csv** will write the contents of a pandas DataFrame to a CSV file\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 9,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>NaN</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2        Heathrow      London  United Kingdom\\n\",\n       \"3        Schiphol         NaN     Netherlands\\n\",\n       \"4          Changi   Singapore       Singapore\\n\",\n       \"5         Pearson     Toronto          Canada\\n\",\n       \"6          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 9,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 10,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"airports_df.to_csv('Data/MyNewCSVFile.csv')\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"The index column is written to the csv file\\n\",\n    \"\\n\",\n    \"Specify **index=False** if you do not want the index column to be included in the csv file\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 11,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"airports_df.to_csv(\\n\",\n    \"                   'Data/MyNewCSVFileNoIndex.csv', \\n\",\n    \"                    index=False\\n\",\n    \"                    )\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/README.md",
    "content": "# Read and write CSV files from pandas DataFrames\r\n\r\nYou can populate a DataFrame with the data in a CSV file.\r\n\r\n## Common functions and properties\r\n\r\n- [read_csv](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) reads a comma-separated values file into a DataFrame\r\n- [to_csv](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html) writes contents of a DataFrame to a comma-separated values file\r\n- [NaN](https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html) is the default representation of missing values\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/airports.csv",
    "content": "﻿Name,City,Country\r\nSeattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nHeathrow,London,United Kingdom\r\nSchiphol,Amsterdam,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/airportsBlankValues.csv",
    "content": "﻿Name,City,Country\r\nSeattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nHeathrow,London,United Kingdom\r\nSchiphol,,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/airportsInvalidRows.csv",
    "content": "﻿Name,City,Country\r\nSeattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nHeathrow,London,,United Kingdom\r\nSchiphol,Amsterdam,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/07 - Read and write CSV files from pandas DataFrames/airportsNoHeaderRows.csv",
    "content": "﻿Seattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nHeathrow,London,United Kingdom\r\nSchiphol,Amsterdam,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/08 - Removing and splitting DataFrame columns/08 - Removing columns.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Removing and splitting pandas DataFrame columns\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"When you are preparing to train machine learning models, you often need to delete specific columns, or split certain columns from your DataFrame into a new DataFrame.\\n\",\n    \"\\n\",\n    \"We need the pandas library and a DataFrame to explore\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Let's load a bigger csv file with more columns, **flight_delays.csv** provides information about flights and flight delays\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>FL_DATE</th>\\n\",\n       \"      <th>OP_UNIQUE_CARRIER</th>\\n\",\n       \"      <th>TAIL_NUM</th>\\n\",\n       \"      <th>OP_CARRIER_FL_NUM</th>\\n\",\n       \"      <th>ORIGIN</th>\\n\",\n       \"      <th>DEST</th>\\n\",\n       \"      <th>CRS_DEP_TIME</th>\\n\",\n       \"      <th>DEP_TIME</th>\\n\",\n       \"      <th>DEP_DELAY</th>\\n\",\n       \"      <th>CRS_ARR_TIME</th>\\n\",\n       \"      <th>ARR_TIME</th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"      <th>ACTUAL_ELAPSED_TIME</th>\\n\",\n       \"      <th>AIR_TIME</th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N221WN</td>\\n\",\n       \"      <td>802</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>905</td>\\n\",\n       \"      <td>903</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>1450</td>\\n\",\n       \"      <td>1433</td>\\n\",\n       \"      <td>-17</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>210</td>\\n\",\n       \"      <td>197</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N8329B</td>\\n\",\n       \"      <td>3744</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>1500</td>\\n\",\n       \"      <td>1458</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>2020</td>\\n\",\n       \"      <td>-25</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>202</td>\\n\",\n       \"      <td>191</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N920WN</td>\\n\",\n       \"      <td>1019</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1800</td>\\n\",\n       \"      <td>1802</td>\\n\",\n       \"      <td>2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>2032</td>\\n\",\n       \"      <td>-13</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>90</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N480WN</td>\\n\",\n       \"      <td>1499</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>950</td>\\n\",\n       \"      <td>947</td>\\n\",\n       \"      <td>-3</td>\\n\",\n       \"      <td>1235</td>\\n\",\n       \"      <td>1223</td>\\n\",\n       \"      <td>-12</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>96</td>\\n\",\n       \"      <td>81</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N227WN</td>\\n\",\n       \"      <td>3635</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1150</td>\\n\",\n       \"      <td>1151</td>\\n\",\n       \"      <td>1</td>\\n\",\n       \"      <td>1430</td>\\n\",\n       \"      <td>1423</td>\\n\",\n       \"      <td>-7</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"      <td>92</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"      FL_DATE OP_UNIQUE_CARRIER TAIL_NUM  OP_CARRIER_FL_NUM ORIGIN DEST  \\\\\\n\",\n       \"0  2018-10-01                WN   N221WN                802    ABQ  BWI   \\n\",\n       \"1  2018-10-01                WN   N8329B               3744    ABQ  BWI   \\n\",\n       \"2  2018-10-01                WN   N920WN               1019    ABQ  DAL   \\n\",\n       \"3  2018-10-01                WN   N480WN               1499    ABQ  DAL   \\n\",\n       \"4  2018-10-01                WN   N227WN               3635    ABQ  DAL   \\n\",\n       \"\\n\",\n       \"   CRS_DEP_TIME  DEP_TIME  DEP_DELAY  CRS_ARR_TIME  ARR_TIME  ARR_DELAY  \\\\\\n\",\n       \"0           905       903         -2          1450      1433        -17   \\n\",\n       \"1          1500      1458         -2          2045      2020        -25   \\n\",\n       \"2          1800      1802          2          2045      2032        -13   \\n\",\n       \"3           950       947         -3          1235      1223        -12   \\n\",\n       \"4          1150      1151          1          1430      1423         -7   \\n\",\n       \"\\n\",\n       \"   CRS_ELAPSED_TIME  ACTUAL_ELAPSED_TIME  AIR_TIME  DISTANCE  \\n\",\n       \"0               225                  210       197      1670  \\n\",\n       \"1               225                  202       191      1670  \\n\",\n       \"2               105                   90        80       580  \\n\",\n       \"3               105                   96        81       580  \\n\",\n       \"4               100                   92        80       580  \"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"delays_df = pd.read_csv('Data/flight_delays.csv')\\n\",\n    \"delays_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Removing a column from a DataFrame.\\n\",\n    \"\\n\",\n    \"When you are preparing your data for machine learning, you may need to delete specific columns from the DataFrame before training the model.\\n\",\n    \"\\n\",\n    \"For example:\\n\",\n    \"Imagine you are training a model to predict how many minutes late a flight will be (ARR_DELAY)\\n\",\n    \"\\n\",\n    \"If the model knew the scheduled arrival time (CRS_ARR_TIME) and the actual arrival time (ARR_TIME), the model would quickly figure out ARR_DELAY = ARR_TIME - CRS_ARR_TIME\\n\",\n    \"\\n\",\n    \"When we predict arrival times for future flights, we won't have a value for  arrival time (ARR_TIME). So we should remove this column from the DataFrame so it is not used as a feature when training the model to predict ARR_DELAY.  \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>FL_DATE</th>\\n\",\n       \"      <th>OP_UNIQUE_CARRIER</th>\\n\",\n       \"      <th>TAIL_NUM</th>\\n\",\n       \"      <th>OP_CARRIER_FL_NUM</th>\\n\",\n       \"      <th>ORIGIN</th>\\n\",\n       \"      <th>DEST</th>\\n\",\n       \"      <th>CRS_DEP_TIME</th>\\n\",\n       \"      <th>DEP_TIME</th>\\n\",\n       \"      <th>DEP_DELAY</th>\\n\",\n       \"      <th>CRS_ARR_TIME</th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"      <th>ACTUAL_ELAPSED_TIME</th>\\n\",\n       \"      <th>AIR_TIME</th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N221WN</td>\\n\",\n       \"      <td>802</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>905</td>\\n\",\n       \"      <td>903</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>1450</td>\\n\",\n       \"      <td>-17</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>210</td>\\n\",\n       \"      <td>197</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N8329B</td>\\n\",\n       \"      <td>3744</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>1500</td>\\n\",\n       \"      <td>1458</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>-25</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>202</td>\\n\",\n       \"      <td>191</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N920WN</td>\\n\",\n       \"      <td>1019</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1800</td>\\n\",\n       \"      <td>1802</td>\\n\",\n       \"      <td>2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>-13</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>90</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N480WN</td>\\n\",\n       \"      <td>1499</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>950</td>\\n\",\n       \"      <td>947</td>\\n\",\n       \"      <td>-3</td>\\n\",\n       \"      <td>1235</td>\\n\",\n       \"      <td>-12</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>96</td>\\n\",\n       \"      <td>81</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N227WN</td>\\n\",\n       \"      <td>3635</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1150</td>\\n\",\n       \"      <td>1151</td>\\n\",\n       \"      <td>1</td>\\n\",\n       \"      <td>1430</td>\\n\",\n       \"      <td>-7</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"      <td>92</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"      FL_DATE OP_UNIQUE_CARRIER TAIL_NUM  OP_CARRIER_FL_NUM ORIGIN DEST  \\\\\\n\",\n       \"0  2018-10-01                WN   N221WN                802    ABQ  BWI   \\n\",\n       \"1  2018-10-01                WN   N8329B               3744    ABQ  BWI   \\n\",\n       \"2  2018-10-01                WN   N920WN               1019    ABQ  DAL   \\n\",\n       \"3  2018-10-01                WN   N480WN               1499    ABQ  DAL   \\n\",\n       \"4  2018-10-01                WN   N227WN               3635    ABQ  DAL   \\n\",\n       \"\\n\",\n       \"   CRS_DEP_TIME  DEP_TIME  DEP_DELAY  CRS_ARR_TIME  ARR_DELAY  \\\\\\n\",\n       \"0           905       903         -2          1450        -17   \\n\",\n       \"1          1500      1458         -2          2045        -25   \\n\",\n       \"2          1800      1802          2          2045        -13   \\n\",\n       \"3           950       947         -3          1235        -12   \\n\",\n       \"4          1150      1151          1          1430         -7   \\n\",\n       \"\\n\",\n       \"   CRS_ELAPSED_TIME  ACTUAL_ELAPSED_TIME  AIR_TIME  DISTANCE  \\n\",\n       \"0               225                  210       197      1670  \\n\",\n       \"1               225                  202       191      1670  \\n\",\n       \"2               105                   90        80       580  \\n\",\n       \"3               105                   96        81       580  \\n\",\n       \"4               100                   92        80       580  \"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Remove the column ARR_TIME from the DataFrane delays_df\\n\",\n    \"\\n\",\n    \"#delays_df = delays_df.drop(['ARR_TIME'],axis=1)\\n\",\n    \"new_df = delays_df.drop(columns=['ARR_TIME'])\\n\",\n    \"new_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Use the **inplace** parameter to specify you want to drop the column from the original DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>FL_DATE</th>\\n\",\n       \"      <th>OP_UNIQUE_CARRIER</th>\\n\",\n       \"      <th>TAIL_NUM</th>\\n\",\n       \"      <th>OP_CARRIER_FL_NUM</th>\\n\",\n       \"      <th>ORIGIN</th>\\n\",\n       \"      <th>DEST</th>\\n\",\n       \"      <th>CRS_DEP_TIME</th>\\n\",\n       \"      <th>DEP_TIME</th>\\n\",\n       \"      <th>DEP_DELAY</th>\\n\",\n       \"      <th>CRS_ARR_TIME</th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"      <th>ACTUAL_ELAPSED_TIME</th>\\n\",\n       \"      <th>AIR_TIME</th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N221WN</td>\\n\",\n       \"      <td>802</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>905</td>\\n\",\n       \"      <td>903</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>1450</td>\\n\",\n       \"      <td>-17</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>210</td>\\n\",\n       \"      <td>197</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N8329B</td>\\n\",\n       \"      <td>3744</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>1500</td>\\n\",\n       \"      <td>1458</td>\\n\",\n       \"      <td>-2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>-25</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>202</td>\\n\",\n       \"      <td>191</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N920WN</td>\\n\",\n       \"      <td>1019</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1800</td>\\n\",\n       \"      <td>1802</td>\\n\",\n       \"      <td>2</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>-13</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>90</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N480WN</td>\\n\",\n       \"      <td>1499</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>950</td>\\n\",\n       \"      <td>947</td>\\n\",\n       \"      <td>-3</td>\\n\",\n       \"      <td>1235</td>\\n\",\n       \"      <td>-12</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>96</td>\\n\",\n       \"      <td>81</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N227WN</td>\\n\",\n       \"      <td>3635</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1150</td>\\n\",\n       \"      <td>1151</td>\\n\",\n       \"      <td>1</td>\\n\",\n       \"      <td>1430</td>\\n\",\n       \"      <td>-7</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"      <td>92</td>\\n\",\n       \"      <td>80</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"      FL_DATE OP_UNIQUE_CARRIER TAIL_NUM  OP_CARRIER_FL_NUM ORIGIN DEST  \\\\\\n\",\n       \"0  2018-10-01                WN   N221WN                802    ABQ  BWI   \\n\",\n       \"1  2018-10-01                WN   N8329B               3744    ABQ  BWI   \\n\",\n       \"2  2018-10-01                WN   N920WN               1019    ABQ  DAL   \\n\",\n       \"3  2018-10-01                WN   N480WN               1499    ABQ  DAL   \\n\",\n       \"4  2018-10-01                WN   N227WN               3635    ABQ  DAL   \\n\",\n       \"\\n\",\n       \"   CRS_DEP_TIME  DEP_TIME  DEP_DELAY  CRS_ARR_TIME  ARR_DELAY  \\\\\\n\",\n       \"0           905       903         -2          1450        -17   \\n\",\n       \"1          1500      1458         -2          2045        -25   \\n\",\n       \"2          1800      1802          2          2045        -13   \\n\",\n       \"3           950       947         -3          1235        -12   \\n\",\n       \"4          1150      1151          1          1430         -7   \\n\",\n       \"\\n\",\n       \"   CRS_ELAPSED_TIME  ACTUAL_ELAPSED_TIME  AIR_TIME  DISTANCE  \\n\",\n       \"0               225                  210       197      1670  \\n\",\n       \"1               225                  202       191      1670  \\n\",\n       \"2               105                   90        80       580  \\n\",\n       \"3               105                   96        81       580  \\n\",\n       \"4               100                   92        80       580  \"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Remove the column ARR_TIME from the DataFrame delays_df\\n\",\n    \"\\n\",\n    \"#delays_df = delays_df.drop(['ARR_TIME'],axis=1)\\n\",\n    \"delays_df.drop(columns=['ARR_TIME'], inplace=True)\\n\",\n    \"delays_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"We use different techniques to predict based on quantititative values which are usually numeric values (e.g. distance, number of minutes, weight) and qualitative (descriptive) values which may not be numeric (e.g. what airport a flight left from, what airline operated the flight)\\n\",\n    \"\\n\",\n    \"Quantitative data may be moved into a separate DataFrame before training a model.\\n\",\n    \"\\n\",\n    \"You also need to put the value you want to predict, called the label (ARR_DELAY) in a separate DataFrame from the values you think can help you make the prediction, called the features\\n\",\n    \"\\n\",\n    \"We need to be able to create a new dataframe from the columns in an existing dataframe\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {\n    \"scrolled\": true\n   },\n   \"outputs\": [],\n   \"source\": [\n    \"# Create a new DataFrame called desc_df\\n\",\n    \"# include all rows\\n\",\n    \"# include the columns ORIGIN, DEST, OP_CARRIER_FL_NUM, OP_UNIQUE_CARRIER, TAIL_NUM\\n\",\n    \"\\n\",\n    \"desc_df = delays_df.loc[:,['ORIGIN', 'DEST', 'OP_CARRIER_FL_NUM', 'OP_UNIQUE_CARRIER', 'TAIL_NUM']]\\n\",\n    \"desc_df.head()\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/08 - Removing and splitting DataFrame columns/README.md",
    "content": "# Removing and splitting DataFrame columns\r\n\r\nWhen preparing data for machine learning you may need to remove specific columns from the DataFrame.\r\n\r\n## Common functions\r\n\r\n- [drop](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html) deletes specified columns from a DataFrame\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/08 - Removing and splitting DataFrame columns/flight_delays.csv",
    "content": "FL_DATE,OP_UNIQUE_CARRIER,TAIL_NUM,OP_CARRIER_FL_NUM,ORIGIN,DEST,CRS_DEP_TIME,DEP_TIME,DEP_DELAY,CRS_ARR_TIME,ARR_TIME,ARR_DELAY,CRS_ELAPSED_TIME,ACTUAL_ELAPSED_TIME,AIR_TIME,DISTANCE\r\n2018-10-01,WN,N221WN,802,ABQ,BWI,905,903,-2,1450,1433,-17,225,210,197,1670\r\n2018-10-01,WN,N8329B,3744,ABQ,BWI,1500,1458,-2,2045,2020,-25,225,202,191,1670\r\n2018-10-01,WN,N920WN,1019,ABQ,DAL,1800,1802,2,2045,2032,-13,105,90,80,580\r\n2018-10-01,WN,N480WN,1499,ABQ,DAL,950,947,-3,1235,1223,-12,105,96,81,580\r\n2018-10-01,WN,N227WN,3635,ABQ,DAL,1150,1151,1,1430,1423,-7,100,92,80,580\r\n2018-10-01,WN,N243WN,3998,ABQ,DAL,655,652,-3,940,924,-16,105,92,83,580\r\n2018-10-01,WN,N485WN,5432,ABQ,DAL,1340,1354,14,1625,1631,6,105,97,81,580\r\n2018-10-01,WN,N229WN,4596,ABQ,DEN,1420,1444,24,1540,1552,12,80,68,55,349\r\n2018-10-01,WN,N934WN,6013,ABQ,DEN,910,907,-3,1025,1027,2,75,80,52,349\r\n2018-10-01,WN,N934WN,6015,ABQ,DEN,1735,1742,7,1845,1854,9,70,72,58,349\r\n2018-10-01,WN,N8615E,2885,ABQ,HOU,1240,1239,-1,1540,1539,-1,120,120,108,759\r\n2018-10-01,WN,N965WN,3939,ABQ,HOU,640,640,0,940,938,-2,120,118,103,759\r\n2018-10-01,WN,N408WN,4025,ABQ,HOU,1555,1610,15,1850,1906,16,115,116,103,759\r\n2018-10-01,WN,N913WN,1642,ABQ,LAS,1040,1037,-3,1115,1057,-18,95,80,69,486\r\n2018-10-01,WN,N927WN,3271,ABQ,LAS,1615,1614,-1,1645,1646,1,90,92,75,486\r\n2018-10-01,WN,N732SW,4816,ABQ,LAS,605,601,-4,635,628,-7,90,87,73,486\r\n2018-10-01,WN,N496WN,6095,ABQ,LAS,2130,2123,-7,2155,2146,-9,85,83,70,486\r\n2018-10-01,WN,N468WN,555,ABQ,LAX,1710,1708,-2,1815,1805,-10,125,117,92,677\r\n2018-10-01,WN,N7751A,3858,ABQ,LAX,545,541,-4,645,638,-7,120,117,102,677\r\n2018-10-01,WN,N435WN,5757,ABQ,MCI,1720,2119,239,2005,2357,232,105,98,87,718\r\n2018-10-01,WN,N556WN,538,ABQ,MDW,1705,1756,51,2040,2114,34,155,138,129,1121\r\n2018-10-01,WN,N410WN,4837,ABQ,MDW,705,708,3,1045,1032,-13,160,144,127,1121\r\n2018-10-01,WN,N8726H,792,ABQ,OAK,815,809,-6,940,928,-12,145,139,123,889\r\n2018-10-01,WN,N956WN,5673,ABQ,OAK,1125,1221,56,1250,1337,47,145,136,121,889\r\n2018-10-01,WN,N739GB,5753,ABQ,OAK,1915,1915,0,2035,2029,-6,140,134,121,889\r\n2018-10-01,WN,N7723E,5516,ABQ,PDX,1020,1017,-3,1215,1204,-11,175,167,157,1111\r\n2018-10-01,WN,N770SA,1415,ABQ,PHX,945,944,-1,1005,949,-16,80,65,54,328\r\n2018-10-01,WN,N730SW,2782,ABQ,PHX,1410,1424,14,1430,1431,1,80,67,55,328\r\n2018-10-01,WN,N7725A,2863,ABQ,PHX,700,702,2,720,720,0,80,78,56,328\r\n2018-10-01,WN,N450WN,4114,ABQ,PHX,1935,1931,-4,1950,1959,9,75,88,58,328\r\n2018-10-01,WN,N8673F,5500,ABQ,PHX,1625,1630,5,1640,1636,-4,75,66,58,328\r\n2018-10-01,WN,N948WN,6315,ABQ,PHX,1120,1126,6,1140,1138,-2,80,72,57,328\r\n2018-10-01,WN,N566WN,19,ABQ,SAN,1505,1551,46,1555,1631,36,110,100,87,628\r\n2018-10-01,WN,N957WN,4832,ABQ,SAN,610,616,6,700,658,-2,110,102,91,628\r\n2018-10-01,WN,N8704Q,824,ALB,BWI,805,801,-4,920,911,-9,75,70,54,289\r\n2018-10-01,WN,N903WN,1758,ALB,BWI,605,601,-4,720,706,-14,75,65,55,289\r\n2018-10-01,WN,N8572X,2790,ALB,BWI,925,928,3,1040,1031,-9,75,63,53,289\r\n2018-10-01,WN,N7701B,3292,ALB,BWI,1315,1308,-7,1435,1417,-18,80,69,58,289\r\n2018-10-01,WN,N295WN,3376,ALB,BWI,1105,1101,-4,1220,1206,-14,75,65,53,289\r\n2018-10-01,WN,N716SW,4898,ALB,BWI,1710,1707,-3,1825,1815,-10,75,68,56,289\r\n2018-10-01,WN,N8674B,5153,ALB,DEN,1850,1849,-1,2050,2045,-5,240,236,223,1610\r\n2018-10-01,WN,N8643A,390,ALB,MCO,705,705,0,955,954,-1,170,169,149,1073\r\n2018-10-01,WN,N730SW,2776,ALB,MDW,630,625,-5,735,744,9,125,139,120,717\r\n2018-10-01,WN,N798SW,4197,ALB,MDW,1655,1652,-3,1805,1815,10,130,143,112,717\r\n2018-10-01,WN,N729SW,988,AMA,DAL,1605,1615,10,1720,1713,-7,75,58,48,323\r\n2018-10-01,WN,N933WN,1913,AMA,DAL,605,603,-2,720,705,-15,75,62,50,323\r\n2018-10-01,WN,N7706A,5226,AMA,DAL,1045,1047,2,1155,1156,1,70,69,52,323\r\n2018-10-01,WN,N755SA,6984,AMA,DAL,1830,1825,-5,1940,1921,-19,70,56,48,323\r\n2018-10-01,WN,N211WN,6822,AMA,LAS,1425,1429,4,1425,1438,13,120,129,107,758\r\n2018-10-01,WN,N928WN,4261,ATL,AUS,1015,1011,-4,1140,1137,-3,145,146,123,813\r\n2018-10-01,WN,N8581Z,4701,ATL,AUS,2030,2024,-6,2150,2133,-17,140,129,109,813\r\n2018-10-01,WN,N950WN,5615,ATL,AUS,1645,1647,2,1810,1805,-5,145,138,112,813\r\n2018-10-01,WN,N932WN,106,ATL,BNA,2215,2211,-4,2215,2205,-10,60,54,39,214\r\n2018-10-01,WN,N739GB,2583,ATL,BNA,800,756,-4,755,752,-3,55,56,42,214\r\n2018-10-01,WN,N454WN,3766,ATL,BNA,1955,1951,-4,2000,1948,-12,65,57,39,214\r\n2018-10-01,WN,N7716A,4165,ATL,BNA,1225,1226,1,1235,1226,-9,70,60,41,214\r\n2018-10-01,WN,N7822A,4501,ATL,BNA,1750,1745,-5,1745,1742,-3,55,57,40,214\r\n2018-10-01,WN,N8324A,3360,ATL,BOS,1330,1500,90,1605,1737,92,155,157,126,946\r\n2018-10-01,WN,N444WN,3987,ATL,BOS,2210,2204,-6,50,24,-26,160,140,118,946\r\n2018-10-01,WN,N472WN,1031,ATL,BWI,1120,1119,-1,1310,1303,-7,110,104,81,577\r\n2018-10-01,WN,N758SW,1526,ATL,BWI,800,757,-3,945,934,-11,105,97,81,577\r\n2018-10-01,WN,N8642E,1922,ATL,BWI,1700,1656,-4,1850,1840,-10,110,104,88,577\r\n2018-10-01,WN,N7838A,3991,ATL,BWI,2115,2202,47,2305,2339,34,110,97,80,577\r\n2018-10-01,WN,N7839A,4436,ATL,BWI,1905,1904,-1,2100,2044,-16,115,100,85,577\r\n2018-10-01,WN,N8509U,5150,ATL,BWI,1340,1416,36,1530,1548,18,110,92,79,577\r\n2018-10-01,WN,N242WN,2574,ATL,CLE,835,833,-2,1015,1016,1,100,103,79,554\r\n2018-10-01,WN,N961WN,5133,ATL,CLE,2200,2155,-5,2335,2334,-1,95,99,80,554\r\n2018-10-01,WN,N8503A,2571,ATL,CMH,1540,1540,0,1710,1711,1,90,91,65,447\r\n2018-10-01,WN,N282WN,6348,ATL,CMH,835,834,-1,1005,1005,0,90,91,67,447\r\n2018-10-01,WN,N293WN,6661,ATL,CMH,2200,2208,8,2325,2332,7,85,84,67,447\r\n2018-10-01,WN,N954WN,63,ATL,DAL,2010,2010,0,2125,2118,-7,135,128,101,721\r\n2018-10-01,WN,N764SW,2838,ATL,DAL,720,719,-1,825,816,-9,125,117,103,721\r\n2018-10-01,WN,N8549Z,3845,ATL,DAL,1740,1738,-2,1845,1838,-7,125,120,102,721\r\n2018-10-01,WN,N8620H,5577,ATL,DAL,1045,1102,17,1200,1208,8,135,126,103,721\r\n2018-10-01,WN,N8317M,6768,ATL,DAL,1330,1331,1,1440,1431,-9,130,120,101,721\r\n2018-10-01,WN,N550WN,1347,ATL,DCA,1525,1542,17,1710,1724,14,105,102,79,547\r\n2018-10-01,WN,N8648A,2600,ATL,DCA,715,716,1,855,851,-4,100,95,82,547\r\n2018-10-01,WN,N726SW,4747,ATL,DCA,2025,2027,2,2210,2209,-1,105,102,83,547\r\n2018-10-01,WN,N8665D,5207,ATL,DCA,1030,1105,35,1215,1241,26,105,96,80,547\r\n2018-10-01,WN,N930WN,208,ATL,DEN,1835,1846,11,1945,1948,3,190,182,167,1199\r\n2018-10-01,WN,N400WN,4133,ATL,DEN,610,607,-3,715,711,-4,185,184,170,1199\r\n2018-10-01,WN,N7817J,4139,ATL,DEN,1430,1432,2,1540,1539,-1,190,187,167,1199\r\n2018-10-01,WN,N8647A,5960,ATL,DEN,955,1008,13,1110,1112,2,195,184,162,1199\r\n2018-10-01,WN,N212WN,115,ATL,DTW,835,832,-3,1025,1024,-1,110,112,86,594\r\n2018-10-01,WN,N256WN,1896,ATL,DTW,2200,2200,0,2345,2349,4,105,109,86,594\r\n2018-10-01,WN,N8556Z,5388,ATL,DTW,1530,1531,1,1730,1727,-3,120,116,86,594\r\n2018-10-01,WN,N279WN,2775,ATL,FLL,1110,1111,1,1310,1250,-20,120,99,82,581\r\n2018-10-01,WN,N945WN,3088,ATL,FLL,1340,1351,11,1535,1529,-6,115,98,82,581\r\n2018-10-01,WN,N8699A,5459,ATL,FLL,650,645,-5,835,820,-15,105,95,80,581\r\n2018-10-01,WN,N8691A,6191,ATL,FLL,1950,1958,8,2140,2146,6,110,108,83,581\r\n2018-10-01,WN,N8548P,964,ATL,GSP,1540,1539,-1,1630,1628,-2,50,49,27,153\r\n2018-10-01,WN,N258WN,5417,ATL,GSP,2205,2240,35,2255,2322,27,50,42,27,153\r\n2018-10-01,WN,N8660A,6185,ATL,GSP,1105,1101,-4,1200,1145,-15,55,44,26,153\r\n2018-10-01,WN,N274WN,343,ATL,HOU,1810,1808,-2,1920,1901,-19,130,113,100,696\r\n2018-10-01,WN,N230WN,1176,ATL,HOU,1955,1955,0,2105,2057,-8,130,122,101,696\r\n2018-10-01,WN,N786SW,1433,ATL,HOU,1130,1308,98,1235,1443,128,125,155,140,696\r\n2018-10-01,WN,N452WN,2847,ATL,HOU,605,601,-4,710,659,-11,125,118,99,696\r\n2018-10-01,WN,N8619F,5161,ATL,HOU,1340,1333,-7,1440,1503,23,120,150,136,696\r\n2018-10-01,WN,N8513F,812,ATL,IAD,1535,1535,0,1725,1727,2,110,112,78,534\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/09 - Handling duplicates and rows with missing values/09 - Removing rows.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Handling duplicate rows and rows with missing values\\n\",\n    \"\\n\",\n    \"Most machine learning algorithms will return an error if they encounter a missing value.  So, you often have to remove rows with missing values from your DataFrame.\\n\",\n    \"\\n\",\n    \"To learn how, we need to create a pandas DataFrame and load it with data.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"The flight delays data set contains information about flights and flight delays\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>FL_DATE</th>\\n\",\n       \"      <th>OP_UNIQUE_CARRIER</th>\\n\",\n       \"      <th>TAIL_NUM</th>\\n\",\n       \"      <th>OP_CARRIER_FL_NUM</th>\\n\",\n       \"      <th>ORIGIN</th>\\n\",\n       \"      <th>DEST</th>\\n\",\n       \"      <th>CRS_DEP_TIME</th>\\n\",\n       \"      <th>DEP_TIME</th>\\n\",\n       \"      <th>DEP_DELAY</th>\\n\",\n       \"      <th>CRS_ARR_TIME</th>\\n\",\n       \"      <th>ARR_TIME</th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"      <th>ACTUAL_ELAPSED_TIME</th>\\n\",\n       \"      <th>AIR_TIME</th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N221WN</td>\\n\",\n       \"      <td>802</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>905</td>\\n\",\n       \"      <td>903.0</td>\\n\",\n       \"      <td>-2.0</td>\\n\",\n       \"      <td>1450</td>\\n\",\n       \"      <td>1433.0</td>\\n\",\n       \"      <td>-17.0</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>210.0</td>\\n\",\n       \"      <td>197.0</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N8329B</td>\\n\",\n       \"      <td>3744</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>BWI</td>\\n\",\n       \"      <td>1500</td>\\n\",\n       \"      <td>1458.0</td>\\n\",\n       \"      <td>-2.0</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>2020.0</td>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"      <td>202.0</td>\\n\",\n       \"      <td>191.0</td>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N920WN</td>\\n\",\n       \"      <td>1019</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1800</td>\\n\",\n       \"      <td>1802.0</td>\\n\",\n       \"      <td>2.0</td>\\n\",\n       \"      <td>2045</td>\\n\",\n       \"      <td>2032.0</td>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>90.0</td>\\n\",\n       \"      <td>80.0</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N480WN</td>\\n\",\n       \"      <td>1499</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>950</td>\\n\",\n       \"      <td>947.0</td>\\n\",\n       \"      <td>-3.0</td>\\n\",\n       \"      <td>1235</td>\\n\",\n       \"      <td>1223.0</td>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"      <td>96.0</td>\\n\",\n       \"      <td>81.0</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>2018-10-01</td>\\n\",\n       \"      <td>WN</td>\\n\",\n       \"      <td>N227WN</td>\\n\",\n       \"      <td>3635</td>\\n\",\n       \"      <td>ABQ</td>\\n\",\n       \"      <td>DAL</td>\\n\",\n       \"      <td>1150</td>\\n\",\n       \"      <td>1151.0</td>\\n\",\n       \"      <td>1.0</td>\\n\",\n       \"      <td>1430</td>\\n\",\n       \"      <td>1423.0</td>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"      <td>92.0</td>\\n\",\n       \"      <td>80.0</td>\\n\",\n       \"      <td>580</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"      FL_DATE OP_UNIQUE_CARRIER TAIL_NUM  OP_CARRIER_FL_NUM ORIGIN DEST  \\\\\\n\",\n       \"0  2018-10-01                WN   N221WN                802    ABQ  BWI   \\n\",\n       \"1  2018-10-01                WN   N8329B               3744    ABQ  BWI   \\n\",\n       \"2  2018-10-01                WN   N920WN               1019    ABQ  DAL   \\n\",\n       \"3  2018-10-01                WN   N480WN               1499    ABQ  DAL   \\n\",\n       \"4  2018-10-01                WN   N227WN               3635    ABQ  DAL   \\n\",\n       \"\\n\",\n       \"   CRS_DEP_TIME  DEP_TIME  DEP_DELAY  CRS_ARR_TIME  ARR_TIME  ARR_DELAY  \\\\\\n\",\n       \"0           905     903.0       -2.0          1450    1433.0      -17.0   \\n\",\n       \"1          1500    1458.0       -2.0          2045    2020.0      -25.0   \\n\",\n       \"2          1800    1802.0        2.0          2045    2032.0      -13.0   \\n\",\n       \"3           950     947.0       -3.0          1235    1223.0      -12.0   \\n\",\n       \"4          1150    1151.0        1.0          1430    1423.0       -7.0   \\n\",\n       \"\\n\",\n       \"   CRS_ELAPSED_TIME  ACTUAL_ELAPSED_TIME  AIR_TIME  DISTANCE  \\n\",\n       \"0               225                210.0     197.0      1670  \\n\",\n       \"1               225                202.0     191.0      1670  \\n\",\n       \"2               105                 90.0      80.0       580  \\n\",\n       \"3               105                 96.0      81.0       580  \\n\",\n       \"4               100                 92.0      80.0       580  \"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv')\\n\",\n    \"delays_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"**info**  will tell us how many rows are in the DataFrame and for each column how many of those rows contain non-null values. From this we can determine which columns (if any) contain null/missing values\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"<class 'pandas.core.frame.DataFrame'>\\n\",\n      \"RangeIndex: 300000 entries, 0 to 299999\\n\",\n      \"Data columns (total 16 columns):\\n\",\n      \"FL_DATE                300000 non-null object\\n\",\n      \"OP_UNIQUE_CARRIER      300000 non-null object\\n\",\n      \"TAIL_NUM               299660 non-null object\\n\",\n      \"OP_CARRIER_FL_NUM      300000 non-null int64\\n\",\n      \"ORIGIN                 300000 non-null object\\n\",\n      \"DEST                   300000 non-null object\\n\",\n      \"CRS_DEP_TIME           300000 non-null int64\\n\",\n      \"DEP_TIME               296825 non-null float64\\n\",\n      \"DEP_DELAY              296825 non-null float64\\n\",\n      \"CRS_ARR_TIME           300000 non-null int64\\n\",\n      \"ARR_TIME               296574 non-null float64\\n\",\n      \"ARR_DELAY              295832 non-null float64\\n\",\n      \"CRS_ELAPSED_TIME       300000 non-null int64\\n\",\n      \"ACTUAL_ELAPSED_TIME    295832 non-null float64\\n\",\n      \"AIR_TIME               295832 non-null float64\\n\",\n      \"DISTANCE               300000 non-null int64\\n\",\n      \"dtypes: float64(6), int64(5), object(5)\\n\",\n      \"memory usage: 30.9+ MB\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"delays_df.info()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"TAIL_NUM, DEP_TIME, DEP_DELAY, ARR_TIME, ARR_DELAY, ACTUAL_ELAPSED_TIME, and AIR_TIME all have rows with missing values.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"There are many techniques to deal with missing values, the simplest is to delete the rows with missing values.\\n\",\n    \"\\n\",\n    \"**dropna** will delete rows containing null/missing values\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {\n    \"scrolled\": true\n   },\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"<class 'pandas.core.frame.DataFrame'>\\n\",\n      \"Int64Index: 295832 entries, 0 to 299999\\n\",\n      \"Data columns (total 16 columns):\\n\",\n      \"FL_DATE                295832 non-null object\\n\",\n      \"OP_UNIQUE_CARRIER      295832 non-null object\\n\",\n      \"TAIL_NUM               295832 non-null object\\n\",\n      \"OP_CARRIER_FL_NUM      295832 non-null int64\\n\",\n      \"ORIGIN                 295832 non-null object\\n\",\n      \"DEST                   295832 non-null object\\n\",\n      \"CRS_DEP_TIME           295832 non-null int64\\n\",\n      \"DEP_TIME               295832 non-null float64\\n\",\n      \"DEP_DELAY              295832 non-null float64\\n\",\n      \"CRS_ARR_TIME           295832 non-null int64\\n\",\n      \"ARR_TIME               295832 non-null float64\\n\",\n      \"ARR_DELAY              295832 non-null float64\\n\",\n      \"CRS_ELAPSED_TIME       295832 non-null int64\\n\",\n      \"ACTUAL_ELAPSED_TIME    295832 non-null float64\\n\",\n      \"AIR_TIME               295832 non-null float64\\n\",\n      \"DISTANCE               295832 non-null int64\\n\",\n      \"dtypes: float64(6), int64(5), object(5)\\n\",\n      \"memory usage: 32.7+ MB\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"delay_no_nulls_df = delays_df.dropna()   # Delete the rows with missing values\\n\",\n    \"delay_no_nulls_df.info()                 # Check the number of rows and number of rows with non-null values to confirm\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"If you don't need to keep the original DataFrame, you can just delete the rows within the existing DataFrame instead of creating a new one\\n\",\n    \"\\n\",\n    \"**inplace=*True*** indicates you want to drop the rows in the specified DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"<class 'pandas.core.frame.DataFrame'>\\n\",\n      \"Int64Index: 295832 entries, 0 to 299999\\n\",\n      \"Data columns (total 16 columns):\\n\",\n      \"FL_DATE                295832 non-null object\\n\",\n      \"OP_UNIQUE_CARRIER      295832 non-null object\\n\",\n      \"TAIL_NUM               295832 non-null object\\n\",\n      \"OP_CARRIER_FL_NUM      295832 non-null int64\\n\",\n      \"ORIGIN                 295832 non-null object\\n\",\n      \"DEST                   295832 non-null object\\n\",\n      \"CRS_DEP_TIME           295832 non-null int64\\n\",\n      \"DEP_TIME               295832 non-null float64\\n\",\n      \"DEP_DELAY              295832 non-null float64\\n\",\n      \"CRS_ARR_TIME           295832 non-null int64\\n\",\n      \"ARR_TIME               295832 non-null float64\\n\",\n      \"ARR_DELAY              295832 non-null float64\\n\",\n      \"CRS_ELAPSED_TIME       295832 non-null int64\\n\",\n      \"ACTUAL_ELAPSED_TIME    295832 non-null float64\\n\",\n      \"AIR_TIME               295832 non-null float64\\n\",\n      \"DISTANCE               295832 non-null int64\\n\",\n      \"dtypes: float64(6), int64(5), object(5)\\n\",\n      \"memory usage: 32.7+ MB\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"delays_df.dropna(inplace=True)\\n\",\n    \"delays_df.info()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"When data is loaded from multiple data sources you sometimes end up with duplicate records. \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"2          Dulles  Washington             USA\\n\",\n       \"3        Heathrow      London  United Kingdom\\n\",\n       \"4        Schiphol   Amsterdam     Netherlands\"\n      ]\n     },\n     \"execution_count\": 6,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.read_csv('Data/airportsDuplicateRows.csv')\\n\",\n    \"airports_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"use **duplicates** to find the duplicate rows.\\n\",\n    \"\\n\",\n    \"If a row is a duplicate of a previous row it returns **True**\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"0    False\\n\",\n       \"1    False\\n\",\n       \"2     True\\n\",\n       \"3    False\\n\",\n       \"4    False\\n\",\n       \"5    False\\n\",\n       \"6    False\\n\",\n       \"7    False\\n\",\n       \"dtype: bool\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df.duplicated()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"**drop_duplicates** will delete the duplicate rows\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>City</th>\\n\",\n       \"      <th>Country</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Seattle-Tacoma</td>\\n\",\n       \"      <td>Seattle</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Dulles</td>\\n\",\n       \"      <td>Washington</td>\\n\",\n       \"      <td>USA</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>Heathrow</td>\\n\",\n       \"      <td>London</td>\\n\",\n       \"      <td>United Kingdom</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>Schiphol</td>\\n\",\n       \"      <td>Amsterdam</td>\\n\",\n       \"      <td>Netherlands</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>5</th>\\n\",\n       \"      <td>Changi</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"      <td>Singapore</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>6</th>\\n\",\n       \"      <td>Pearson</td>\\n\",\n       \"      <td>Toronto</td>\\n\",\n       \"      <td>Canada</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>7</th>\\n\",\n       \"      <td>Narita</td>\\n\",\n       \"      <td>Tokyo</td>\\n\",\n       \"      <td>Japan</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"             Name        City         Country\\n\",\n       \"0  Seattle-Tacoma     Seattle             USA\\n\",\n       \"1          Dulles  Washington             USA\\n\",\n       \"3        Heathrow      London  United Kingdom\\n\",\n       \"4        Schiphol   Amsterdam     Netherlands\\n\",\n       \"5          Changi   Singapore       Singapore\\n\",\n       \"6         Pearson     Toronto          Canada\\n\",\n       \"7          Narita       Tokyo           Japan\"\n      ]\n     },\n     \"execution_count\": 8,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"airports_df.drop_duplicates(inplace=True)\\n\",\n    \"airports_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/09 - Handling duplicates and rows with missing values/README.md",
    "content": "# Handling duplicates and rows with missing values\r\n\r\nWhen preparing data for machine learning you need to remove duplicate rows and you may need to delete rows with missing values.\r\n\r\n## Common functions\r\n\r\n- [dropna](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.duplicated.html) removes rows with missing values\r\n- [duplicated](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.duplicated.html) returns a True or False to indicate if a row is a duplicate of a previous row\r\n- [drop_duplicates](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop_duplicates.html) returns a DataFrame with duplicate rows removed\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/09 - Handling duplicates and rows with missing values/airportsDuplicateRows.csv",
    "content": "﻿Name,City,Country\r\nSeattle-Tacoma,Seattle,USA\r\nDulles,Washington,USA\r\nDulles,Washington,USA\r\nHeathrow,London,United Kingdom\r\nSchiphol,Amsterdam,Netherlands\r\nChangi,Singapore,Singapore\r\nPearson,Toronto,Canada\r\nNarita,Tokyo,Japan\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/10 - Splitting test and training data with scikit-learn/10 - Train Test split.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Splitting test and training data\\n\",\n    \"When you train a data model you may need to split up your data into test and training data sets\\n\",\n    \"\\n\",\n    \"To accomplish this task we will use the [scikit-learn](https://scikit-learn.org/stable/) library\\n\",\n    \"\\n\",\n    \"scikit-learn is an open source, BSD licensed library for data science for preprocessing and training models.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Before we can split our data test and training data, we need to do some data preparation\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Let's load our csv file with information about flights and flight delays\\n\",\n    \"\\n\",\n    \"Use **shape** to find out how many rows and columns are in the original DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(300000, 16)\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv')\\n\",\n    \"delays_df.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Split data into features and labels\\n\",\n    \"Create a DataFrame called X containing only the features we want to use to train our model.\\n\",\n    \"\\n\",\n    \"**Note** You can only use numeric values as features, if you have non-numeric values you must apply different techniques such as Hot Encoding to convert these into numeric values before using them as features to train a model. Check out Data Science courses for more information on these techniques!\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>1670</td>\\n\",\n       \"      <td>225</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>580</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>580</td>\\n\",\n       \"      <td>105</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>580</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"   DISTANCE  CRS_ELAPSED_TIME\\n\",\n       \"0      1670               225\\n\",\n       \"1      1670               225\\n\",\n       \"2       580               105\\n\",\n       \"3       580               105\\n\",\n       \"4       580               100\"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"X = delays_df.loc[:,['DISTANCE', 'CRS_ELAPSED_TIME']]\\n\",\n    \"X.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Create a DataFrame called y containing only the value we want to predict with our model. \\n\",\n    \"\\n\",\n    \"In our case we want to predict how many minutes late a flight will arrive. This information is in the ARR_DELAY column. \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>-17.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"   ARR_DELAY\\n\",\n       \"0      -17.0\\n\",\n       \"1      -25.0\\n\",\n       \"2      -13.0\\n\",\n       \"3      -12.0\\n\",\n       \"4       -7.0\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y = delays_df.loc[:,['ARR_DELAY']]\\n\",\n    \"y.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Split into test and training data\\n\",\n    \"Use **scikitlearn train_test_split** to move 30% of the rows into Test DataFrames\\n\",\n    \"\\n\",\n    \"The other 70% of the rows into DataFrames we can use to train our model\\n\",\n    \"\\n\",\n    \"NOTE: by specifying a value for *random_state* we ensure that if we run the code again the same rows will be moved into the test DataFrame. This makes our results repeatable.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"from sklearn.model_selection import train_test_split\\n\",\n    \"\\n\",\n    \"X_train, X_test, y_train, y_test = train_test_split(\\n\",\n    \"                                                    X, \\n\",\n    \"                                                    y, \\n\",\n    \"                                                    test_size=0.3, \\n\",\n    \"                                                    random_state=42\\n\",\n    \"                                                   )\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"We now have a DataFrame **X_train** which contains 70% of the rows\\n\",\n    \"\\n\",\n    \"We will use this DataFrame to train our model\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(210000, 2)\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"X_train.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"The DataFrame **X_test** contains the remaining 30% of the rows\\n\",\n    \"\\n\",\n    \"We will use this DataFrame to test our trained model, so we can check it's accuracy\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(90000, 2)\"\n      ]\n     },\n     \"execution_count\": 8,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"X_test.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"**X_train** and **X_test** contain our features\\n\",\n    \"\\n\",\n    \"The features are the columns we think can help us predict how late a flight will arrive: **DISTANCE** and **CRS_ELAPSED_TIME**\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 9,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>DISTANCE</th>\\n\",\n       \"      <th>CRS_ELAPSED_TIME</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>186295</th>\\n\",\n       \"      <td>237</td>\\n\",\n       \"      <td>60</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>127847</th>\\n\",\n       \"      <td>411</td>\\n\",\n       \"      <td>111</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>274740</th>\\n\",\n       \"      <td>342</td>\\n\",\n       \"      <td>85</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>74908</th>\\n\",\n       \"      <td>1005</td>\\n\",\n       \"      <td>164</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>11630</th>\\n\",\n       \"      <td>484</td>\\n\",\n       \"      <td>100</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"        DISTANCE  CRS_ELAPSED_TIME\\n\",\n       \"186295       237                60\\n\",\n       \"127847       411               111\\n\",\n       \"274740       342                85\\n\",\n       \"74908       1005               164\\n\",\n       \"11630        484               100\"\n      ]\n     },\n     \"execution_count\": 9,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"X_train.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {\n    \"scrolled\": true\n   },\n   \"source\": [\n    \"The DataFrame **y_train**  contains 70% of the rows\\n\",\n    \"\\n\",\n    \"We will use this DataFrame to train our model\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"If you don't need to keep the original DataFrame, you can just delete the rows within the existing DataFrame instead of creating a new one\\n\",\n    \"**inplace=*True*** indicates you want to drop the rows in the specified DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 27,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(210000, 1)\"\n      ]\n     },\n     \"execution_count\": 27,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_train.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"The DataFrame **y_test** contains the remaining 30% of the rows\\n\",\n    \"\\n\",\n    \"We will use this DataFrame to test our trained model, so we can check it's accuracy\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 28,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"(90000, 1)\"\n      ]\n     },\n     \"execution_count\": 28,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_test.shape\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"**y_train** and **y_test** contain our label\\n\",\n    \"\\n\",\n    \"The label is the columns we want to predict with our trained model: **ARR_DELAY**\\n\",\n    \"\\n\",\n    \"**NOTE:**  a negative value for ARR_DELAY indicates a flight arrived early\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 29,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>186295</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>127847</th>\\n\",\n       \"      <td>-16.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>274740</th>\\n\",\n       \"      <td>-10.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>74908</th>\\n\",\n       \"      <td>-19.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>11630</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"        ARR_DELAY\\n\",\n       \"186295       -7.0\\n\",\n       \"127847      -16.0\\n\",\n       \"274740      -10.0\\n\",\n       \"74908       -19.0\\n\",\n       \"11630       -13.0\"\n      ]\n     },\n     \"execution_count\": 29,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_train.head()\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/10 - Splitting test and training data with scikit-learn/README.md",
    "content": "# Splitting test and training data with scikit-learn\r\n\r\n[scikit-learn](https://scikit-learn.org/) is a library of tools for predictive data analysis, which will allow you to prepare your data for machine learning and create models.\r\n\r\n## Common functions\r\n\r\n- [train_test_split](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) splits arrays into random train and test subsets\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/11 - Train a linear regression model with scikit-learn/11 - Train a basic model.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Train a linear regression model\\n\",\n    \"When you have your data prepared you can train a model.\\n\",\n    \"\\n\",\n    \"There are multiple libraries and methods you can call to train models. In this notebook we will use the **LinearRegression** model in the **scikit-learn** library\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"We need our DataFrame, with data loaded, all the rows with null values removed, and the features and labels split into the separate training and test data. So, we'll start by just rerunning the commands from the previous notebooks.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\\n\",\n    \"from sklearn.model_selection import train_test_split\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# Load our data from the csv file\\n\",\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv') \\n\",\n    \"\\n\",\n    \"# Remove rows with null values since those will crash our linear regression model training\\n\",\n    \"delays_df.dropna(inplace=True)\\n\",\n    \"\\n\",\n    \"# Move our features into the X DataFrame\\n\",\n    \"X = delays_df.loc[:,['DISTANCE', 'CRS_ELAPSED_TIME']]\\n\",\n    \"\\n\",\n    \"# Move our labels into the y DataFrame\\n\",\n    \"y = delays_df.loc[:,['ARR_DELAY']] \\n\",\n    \"\\n\",\n    \"# Split our data into test and training DataFrames\\n\",\n    \"X_train, X_test, y_train, y_test = train_test_split(\\n\",\n    \"                                                    X, \\n\",\n    \"                                                    y, \\n\",\n    \"                                                    test_size=0.3, \\n\",\n    \"                                                    random_state=42\\n\",\n    \"                                                   )\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Use **Scikitlearn LinearRegression** *fit* method to train a linear regression model based on the training data stored in X_train and y_train\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"from sklearn.linear_model import LinearRegression\\n\",\n    \"\\n\",\n    \"regressor = LinearRegression()     # Create a scikit learn LinearRegression object\\n\",\n    \"regressor.fit(X_train, y_train)    # Use the fit method to train the model using your training data\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"The *regressor* object now contains your trained Linear Regression model\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/11 - Train a linear regression model with scikit-learn/README.md",
    "content": "# Train a linear regression model with scikit-learn\r\n\r\n[Linear regression](https://en.wikipedia.org/wiki/Linear_regression) is a common algorithm for predicting values based on a given dataset.\r\n\r\n## Common classes and functions\r\n\r\n- [LinearRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html) fits a linear model\r\n- [LinearRegression.fit](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html?highlight=linearregression#sklearn.linear_model.LinearRegression.fit) is used to fit the linear model based on training data\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/12 - Testing a model/12 - Test a model.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Test a trained model\\n\",\n    \"Once you have trained a model, you can test it with the test data you put aside\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"We will start by rerunning the code from the previous notebook to create a trained model\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\\n\",\n    \"from sklearn.model_selection import train_test_split\\n\",\n    \"from sklearn.linear_model import LinearRegression\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"# Load our data from the csv file\\n\",\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv') \\n\",\n    \"\\n\",\n    \"# Remove rows with null values since those will crash our linear regression model training\\n\",\n    \"delays_df.dropna(inplace=True)\\n\",\n    \"\\n\",\n    \"# Move our features into the X DataFrame\\n\",\n    \"X = delays_df.loc[:,['DISTANCE', 'CRS_ELAPSED_TIME']]\\n\",\n    \"\\n\",\n    \"# Move our labels into the y DataFrame\\n\",\n    \"y = delays_df.loc[:,['ARR_DELAY']] \\n\",\n    \"\\n\",\n    \"# Split our data into test and training DataFrames\\n\",\n    \"X_train, X_test, y_train, y_test = train_test_split(\\n\",\n    \"                                                    X, \\n\",\n    \"                                                    y, \\n\",\n    \"                                                    test_size=0.3, \\n\",\n    \"                                                    random_state=42\\n\",\n    \"                                                   )\\n\",\n    \"regressor = LinearRegression()     # Create a scikit learn LinearRegression object\\n\",\n    \"regressor.fit(X_train, y_train)    # Use the fit method to train the model using your training data\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Test the model\\n\",\n    \"Use **Scikitlearn LinearRegression predict** to have our trained model predict values for our test data\\n\",\n    \"\\n\",\n    \"We stored our test data in X_Test\\n\",\n    \"\\n\",\n    \"We will store the predicted results in  y_pred\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"y_pred = regressor.predict(X_test)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"array([[3.47739078],\\n\",\n       \"       [5.89055919],\\n\",\n       \"       [4.33288464],\\n\",\n       \"       ...,\\n\",\n       \"       [5.84678979],\\n\",\n       \"       [6.05195889],\\n\",\n       \"       [5.66255414]])\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_pred\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"When we split our data into training and test data we stored the actual values for each row of test data in the DataFrame y_test\\n\",\n    \"\\n\",\n    \"We can compare the values in y_pred to the value in y_test to get a sense of how accurately our mdoel predicted arrival delays\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>291483</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>98997</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>23454</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>110802</th>\\n\",\n       \"      <td>-14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>49449</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>94944</th>\\n\",\n       \"      <td>14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>160885</th>\\n\",\n       \"      <td>-17.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>47572</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>164800</th>\\n\",\n       \"      <td>20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>62578</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>196742</th>\\n\",\n       \"      <td>5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>91166</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>171564</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>60706</th>\\n\",\n       \"      <td>6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>240773</th>\\n\",\n       \"      <td>-6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>32695</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>98399</th>\\n\",\n       \"      <td>-23.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>167341</th>\\n\",\n       \"      <td>-11.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>126191</th>\\n\",\n       \"      <td>-4.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>188715</th>\\n\",\n       \"      <td>131.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>258610</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>215751</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>41210</th>\\n\",\n       \"      <td>-15.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>68090</th>\\n\",\n       \"      <td>-19.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>140794</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>178840</th>\\n\",\n       \"      <td>-14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>248071</th>\\n\",\n       \"      <td>21.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>12770</th>\\n\",\n       \"      <td>5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>95948</th>\\n\",\n       \"      <td>40.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>172913</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>...</th>\\n\",\n       \"      <td>...</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>200797</th>\\n\",\n       \"      <td>21.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>36199</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>70402</th>\\n\",\n       \"      <td>-37.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>285308</th>\\n\",\n       \"      <td>152.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>201508</th>\\n\",\n       \"      <td>-2.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>154671</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>238535</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>133567</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3349</th>\\n\",\n       \"      <td>-8.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>257254</th>\\n\",\n       \"      <td>-28.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>106572</th>\\n\",\n       \"      <td>-19.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>73023</th>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>214699</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>274435</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>67089</th>\\n\",\n       \"      <td>-10.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>269917</th>\\n\",\n       \"      <td>-4.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>164966</th>\\n\",\n       \"      <td>70.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>275120</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>139292</th>\\n\",\n       \"      <td>-8.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>31106</th>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>277799</th>\\n\",\n       \"      <td>17.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>293749</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>231114</th>\\n\",\n       \"      <td>35.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>11645</th>\\n\",\n       \"      <td>-15.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>252520</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>209898</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>22210</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>165727</th>\\n\",\n       \"      <td>-6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>260838</th>\\n\",\n       \"      <td>-33.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>192546</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"<p>88750 rows × 1 columns</p>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"        ARR_DELAY\\n\",\n       \"291483       -5.0\\n\",\n       \"98997       -12.0\\n\",\n       \"23454        -9.0\\n\",\n       \"110802      -14.0\\n\",\n       \"49449       -20.0\\n\",\n       \"...           ...\\n\",\n       \"209898      -20.0\\n\",\n       \"22210        -9.0\\n\",\n       \"165727       -6.0\\n\",\n       \"260838      -33.0\\n\",\n       \"192546        0.0\\n\",\n       \"\\n\",\n       \"[88750 rows x 1 columns]\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_test\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/12 - Testing a model/README.md",
    "content": "# Testing a model\r\n\r\nOnce a model is built it can be used to predict values. You can provide new values to see where it would fall on the spectrum, and test the generated model.\r\n\r\n## Common classes and functions\r\n\r\n- [LinearRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html) fits a linear model\r\n- [LinearRegression.predict](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html?highlight=linearregression#sklearn.linear_model.LinearRegression.predict) is used to predict outcomes for new data based on the trained linear model\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/13 - Evaluating accuracy of a model using calculations/13 - Evaluate accuracy.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Evaluating accuracy of a model using calculations\\n\",\n    \"After you train a model, you need to get a sense of it's accuracy. The accuracy of a model gives you an idea of how much confidence you can put it predictions made by the model.\\n\",\n    \"\\n\",\n    \"The **scitkit-learn** and **numpy** libraries are both helpful for measuring model accuracy\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Let's start by recreating our trained linear regression model from the last lesson\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\\n\",\n    \"from sklearn.model_selection import train_test_split\\n\",\n    \"from sklearn.linear_model import LinearRegression\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# Load our data from the csv file\\n\",\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv') \\n\",\n    \"\\n\",\n    \"# Remove rows with null values since those will crash our linear regression model training\\n\",\n    \"delays_df.dropna(inplace=True)\\n\",\n    \"\\n\",\n    \"# Move our features into the X DataFrame\\n\",\n    \"X = delays_df.loc[:,['DISTANCE', 'CRS_ELAPSED_TIME']]\\n\",\n    \"\\n\",\n    \"# Move our labels into the y DataFrame\\n\",\n    \"y = delays_df.loc[:,['ARR_DELAY']] \\n\",\n    \"\\n\",\n    \"# Split our data into test and training DataFrames\\n\",\n    \"X_train, X_test, y_train, y_test = train_test_split(\\n\",\n    \"                                                    X, \\n\",\n    \"                                                    y, \\n\",\n    \"                                                    test_size=0.3, \\n\",\n    \"                                                    random_state=42\\n\",\n    \"                                                   )\\n\",\n    \"regressor = LinearRegression()     # Create a scikit learn LinearRegression object\\n\",\n    \"regressor.fit(X_train, y_train)    # Use the fit method to train the model using your training data\\n\",\n    \"\\n\",\n    \"y_pred = regressor.predict(X_test)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Measuring accuracy\\n\",\n    \"Now that we have a trained model there are a number of metrics you can use to check the accuracy of the model. \\n\",\n    \"\\n\",\n    \"All these metrics are based on mathematical calculations, the key take-away here is you don't have to calculate everything yourself. Scikit-learn and numpy will do most of the work and provide good performance.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"### Mean Squared Error (MSE)\\n\",\n    \"The MSE is the average error performed by the model when predicting the outcome for an observation. \\n\",\n    \"The lower the MSE, the better the model.\\n\",\n    \"\\n\",\n    \"MSE is the average squared difference between the observed actual outome values and the values predicted by the model.\\n\",\n    \"\\n\",\n    \"MSE = mean((actuals - predicteds)^2) \\n\",\n    \"\\n\",\n    \"We could write code to loop through our records comparing actual and predicated values to perform this calculation, but we don't have to! Just use **mean_squared_error** from the **scikit-learn** library\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"Mean Squared Error: 2250.4445141530855\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"from sklearn import metrics\\n\",\n    \"print('Mean Squared Error:', metrics.mean_squared_error(y_test, y_pred))\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Root Mean Squared Error (RMSE)\\n\",\n    \"RMSE is the average error performed by the model when predicting the outcome for an observation. \\n\",\n    \"The lower the RMSE, the better the model.\\n\",\n    \"\\n\",\n    \"Mathematically, the RMSE is the square root of the mean squared error \\n\",\n    \"\\n\",\n    \"RMSE = sqrt(MSE)\\n\",\n    \"\\n\",\n    \"Skikit learn does not have a function for RMSE, but since it's just the square root of MSE, we can use the numpy library which contains lots of mathematical functions to calculate the square root of the MSE\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import numpy as np\\n\",\n    \"print('Root Mean Squared Error:', np.sqrt(metrics.mean_squared_error(y_test, y_pred)))\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Mean Absolute Error (MAE)\\n\",\n    \"MAE measures the prediction error. The lower the MAE the better the model\\n\",\n    \"\\n\",\n    \"Mathematically, it is the average absolute difference between observed and predicted outcomes\\n\",\n    \"\\n\",\n    \"MAE = mean(abs(actuals - predicteds)). \\n\",\n    \"\\n\",\n    \"MAE is less sensitive to outliers compared to RMSE. Calculate RMSE using **mean_absolute_error** in the **scikit-learn** library\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"print('Mean absolute error: ',metrics.mean_absolute_error(y_test, y_pred))\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# R^2 or R-Squared\\n\",\n    \"\\n\",\n    \"R squared is the proportion of variation in the outcome that is explained by the predictor variables. It is an indication of how much the values passed to the model influence the predicted value. \\n\",\n    \"\\n\",\n    \"The Higher the R-squared, the better the model. Calculate R-Squared using **r2_score** in the **scikit-learn** library.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"print('R^2: ',metrics.r2_score(y_test, y_pred))\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Different models have different ways to measure accuracy. Fortunately **scikit-learn** and **numpy** provide a wide variety of functions to help measure accuracy.\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/13 - Evaluating accuracy of a model using calculations/README.md",
    "content": "# Evaluating accuracy of a model using calculations\r\n\r\nPlaying with individual values isn't the best way to test a model. Fortunately, [scikit-learn](https://scikit-learn.org/) provides tools for automated testing an analysis.\r\n\r\n## Common functions\r\n\r\n- [metrics](https://scikit-learn.org/stable/modules/classes.html?highlight=metrics#module-sklearn.metrics) includes functions and metrics that can be used for data science including measuring accuracy of models\r\n- [mean_squared_error](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html#sklearn.metrics.mean_squared_error) returns the mean squared error, a measure used to measure accuracy of linear regression models\r\n- [r2_score](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.r2_score.html#sklearn.metrics.r2_score) returns the R^2 regression score, a measure used to measure accuracy of linear regression models\r\n\r\n## NumPy\r\n\r\n[NumPy](https://numpy.org/) is a package for scientific computing with Python\r\n\r\n### Common functions\r\n\r\n- [sqrt](https://numpy.org/doc/1.18/reference/generated/numpy.sqrt.html?highlight=sqrt#numpy.sqrt) returns the square root of a value\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/14 - NumPy vs Pandas/14 - Working with numpy and pandas.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Moving data from numpy arrays to pandas DataFrames\\n\",\n    \"In our last notebook we trained a model and compared our actual and predicted results\\n\",\n    \"\\n\",\n    \"What may not have been evident was when we did this we were working with two different objects: a **numpy array** and a **pandas DataFrame**\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"To explore further let's rerun the code from the previous notebook to create a trained model and get predicted values for our test data\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\\n\",\n    \"from sklearn.model_selection import train_test_split\\n\",\n    \"from sklearn.linear_model import LinearRegression\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# Load our data from the csv file\\n\",\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv') \\n\",\n    \"\\n\",\n    \"# Remove rows with null values since those will crash our linear regression model training\\n\",\n    \"delays_df.dropna(inplace=True)\\n\",\n    \"\\n\",\n    \"# Move our features into the X DataFrame\\n\",\n    \"X = delays_df.loc[:,['DISTANCE','CRS_ELAPSED_TIME']]\\n\",\n    \"\\n\",\n    \"# Move our labels into the y DataFrame\\n\",\n    \"y = delays_df.loc[:,['ARR_DELAY']] \\n\",\n    \"\\n\",\n    \"# Split our data into test and training DataFrames\\n\",\n    \"X_train, X_test, y_train, y_test = train_test_split(X, \\n\",\n    \"                                                    y, \\n\",\n    \"                                                    test_size=0.3, \\n\",\n    \"                                                    random_state=42)\\n\",\n    \"regressor = LinearRegression()     # Create a scikit learn LinearRegression object\\n\",\n    \"regressor.fit(X_train, y_train)    # Use the fit method to train the model using your training data\\n\",\n    \"\\n\",\n    \"y_pred = regressor.predict(X_test)  # Generate predicted values for our test data\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"In the last Notebook, you might have noticed the output displays differently when you display the contents of the predicted values in y_pred and the actual values in y_test\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"array([[3.47739078],\\n\",\n       \"       [5.89055919],\\n\",\n       \"       [4.33288464],\\n\",\n       \"       ...,\\n\",\n       \"       [5.84678979],\\n\",\n       \"       [6.05195889],\\n\",\n       \"       [5.66255414]])\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_pred\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>ARR_DELAY</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>291483</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>98997</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>23454</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>110802</th>\\n\",\n       \"      <td>-14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>49449</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>94944</th>\\n\",\n       \"      <td>14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>160885</th>\\n\",\n       \"      <td>-17.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>47572</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>164800</th>\\n\",\n       \"      <td>20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>62578</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>196742</th>\\n\",\n       \"      <td>5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>91166</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>171564</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>60706</th>\\n\",\n       \"      <td>6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>240773</th>\\n\",\n       \"      <td>-6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>32695</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>98399</th>\\n\",\n       \"      <td>-23.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>167341</th>\\n\",\n       \"      <td>-11.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>126191</th>\\n\",\n       \"      <td>-4.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>188715</th>\\n\",\n       \"      <td>131.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>258610</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>215751</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>41210</th>\\n\",\n       \"      <td>-15.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>68090</th>\\n\",\n       \"      <td>-19.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>140794</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>178840</th>\\n\",\n       \"      <td>-14.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>248071</th>\\n\",\n       \"      <td>21.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>12770</th>\\n\",\n       \"      <td>5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>95948</th>\\n\",\n       \"      <td>40.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>172913</th>\\n\",\n       \"      <td>-13.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>...</th>\\n\",\n       \"      <td>...</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>200797</th>\\n\",\n       \"      <td>21.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>36199</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>70402</th>\\n\",\n       \"      <td>-37.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>285308</th>\\n\",\n       \"      <td>152.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>201508</th>\\n\",\n       \"      <td>-2.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>154671</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>238535</th>\\n\",\n       \"      <td>-5.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>133567</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3349</th>\\n\",\n       \"      <td>-8.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>257254</th>\\n\",\n       \"      <td>-28.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>106572</th>\\n\",\n       \"      <td>-19.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>73023</th>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>214699</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>274435</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>67089</th>\\n\",\n       \"      <td>-10.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>269917</th>\\n\",\n       \"      <td>-4.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>164966</th>\\n\",\n       \"      <td>70.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>275120</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>139292</th>\\n\",\n       \"      <td>-8.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>31106</th>\\n\",\n       \"      <td>-25.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>277799</th>\\n\",\n       \"      <td>17.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>293749</th>\\n\",\n       \"      <td>-7.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>231114</th>\\n\",\n       \"      <td>35.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>11645</th>\\n\",\n       \"      <td>-15.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>252520</th>\\n\",\n       \"      <td>-12.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>209898</th>\\n\",\n       \"      <td>-20.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>22210</th>\\n\",\n       \"      <td>-9.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>165727</th>\\n\",\n       \"      <td>-6.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>260838</th>\\n\",\n       \"      <td>-33.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>192546</th>\\n\",\n       \"      <td>0.0</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"<p>88750 rows × 1 columns</p>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"        ARR_DELAY\\n\",\n       \"291483       -5.0\\n\",\n       \"98997       -12.0\\n\",\n       \"23454        -9.0\\n\",\n       \"110802      -14.0\\n\",\n       \"49449       -20.0\\n\",\n       \"...           ...\\n\",\n       \"209898      -20.0\\n\",\n       \"22210        -9.0\\n\",\n       \"165727       -6.0\\n\",\n       \"260838      -33.0\\n\",\n       \"192546        0.0\\n\",\n       \"\\n\",\n       \"[88750 rows x 1 columns]\"\n      ]\n     },\n     \"execution_count\": 6,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"y_test\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Use **type()** to check the datatype of an object.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"numpy.ndarray\"\n      ]\n     },\n     \"execution_count\": 7,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"type(y_pred)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"pandas.core.frame.DataFrame\"\n      ]\n     },\n     \"execution_count\": 8,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"type(y_test)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"* **y_pred** is a numpy array\\n\",\n    \"* **y_test** is a pandas DataFrame\\n\",\n    \"\\n\",\n    \"Another way you might discover this is if you try to use the **head** method on **y_pred**. \\n\",\n    \"\\n\",\n    \"This will return an error, because **head** is a method of the DataFrame class it is not a method of numpy arrays\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 9,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"ename\": \"AttributeError\",\n     \"evalue\": \"'numpy.ndarray' object has no attribute 'head'\",\n     \"output_type\": \"error\",\n     \"traceback\": [\n      \"\\u001b[1;31m---------------------------------------------------------------------------\\u001b[0m\",\n      \"\\u001b[1;31mAttributeError\\u001b[0m                            Traceback (most recent call last)\",\n      \"\\u001b[1;32m<ipython-input-9-05146ec42336>\\u001b[0m in \\u001b[0;36m<module>\\u001b[1;34m\\u001b[0m\\n\\u001b[1;32m----> 1\\u001b[1;33m \\u001b[0my_pred\\u001b[0m\\u001b[1;33m.\\u001b[0m\\u001b[0mhead\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m\",\n      \"\\u001b[1;31mAttributeError\\u001b[0m: 'numpy.ndarray' object has no attribute 'head'\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"y_pred.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"A one dimensional numpy array is similar to a pandas Series\\n\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 10,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"['Pearson' 'Changi' 'Narita']\\n\",\n      \"Narita\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"import numpy as np\\n\",\n    \"airports_array = np.array(['Pearson','Changi','Narita'])\\n\",\n    \"print(airports_array)\\n\",\n    \"print(airports_array[2])\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 11,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"0    Pearson\\n\",\n      \"1     Changi\\n\",\n      \"2     Narita\\n\",\n      \"dtype: object\\n\",\n      \"Narita\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"airports_series = pd.Series(['Pearson','Changi','Narita'])\\n\",\n    \"print(airports_series)\\n\",\n    \"print(airports_series[2])\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"A two dimensional numpy array is similar to a pandas DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 12,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"[['YYZ' 'Pearson']\\n\",\n      \" ['SIN' 'Changi']\\n\",\n      \" ['NRT' 'Narita']]\\n\",\n      \"YYZ\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"airports_array = np.array([\\n\",\n    \"  ['YYZ','Pearson'],\\n\",\n    \"  ['SIN','Changi'],\\n\",\n    \"  ['NRT','Narita']])\\n\",\n    \"print(airports_array)\\n\",\n    \"print(airports_array[0,0])\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 13,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"     0        1\\n\",\n      \"0  YYZ  Pearson\\n\",\n      \"1  SIN   Changi\\n\",\n      \"2  NRT   Narita\\n\",\n      \"YYZ\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"airports_df = pd.DataFrame([['YYZ','Pearson'],['SIN','Changi'],['NRT','Narita']])\\n\",\n    \"print(airports_df)\\n\",\n    \"print(airports_df.iloc[0,0])\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"If you need the functionality of a DataFrame, you can move data from numpy objects to pandas objects and vice-versa.\\n\",\n    \"\\n\",\n    \"In the example below we use the DataFrame constructor to read the contents of the numpy array *y_pred* into a DataFrame called *predicted_df*\\n\",\n    \"\\n\",\n    \"Then we can use the functionality of the DataFrame object\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 14,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>0</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>3.477391</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>5.890559</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>2</th>\\n\",\n       \"      <td>4.332885</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>3</th>\\n\",\n       \"      <td>3.447476</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>4</th>\\n\",\n       \"      <td>5.072394</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"          0\\n\",\n       \"0  3.477391\\n\",\n       \"1  5.890559\\n\",\n       \"2  4.332885\\n\",\n       \"3  3.447476\\n\",\n       \"4  5.072394\"\n      ]\n     },\n     \"execution_count\": 14,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"predicted_df = pd.DataFrame(y_pred)\\n\",\n    \"predicted_df.head()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.6.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/14 - NumPy vs Pandas/README.md",
    "content": "# NumPy vs pandas\r\n\r\nThere are numerous libraries available for use for data scientists. NumPy and pandas are two of the most common.\r\n\r\nSome operations may return different data types. You can use the Python function [type](https://docs.python.org/3/library/functions.html#type) to determine the type of an object.\r\n\r\n## NumPy\r\n\r\n[NumPy](https://numpy.org/) is a Python package for scientific computing that includes a array and dictionary type objects for data analysis.\r\n\r\n### Common object\r\n\r\n- [array](https://numpy.org/doc/1.18/reference/generated/numpy.array.html?highlight=array#numpy.array) creates an N-dimensional array object\r\n\r\n## pandas\r\n\r\n[pandas](https://pandas.pydata.org/) is a Python package for data analysis that includes a 1 dimensional and 2 dimensional array objects\r\n\r\n### Common objects\r\n\r\n- [Series](https://pandas.pydata.org/docs/reference/api/pandas.Series.html) stores a one dimensional array\r\n- [DataFrame](https://pandas.pydata.org/docs/reference/frame.html) stores a two-dimensional array\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/15 - Visualizing data with Matplotlib/15 - Visualizing correlations.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# Visualizing data with matplotlib\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"Somtimes graphs provide the best way to visualize data\\n\",\n    \"\\n\",\n    \"The **matplotlib** library allows you to draw graphs to help with visualization\\n\",\n    \"\\n\",\n    \"If we want to visualize data, we will need to load some data into a DataFrame\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import pandas as pd\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# Load our data from the csv file\\n\",\n    \"delays_df = pd.read_csv('Data/Lots_of_flight_data.csv') \"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"In order to display plots we need to import the **matplotlib** library\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import matplotlib.pyplot as plt\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"A common plot used in data science is the scatter plot for checking the relationship between two columns\\n\",\n    \"If you see dots scattered everywhere,  there is no correlation between the two columns\\n\",\n    \"If you see somethign resembling a line, there is a correlation between the two columns\\n\",\n    \"\\n\",\n    \"You can use the plot method of the DataFrame to draw the scatter plot\\n\",\n    \"* kind - the type of graph to draw\\n\",\n    \"* x - value to plot as x\\n\",\n    \"* y - value to plot as y\\n\",\n    \"* color - color to use for the graph points\\n\",\n    \"* alpha - opacity - useful to show density of points in a scatter plot\\n\",\n    \"* title - title of the graph\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {\n    \"scrolled\": true\n   },\n   \"outputs\": [],\n   \"source\": [\n    \"#Check if there is a relationship between the distance of a flight and how late the flight arrives\\n\",\n    \"delays_df.plot(\\n\",\n    \"               kind='scatter',\\n\",\n    \"               x='DISTANCE',\\n\",\n    \"               y='ARR_DELAY',\\n\",\n    \"               color='blue',\\n\",\n    \"               alpha=0.3,\\n\",\n    \"               title='Correlation of arrival and distance'\\n\",\n    \"              )\\n\",\n    \"plt.show()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"#Check if there is a relationship between the how late the flight leaves and how late the flight arrives\\n\",\n    \"delays_df.plot(\\n\",\n    \"               kind='scatter',\\n\",\n    \"               x='DEP_DELAY',\\n\",\n    \"               y='ARR_DELAY',\\n\",\n    \"               color='blue',\\n\",\n    \"               alpha=0.3,\\n\",\n    \"               title='Correlation of arrival and departure delay'\\n\",\n    \"              )\\n\",\n    \"plt.show()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"The scatter plot allows us to see there is no correlation between distance and arrival delay but there is a strong correlation between departure delay and arrival delay.\\n\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.7.3\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/15 - Visualizing data with Matplotlib/README.md",
    "content": "# Visualizing data with Matplotlib\r\n\r\n[Matplotlib](https://matplotlib.org/) gives you the ability to draw charts which can be used to visualize data.\r\n\r\n## Common tools and functions\r\n\r\n- [pyplot](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.html?highlight=pyplot#module-matplotlib.pyplot) provides the ability to draw plots similar to the MATLAB tool\r\n- [pyplot.plot](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot) plots a graph\r\n- [pyplot.show](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show) displays figures such as a graph\r\n- [pyplot.scatter](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html?highlight=scatter%20plot#matplotlib.pyplot.scatter) is used to draw scatter plots, a diagram that shows the relationship between two sets of data\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Intro to machine learning with Python and Azure Notebooks](https://docs.microsoft.com/learn/paths/intro-to-ml-with-python/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "even-more-python-for-beginners-data-tools/README.md",
    "content": "# Even more Python for beginners - data tools\n\n## Overview\n\nData science and machine learning among the most popular fields today, in which Python is one of the most popular languages. As you might expect, there are several libraries and tools available to you. As you begin your journey into this field, it will help to be familiar with the most common frameworks and techniques. This is what we're here to help you with!\n\nWe're going to introduce [Jupyter notebooks](https://jupyter.org/), a common tool for data scientists. We're also going to show off [pandas](https://pandas.pydata.org/) which is used to help manage and explore data, and [scikit-learn](https://scikit-learn.org/) for incorporating machine learning. You'll see how to bring everything together and walk through a common scenario of loading data and running it through a particular algorithm.\n\nOur goal is to help show you the tools you'll be using as you dig deeper into data science and machine learning. While we won't highlight the decision points of algorithms or collecting the data (there are other courses available for those topics), you will explore the techniques and libraries.\n\n### What you'll learn\n\n- Jupyter notebooks\n- pandas DataFrame for managing data\n- NumPy for arrays\n- scikit-learn for machine learning\n\n### What we don't cover\n\n- Theory behind machine learning\n- Algorithm selection\n- Managing big data\n\n## Prerequisites\n\n- [An understanding of Git](https://git-scm.com/book/en/v1/Getting-Started)\n- [An understanding of Python](https://aka.ms/pythonbeginnerseries)\n\n## Next steps\n\nAs the goal of this course is to help get you up to speed on Python so you can work through a quick start, the next step after completing the videos is to follow a tutorial! Here's a few of our favorites:\n\n- [Predict flight delays by creating a machine learning model in Python](https://docs.microsoft.com/learn/modules/predict-flight-delays-with-python?WT.mc_id=python-c9-niner)\n- [Train a machine learning model with Azure Machine Learning](https://docs.microsoft.com/learn/modules/train-local-model-with-azure-mls?WT.mc_id=python-c9-niner)\n- [Analyze climate data](https://docs.microsoft.com/learn/modules/analyze-climate-data-with-azure-notebooks?WT.mc_id=python-c9-niner)\n- [Use unsupervised learning to analyze unlabeled data](https://docs.microsoft.com/learn/modules/introduction-to-unsupervised-learning?WT.mc_id=python-c9-niner)\n"
  },
  {
    "path": "more-python-for-beginners/.gitignore",
    "content": "\n# Created by https://www.gitignore.io/api/python,virtualenv,visualstudiocode\n# Edit at https://www.gitignore.io/?templates=python,virtualenv,visualstudiocode\n\n### Python ###\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\npip-wheel-metadata/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n.hypothesis/\n.pytest_cache/\n\n# Translations\n*.mo\n*.pot\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# pyenv\n.python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# celery beat schedule file\ncelerybeat-schedule\n\n# SageMath parsed files\n*.sage.py\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# Mr Developer\n.mr.developer.cfg\n.project\n.pydevproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n### VirtualEnv ###\n# Virtualenv\n# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/\npyvenv.cfg\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\npip-selfcheck.json\n\n### VisualStudioCode ###\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n\n### VisualStudioCode Patch ###\n# Ignore all local history of files\n.history\n\n# End of https://www.gitignore.io/api/python,virtualenv,visualstudiocode"
  },
  {
    "path": "more-python-for-beginners/01 - Formatting and linting/.vscode/settings.json",
    "content": "{\r\n    \"python.linting.pylintEnabled\": true,\r\n    \"python.linting.enabled\": true,\r\n    \"python.linting.flake8Enabled\": false,\r\n    \"python.linting.banditEnabled\": false,\r\n    \"python.linting.pycodestyleEnabled\": false,\r\n    \"python.linting.mypyEnabled\": false\r\n}"
  },
  {
    "path": "more-python-for-beginners/01 - Formatting and linting/README.md",
    "content": "# Style Guidelines\r\n\r\n## Formatting\r\n\r\nFormatting makes code readable and easier to debug.\r\n\r\n## Documentation\r\n\r\n- [PEP 8](https://pep8.org/) is a set of coding conventions for Python code\r\n- [Docstring](https://www.python.org/dev/peps/pep-0257/) is the standard for documenting a module, function, class or method definition\r\n\r\n## Linting\r\n\r\nLinting helps you identify formatting and convention issues in your Python code\r\n\r\n- [Pylint](https://www.pylint.org/) Pylint is a linter for Python to help enforce coding standards and check for errors in Python code\r\n- [Linting Python in Visual Studio Code](https://code.visualstudio.com/docs/python/linting) will show you how to enable litners in VS Code\r\n- [Type hints](https://docs.python.org/3/library/typing.html) allow some interactive development environments and linters to enforce types\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Set up your Python beginner development environment with Visual Studio Code](https://docs.microsoft.com/learn/languages/python-install-vscode/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/01 - Formatting and linting/bad.py",
    "content": "x = 12\nif x == 24:\n print('Is valid')\nelse:\n    print(\"Not valid\")\n\ndef helper(name='sample'):\n pass\n\ndef another(name = 'sample'):\n         pass\n"
  },
  {
    "path": "more-python-for-beginners/01 - Formatting and linting/good.py",
    "content": "def print_hello(name: str) -> str:\n    \"\"\"\n    Greets the user by name\n\n\tParameters:\n\t\tname (str): The name of the user\n\tReturns:\n\t\tstr: The greeting\n\t\"\"\"\n\tprint('Hello, ' + name)\n"
  },
  {
    "path": "more-python-for-beginners/02 - Lambdas/README.md",
    "content": "# Lambdas\r\n\r\nA [lambda](https://www.w3schools.com/python/python_lambda.asp) function is a small anonymous function. It can take any number of arguments but can only execute one expression.\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Create reusable functionality with functions in Python](https://docs.microsoft.com/learn/languages/python-functions/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/02 - Lambdas/failed_sort.py",
    "content": "# This code will return an error because the sort method does not know\r\n# which presenter field to use when sorting\r\npresenters = [\r\n    {'name': 'Susan', 'age': 50},\r\n    {'name': 'Christopher', 'age': 47}\r\n]\r\n\r\npresenters.sort()\r\nprint(presenters)\r\n"
  },
  {
    "path": "more-python-for-beginners/02 - Lambdas/lambda_sorter.py",
    "content": "# Sort alphabetically\npresenters = [\n    {'name': 'Susan', 'age': 50},\n    {'name': 'Christopher', 'age': 47}\n]\n\npresenters.sort(key=lambda item: item['name'])\nprint('-- alphabetically --')\nprint(presenters)\n\n# Sort by length of name (shortest to longest)\npresenters.sort(key=lambda item: len(item['name']))\nprint('-- length --')\nprint(presenters)\n"
  },
  {
    "path": "more-python-for-beginners/02 - Lambdas/method_sorter.py",
    "content": "def sorter(item):\n    return item['name']\n\n\npresenters = [\n    {'name': 'Susan', 'age': 50},\n    {'name': 'Christopher', 'age': 47}\n]\npresenters.sort(key=sorter)\nprint(presenters)\n"
  },
  {
    "path": "more-python-for-beginners/03 - Classes/README.md",
    "content": "# Classes\r\n\r\n[Classes](https://docs.python.org/3/tutorial/classes.html) define data structures and behavior. Classes allow you to group data and functionality together.\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Object-oriented programming in Python](https://docs.microsoft.com/learn/modules/python-object-oriented-programming/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/03 - Classes/basic_class.py",
    "content": "class Presenter():\n\tdef __init__(self, name):\n\t\t# Constructor\n\t\tself.name = name\n\tdef say_hello(self):\n\t\t# method\n\t\tprint('Hello, ' + self.name)\n\npresenter = Presenter('Chris')\npresenter.name = 'Christopher'\npresenter.say_hello()"
  },
  {
    "path": "more-python-for-beginners/03 - Classes/properties_class.py",
    "content": "class Presenter():\n\tdef __init__(self, name):\n\t\t# Constructor\n\t\tself.name = name\n\n\t@property\n\tdef name(self):\n\t\tprint('Retrieving name...')\n\t\treturn self.__name\n\t@name.setter\n\tdef name(self, value):\n\t\t# cool validation here\n\t\tprint('Validating name...')\n\t\tself.__name = value\n\npresenter = Presenter('Chris')\npresenter.name = 'Christopher'\nprint(presenter.name)"
  },
  {
    "path": "more-python-for-beginners/04 - Inheritance/README.md",
    "content": "# Inheritance\r\n\r\n[Inheritance](https://docs.python.org/3/tutorial/classes.html#inheritance) allows you to define a class that inherits all the methods and properties from another class. The parent or base class is the class being inherited from. The child or derived class is the class that inherits from another class.\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Object-oriented programming in Python](https://docs.microsoft.com/learn/modules/python-object-oriented-programming/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/04 - Inheritance/demo.py",
    "content": "class Person:\n\tdef __init__(self, name):\n\t\tself.name = name\n\tdef say_hello(self):\n\t\tprint('Hello, ' + self.name)\n\nclass Student(Person):\n\tdef __init__(self, name, school):\n\t\tsuper().__init__(name)\n\t\tself.school = school\n\tdef sing_school_song(self):\n\t\tprint('Ode to ' + self.school)\n\nstudent = Student('Christopher', 'UVM')\nstudent.say_hello()\nstudent.sing_school_song()\n# What are you?\nprint(isinstance(student, Student))\nprint(isinstance(student, Person))\nprint(issubclass(Student, Person))\n"
  },
  {
    "path": "more-python-for-beginners/05 - Mixins/README.md",
    "content": "# Mixins (multiple inheritance)\r\n\r\nPython allows you to inherit from multiple classes. While the technical term for this is multiple inheritance, many developers refer to the use of more than one base class adding a mixin. These are commonly used in frameworks such as [Django](https://www.djangoproject.com).\r\n\r\n- [Multiple Inheritance](https://docs.python.org/3/tutorial/classes.html#multiple-inheritance)\r\n- [super](https://docs.python.org/3/library/functions.html#super) is used to give access to methods and properties of a parent class\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n\r\n- [Object-oriented programming in Python](https://docs.microsoft.com/learn/modules/python-object-oriented-programming/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/05 - Mixins/demo.py",
    "content": "class Loggable:\n    def __init__(self):\n        self.title = ''\n    def log(self):\n        print('Log message from ' + self.title)\n\nclass Connection:\n    def __init__(self):\n        self.server = ''\n    def connect(self):\n        print('Connecting to database on ' + self.server)\n\nclass SqlDatabase(Connection, Loggable):\n    def __init__(self):\n        super().__init__()\n        self.title = 'Sql Connection Demo'\n        self.server = 'Some_Server'\n        \n\ndef framework(item):\n    if isinstance(item, Connection):\n        item.connect()\n    if isinstance(item, Loggable):\n        item.log()\n\nsql_connection = SqlDatabase()\nframework(sql_connection)\n"
  },
  {
    "path": "more-python-for-beginners/06 - Managing the file system/README.md",
    "content": "# Managing the file system\r\n\r\nPython's [pathlib](https://docs.python.org/3/library/pathlib.html) provides operations and classes to access files and directories in the file system.\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/06 - Managing the file system/demo.txt",
    "content": "Lorem ipsum"
  },
  {
    "path": "more-python-for-beginners/06 - Managing the file system/directories.py",
    "content": "from pathlib import Path\ncwd = Path.cwd()\n\n# Get the parent directory\nparent = cwd.parent\n\n# Is this a directory?\nprint('\\nIs this a directory? ' + str(parent.is_dir()))\n\n# Is this a file?\nprint('\\nIs this a file? ' + str(parent.is_file()))\n\n# List child directories\nprint('\\n-----directory contents-----')\nfor child in parent.iterdir():\n    if child.is_dir():\n        print(child)\n"
  },
  {
    "path": "more-python-for-beginners/06 - Managing the file system/files.py",
    "content": "from pathlib import Path\ncwd = Path.cwd()\n\ndemo_file = Path(Path.joinpath(cwd, 'demo.txt'))\n\n# Get the file name\nprint('\\nfile name: ' + demo_file.name)\n\n# Get the extension\nprint('\\nfile suffix: ' + demo_file.suffix)\n\n# Get the folder\nprint('\\nfile folder: ' + demo_file.parent.name)\n\n# Get the size\nprint('\\nfile size: ' + str(demo_file.stat().st_size) + '\\n')"
  },
  {
    "path": "more-python-for-beginners/06 - Managing the file system/paths.py",
    "content": "# Python 3.6 or higher\n# Grab the library\nfrom pathlib import Path\n\n# What is the current working directory?\ncwd = Path.cwd()\nprint('\\nCurrent working directory:\\n' + str(cwd))\n\n# Create full path name by joining path and filename\nnew_file = Path.joinpath(cwd, 'new_file.txt')\nprint('\\nFull path:\\n' + str(new_file))\n\n# Check if file exists\nprint('\\nDoes that file exist? ' + str(new_file.exists()) + '\\n')"
  },
  {
    "path": "more-python-for-beginners/07 - Reading and writing files/README.md",
    "content": "# Working with files\r\n\r\nPython allows you to read and write from files. [io](https://docs.python.org/3/library/io.html) is the module that provides Python capabilities for input/output (I/O), including text I/O from files\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/07 - Reading and writing files/demo.txt",
    "content": "This is the first line of the file\nAnd this is the second line of the file\nThis is the last line of the file"
  },
  {
    "path": "more-python-for-beginners/07 - Reading and writing files/manage.py",
    "content": "# Open manage.txt file to write text\nstream = open('manage.txt', 'wt')\n\n#Write the word demo to the file stream\nstream.write('demo!')\n\n# Move back to the start of the file stream\nstream.seek(0)\n\n#write the word cool to the file stream\nstream.write('cool')\n\n#Flush the file stream contents to the file buffer\nstream.flush()\n\n# Flush the file stream and close the file\nstream.close()\n"
  },
  {
    "path": "more-python-for-beginners/07 - Reading and writing files/read.py",
    "content": "# Open file demo.txt and read the contents\nstream = open('./demo.txt', 'rt')\nprint('\\nIs this readable? ' + str(stream.readable()))\nprint('\\nRead one character : ' + stream.read(1))\nprint('\\nRead to end of line : ' + stream.readline())\nprint('\\nRead all lines to end of file :\\n' + str(stream.readlines())+ '\\n')"
  },
  {
    "path": "more-python-for-beginners/07 - Reading and writing files/write.py",
    "content": "# Open output.txt as a text file for writing\nstream = open('output.txt', 'wt')\n\nprint('\\nCan I write to this file? ' + str(stream.writable()) + '\\n')\n\nstream.write('H') # Write a single string \nstream.writelines(['ello',' ','world']) # Write one or more strings\nstream.write('\\n') # Write a new line\n\nnames = ['Susan','Christopher']\nstream.writelines(names)\n\n# Here's a neat trick to insert a new line between items in the list\nstream.write('\\n')  # Write a new line\nstream.writelines('\\n'.join(names)) \nstream.close() #Flush stream and close\n"
  },
  {
    "path": "more-python-for-beginners/08 - Managing external resources/README.md",
    "content": "# with\r\n\r\nThe [with](https://docs.python.org/3/reference/compound_stmts.html#with) statement allows you to simplify code in [try](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement)/finally statements. It's considered to use `with` for any operation which supports it.\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner)\r\n"
  },
  {
    "path": "more-python-for-beginners/08 - Managing external resources/demo.py",
    "content": "try:\n\tstream = open('output.txt', 'wt')\n\tstream.write('Lorem ipsum dolar')\nfinally:\n\tstream.close() # THIS IS REALLY IMPORTANT!!\n\n# with open('output.txt', 'wt') as stream:\n# \tstream.write('Lorem ipsum dolar')\n"
  },
  {
    "path": "more-python-for-beginners/08 - Managing external resources/output.txt",
    "content": "Lorem ipsum dolar"
  },
  {
    "path": "more-python-for-beginners/09 - Asynchronous programming/README.md",
    "content": "# Asynchronous operations\r\n\r\nPython offers several options for managing long running operations asynchronously. [asyncio](https://docs.python.org/3/library/asyncio.html) is the core library for supporting asynchronous operations, including [async](https://docs.python.org/3/reference/compound_stmts.html#async-def)/[await](https://docs.python.org/3/reference/expressions.html#await).\r\n\r\n## Microsoft Learn Resources\r\n\r\nExplore related tutorials on [Microsoft Learn](https://learn.microsoft.com/?WT.mc_id=python-c9-niner).\r\n"
  },
  {
    "path": "more-python-for-beginners/09 - Asynchronous programming/async_demo.py",
    "content": "from timeit import default_timer\nimport aiohttp\nimport asyncio\n\nasync def load_data(session, delay):\n    print(f'Starting {delay} second timer')\n    async with session.get(f'http://httpbin.org/delay/{delay}') as resp:\n        text = await resp.text()\n        print(f'Completed {delay} second timer')\n        return text\n\nasync def main():\n    # Start the timer\n    start_time = default_timer()\n\n    # Creating a single session\n    async with aiohttp.ClientSession() as session:\n        # Setup our tasks and get them running\n        two_task = asyncio.create_task(load_data(session, 2))\n        three_task = asyncio.create_task(load_data(session, 3))\n\n        # Simulate other processing\n        await asyncio.sleep(1)\n        print('Doing other work')\n\n        # Let's go get our values\n        two_result = await two_task\n        three_result = await three_task\n\n        # Print our results\n        elapsed_time = default_timer() - start_time\n        print(f'The operation took {elapsed_time:.2} seconds')\n\nasyncio.run(main())\n"
  },
  {
    "path": "more-python-for-beginners/09 - Asynchronous programming/sync_demo.py",
    "content": "from timeit import default_timer\nimport requests\n\ndef load_data(delay):\n    print(f'Starting {delay} second timer')\n    text = requests.get(f'http://httpbin.org/delay/{delay}').text\n    print(f'Completed {delay} second timer')\n\ndef run_demo():\n    start_time = default_timer()\n\n    two_data = load_data(2)\n    three_data = load_data(3)\n\n    elapsed_time = default_timer() - start_time\n    print(f'The operation took {elapsed_time:.2} seconds')\n\ndef main():\n    run_demo()\n\nmain()\n"
  },
  {
    "path": "more-python-for-beginners/README.md",
    "content": "# More Python for beginners\n\n## Overview\n\nWhen we created [Python for beginners](https://aka.ms/pythonbeginnerseries) we knew we wouldn't be able to cover everything in Python. We focused on the features which are core to getting started with the language. But, of course, we left some items off the list. Well, we're back for more! We created another set of videos to highlight more features, including a couple of \"cutting edge\" items like `async/await`. These skills will allow you to continue to grow as a Python developer.\n\n### What you'll learn\n\n- Creating classes and objects\n- Asynchronous development\n- Working with the filesystem\n\n### What we don't cover\n\n- Programming concepts like [object-oriented design](https://en.wikipedia.org/wiki/Object-oriented_design)\n- Database access\n\n## Prerequisites\n\n- [An understanding of git](https://git-scm.com/book/en/v2)\n- [An understanding of Python](https://aka.ms/pythonbeginnerseries)\n- [Visual Studio Code](https://code.visualstudio.com?WT.mc_id=python-c9-niner) or another code editor\n\n### Setup steps\n\n- [Create a virtual environment](https://docs.python.org/3/tutorial/venv.html)\n\n``` bash\n# Windows\npython -m venv venv\n.\\venv\\Scripts\\activate\n\n# Linux or macOS\npython3 -m venv venv\n. ./venv/bin/activate\n```\n\n- Install the packages for Async/Await\n\n``` bash\n# Windows\npip install -r requirements.txt\n\n# Linux or macOS\npip3 install -r requirements.txt\n```\n\n## Next steps\n\nIf you're looking to continue building, here's a couple of courses and quickstarts you might find of interest:\n\n- [Object-oriented programming in Python](https://docs.microsoft.com/learn/modules/python-object-oriented-programming?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n- [Build an AI web app using Python and Flask](https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n- [Build Python Django apps with Microsoft Graph](https://docs.microsoft.com/graph/tutorials/python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n- [Create a Python app in Azure App Service on Linux](https://docs.microsoft.com/azure/app-service/containers/quickstart-python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n"
  },
  {
    "path": "more-python-for-beginners/requirements.txt",
    "content": "aiohttp\nrequests"
  },
  {
    "path": "python-for-beginners/02 - Print/README.md",
    "content": "# print\n\nThe print function allows you to send output to the terminal\n\n- [print](https://docs.python.org/3/library/functions.html#print)\n\nStrings can be enclosed in single quotes or double quotes\n\n- \"this is a string\"\n- 'this is also a string'\n\nThe input function allows you to prompt a user for a value\n\n- [input](https://docs.python.org/3/library/functions.html#input)\n  \nParameters:\n\n- `prompt`: Message to display to the user  \n\nreturn value:\n\n- string value containing value entered by user\n"
  },
  {
    "path": "python-for-beginners/02 - Print/ask_for_input.py",
    "content": "# The input funciton allows you to prompt the user for a value\n# You need to declare a variable to hold the value entered by the user\nname = input('What is your name? ')\n\nprint(name)"
  },
  {
    "path": "python-for-beginners/02 - Print/coding_challenge.py",
    "content": "# Here's a challenge for you to help you practice\n# See if you can fix the code below \n\n# print the message\nprint('Why won't this line of code print')\n\n# print the message\nprnit('This line fails too!')\n\n# print the message\nprint \"I think I know how to fix this one\"\n\n# print the name entered by the user\ninput('Please tell me your name: ')\nprint(name)\n"
  },
  {
    "path": "python-for-beginners/02 - Print/coding_challenge_solution.py",
    "content": "# Here's a challenge for you to help you practice\n# See if you can fix the code below \n\n# print the message\n# There was a single quote inside the string!\n# Use double quotes to enclose the string\nprint(\"Why won't this line of code print\")\n\n# print the message\n# There was a mistake in the function name\nprint('This line fails too!')\n\n# print the message\n# Need to add the () around the string\nprint (\"I think I know how to fix this one\")\n\n# print the name entered by the user\n# You need to store the value returned by the input statement\n# in a variable\nname = input('Please tell me your name: ')\nprint(name)\n"
  },
  {
    "path": "python-for-beginners/02 - Print/hello_world.py",
    "content": "# the print statement displays a message \nprint('Hello world')\n"
  },
  {
    "path": "python-for-beginners/02 - Print/print_blank_line.py",
    "content": "# Each print statements starts on a new line\nprint('Hello world')\n\n# If you pass nothing to the print statement you get a blank line\nprint()\nprint('Did you see that blank line?')\n\n# '\\n' is a special character sequence that means print new line\n# you can use it to break the output over multiple lines\nprint('Blank line \\nin the middle of string')\n\n\n\n"
  },
  {
    "path": "python-for-beginners/02 - Print/single_or_double_quotes.py",
    "content": "# Strings can be enclosed in single quotes\nprint('Hello world single quotes')\n\n# Strings can also be enclosed in double quotes\nprint(\"Hello world double quotes\")\n"
  },
  {
    "path": "python-for-beginners/03 - Comments/README.md",
    "content": "# Comments\n\nComments start with a hash character (#) and allow you to document your code.\nComments are ignored when code is executed.\n\n- [Comments](https://docs.python.org/3/reference/lexical_analysis.html?highlight=comment)\n"
  },
  {
    "path": "python-for-beginners/03 - Comments/comments_are_not_executed.py",
    "content": "# This is a comment in my code it does nothing\n# print('Hello world')\n# print(\"Hello world\")\n# No output will be displayed!\n"
  },
  {
    "path": "python-for-beginners/03 - Comments/comments_for_debugging.py",
    "content": "print('Hello world')\nprint('It's a small world after all')\n"
  },
  {
    "path": "python-for-beginners/03 - Comments/enable_pin.py",
    "content": "#The enable_pin method is not coded yet\n# I have created a dummy method so the code\n# will run without an error\n# Don't panic if you don't understand this part of the code\n# we cover methods in a separate module\ndef enable_pin(user, pin):\n    print('pin enabled')\n\n# Set current_user and pin to test values\ncurrent_user = 'TEST123'\npin = '123456'\n\n# Enable PIN check as listed in\n# security requirements\nenable_pin(current_user, pin)\n\n"
  },
  {
    "path": "python-for-beginners/03 - Comments/string_in_double_quotes.py",
    "content": "# Using double quotes for this string because \n# the string itself contains a single quote\nprint(\"It's a small world after all\")\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/README.md",
    "content": "# Strings\n\nPython can store and manipulate strings. Strings can be enclosed in single or double quotes. There are a number of string methods you can use to manipulate and work with strings\n\n- [strings](https://docs.python.org/3/tutorial/introduction.html#strings)\n- [string methods](https://docs.python.org/3/library/stdtypes.html#string-methods)\n\nConverting to string values\n\n- [str](https://docs.python.org/3/library/functions.html#func-str)\n\nWhen naming variables follow the PEP-8 Style Guide for Python Code\n\n- [PEP-8 Style Guide](https://www.python.org/dev/peps/pep-0008/#naming-conventions)\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/code_challenge.py",
    "content": "# ask a user to enter their first name and store it in a variable\n# ask a user to enter their last name and store it in a variable\n# print their full name\n# Make sure you have a space between first and last name\n# Make sure the first letter of first name and last name is uppercase\n# Make sure the rest of the name is lowercase\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/code_challenge_solution.py",
    "content": "# ask a user to enter their first name and store it in a variable\nfirst_name = input('What is your first name? ')\n# ask a user to enter their last name and store it in a variable\nlast_name = input('What is your last name? ')\n\n# print their full name\n# Make sure you have a space between first and last name\n# Make sure the first letter of first name and last name is uppercase\n# Make sure the rest of the name is lowercase\nprint(first_name.capitalize() + ' ' + last_name.capitalize())"
  },
  {
    "path": "python-for-beginners/04 - String variables/combine_strings.py",
    "content": "# You can use the + operator to concatenate strings\nfirst_name = 'Susan'\nlast_name = 'Ibach'\nprint(first_name + last_name)\n\n# If you want a space between the strings you must include the space\n# within the string\nprint('Hello ' + first_name + ' ' + last_name)\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/format_strings.py",
    "content": "# Ask the user for their first and last name\nfirst_name = input('What is your first name? ')\nlast_name = input('What is your last name? ')\n\n# the capitalize function will return the string with \n# the first letter uppercase and the rest of the word lowercase\nprint ('Hello ' + first_name.capitalize() + ' ' \\\n       + last_name.capitalize())\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/string_functions.py",
    "content": "# There are a number of string functions you can use\n# on string variables\nsentence = 'The dog is named Sammy'\n\n# upper will return the string in uppercase letters\nprint(sentence.upper())\n\n# lower will return the string in lowercase letters\nprint(sentence.lower())\n\n# capitalize will return the string with the first letter uppercase\n# and the rest of the string in lowercase\nprint(sentence.capitalize())\n\n# count will count the number of occurrences of the value specified\n# in the string, in this case how many times the letter 'a' appears\nprint(sentence.count('a'))\n"
  },
  {
    "path": "python-for-beginners/04 - String variables/strings_in_variables.py",
    "content": "# You can store strings in variables\nfirst_name = 'Susan'\n\n# The variable can then be used later in your code\nprint(first_name)\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/README.md",
    "content": "# Numeric values\n\nPython can store and manipulate numbers. Python has two types of numeric values: integers (whole numbers) or float (numbers with decimal places)\n\n- [numeric types](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)\n\nWhen naming variables follow the PEP-8 Style Guide for Python Code\n\n- [PEP-8 Style Guide](https://www.python.org/dev/peps/pep-0008/#naming-conventions)\n\nConverting to numeric values\n\n- [int](https://docs.python.org/3/library/functions.html#int)\n- [float](https://docs.python.org/3/library/functions.html#float)\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/code_challenge.py",
    "content": "# Ask a user to enter a number\n# Ask a user to enter a second number\n# Calculate the total of the two numbers added together\n# Print 'first number + second number = answer' \n# For example if someone enters 4 and 6 the output should read\n# 4 + 6 = 10\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/code_challenge_solution.py",
    "content": "# Ask a user to enter a number\nfirst_number = input('Enter a number: ')\n\n# Ask a user to enter a second number\nsecond_number = input('Enter another number: ')\n\n# Calculate the total of the two numbers added together\nanswer = float(first_number) + float(second_number)\n\n# Print 'first number + second number = answer' \n# For example if someone enters 4 and 6 the output should read\n# 4 + 6 = 10\nprint(first_number + ' + ' + second_number + ' = ' + str(answer))\n\n# If you do not want the decimal places you could round the answer\nprint(first_number + ' + ' + second_number + ' = ' + str(round(answer)))"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/combining_strings_and_numbers.py",
    "content": "days_in_feb = 28\n\n# The print function can accept numbers or strings\nprint(days_in_feb)\n\n# The + operator can either add two numbers or it can concatenate two strings\n# it does not know what to do when you pass it one number and one string\n# This line of code will cause an error\nprint(days_in_feb + ' days in February')\n\n# You need to convert the number to a string to display the value\n# This line of code will work\nprint(str(days_in_feb) + ' days in February')\n\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/convert_strings_to_numbers_for_math.py",
    "content": "first_num = input('Enter first number ')\nsecond_num = input('Enter second number ')\n# If you have a string variable containing a number\n# And you want to treat it as a number\n# You must convert it to a numeric datatype\n# int() converts a string to an integer e.g. 5, 8, 416, 506\nprint(int(first_num) + int(second_num))\n\n# float() converts a string to a decimal or float number e.g. 3.14159, 89.5, 1.0\nprint(float(first_num) + float(second_num))\n\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/doing_math.py",
    "content": "# Because the variables are assigned numeric values when created\n# Python knows they are numeric variables\nfirst_num = 6\nsecond_num = 2\n\n# You can peform a variety of math operations on numeric values\nprint('addition')\nprint(first_num + second_num)\nprint('subtraction')\nprint(first_num - second_num)\nprint('multiplication')\nprint(first_num * second_num)\nprint('division')\nprint(first_num / second_num)\nprint ('exponent')\nprint(first_num ** second_num)\n"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/numbers_treated_as_strings.py",
    "content": "# Python has to guess what datatype a variable should be\n\n# since the input function returns a string, the variables it populates\n# will hold string values\nfirst_num = input('Enter first number ')\nsecond_num = input('Enter second number ')\n\n# Because first_num and second_num are string variables the + operator\n# concatenates them just like concatenating first_name and last_name\nprint(first_num + second_num)"
  },
  {
    "path": "python-for-beginners/05 - Numeric variables/print_pi.py",
    "content": "# You can use variables to store numeric values\npi = 3.14159\nprint(pi)\n"
  },
  {
    "path": "python-for-beginners/06 - Dates/README.md",
    "content": "# Date values\n\nThe [datetime module](https://docs.python.org/3/library/datetime.html) contains a number of classes for manipulating dates and times.\n\nDate and time types:\n\n- `date` stores year, month, and day\n- `time` stores hour, minute, and second\n- `datetime` stores year, month, day, hour, minute, and second\n- `timedelta` a duration of time between two dates, times, or datetimes\n\nWhen naming variables follow the PEP-8 Style Guide for Python Code\n\n- [PEP-8 Style Guide](https://www.python.org/dev/peps/pep-0008/#naming-conventions)\n\nConverting from string to datetime\n\n- [strptime](https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior)\n"
  },
  {
    "path": "python-for-beginners/06 - Dates/code_challenge.py",
    "content": "# print today's date\n# print yesterday's date\n# ask a user to enter a date\n# print the date one week from the date entered"
  },
  {
    "path": "python-for-beginners/06 - Dates/code_challenge_solution.py",
    "content": "from datetime import datetime, timedelta\n\n# print today's date\ncurrent_date = datetime.now()\nprint(current_date)\n\n# print yesterday's date\none_day = timedelta(days=1)\nyesterday = current_date - one_day\nprint('Yesterday was: ' + str(yesterday))\n\n# ask a user to enter a date\ndate_entered = input('Please enter a date (dd/mm/yyyy): ')\ndate_entered = datetime.strptime(date_entered, '%d/%m/%Y')\n\n# print the date one week from the date entered\none_week = timedelta(weeks=1)\none_week_later = date_entered + one_week\nprint('One week later it will be: ' + str(one_week_later))"
  },
  {
    "path": "python-for-beginners/06 - Dates/date_functions.py",
    "content": "#To get current date and time we need to use the datetime library\nfrom datetime import datetime, timedelta\n# The now function returns current date and time\ntoday = datetime.now()\n\nprint('Today is: ' + str(today))\n#You can use timedelta to add or remove days, or weeks to a date\none_day = timedelta(days=1)\nyesterday = today - one_day\nprint('Yesterday was: ' + str(yesterday))\n\none_week = timedelta(weeks=1)\nlast_week = today - one_week\nprint('Last week was: ' + str(last_week))\n\n"
  },
  {
    "path": "python-for-beginners/06 - Dates/format_date.py",
    "content": "#To get current date and time we need to use the datetime library\nfrom datetime import datetime\n\n# The now function returns current date and time\ntoday = datetime.now()\n\n# use day, month, year, hour, minute, second functions\n# to display only part of the date\n# All these functions return integers\n# Convert them to strings before concatenating them to another string\nprint('Day: ' + str(today.day))\nprint('Month: ' + str(today.month))\nprint('Year: ' + str(today.year))\n\nprint('Hour: ' + str(today.hour))\nprint('Minute: ' + str(today.minute))\nprint('Second: ' + str(today.second))\n"
  },
  {
    "path": "python-for-beginners/06 - Dates/get_current_date.py",
    "content": "#To get current date and time we need to use the datetime library\nfrom datetime import datetime\n\ncurrent_date = datetime.now()\n# The now function returns current date and time as a datetime object\n\n# You must convert the datetime object to a string\n# before you can concatenate it to another string\nprint('Today is: ' + str(current_date))\n"
  },
  {
    "path": "python-for-beginners/06 - Dates/input_date.py",
    "content": "# import the datetime and timedelta modules\nfrom datetime import datetime, timedelta\n\n# When you ask a user for a date tell them the desired date format\nbirthday = input('When is your birthday (dd/mm/yyyy)? ')\n\n# When you convert the string containing the date into a date object\n# you must specify the expected date format\n# if the date is not in the expected format Python will raise an exception\nbirthday_date = datetime.strptime(birthday, '%d/%m/%Y')\n\nprint ('Birthday: ' + str(birthday_date))\n\n# Because we converted the string into a date object\n# We can use date and time functions such as timedelta with the object\none_day = timedelta(days=1)\nbirthday_eve = birthday_date - one_day\nprint('Day before birthday: ' + str(birthday_eve))\n"
  },
  {
    "path": "python-for-beginners/07 - Error handling/README.md",
    "content": "# Error handling\n\nError handling in Python is managed through the use of [try/except/finally](https://docs.python.org/3.7/reference/compound_stmts.html#except)\n\nPython has numerous [built-in exceptions](https://docs.python.org/3.7/library/exceptions.html). When creating `except` blocks, they need to be created from most specific to most generic according to the [hierarchy](https://docs.python.org/3.7/library/exceptions.html#exception-hierarchy).\n"
  },
  {
    "path": "python-for-beginners/07 - Error handling/logic.py",
    "content": "x = 206\ny = 42\nif x < y:\n    print(str(x) + ' is greater than ' + str(y))\n"
  },
  {
    "path": "python-for-beginners/07 - Error handling/runtime.py",
    "content": "x = 42\ny = 0\ntry:\n    print(x / y)\nexcept ZeroDivisionError as e:\n    # Optionally, log e somewhere\n    print('Sorry, something went wrong')\nexcept:\n    print('Something really went wrong')\nfinally:\n    print('This always runs on success or failure')\n"
  },
  {
    "path": "python-for-beginners/07 - Error handling/syntax.py",
    "content": "x = 42\ny = 206\nif x == y\n    print('Success')"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/README.md",
    "content": "# Handling conditions\n\nConditional execution can be completed using the [if](https://docs.python.org/3/reference/compound_stmts.html#the-if-statement) statement\n\n`if` syntax\n\n```python\nif expression:\n    # code to execute\nelse:\n    # code to execute\n```\n\n[Comparison operators](https://docs.python.org/3/library/stdtypes.html#comparisons)\n\n- < less than\n- < greater than\n- == is equal to\n- \\>= greater than or equal to\n- <= less than or equal to\n- != not equal to\n"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/add_else.py",
    "content": "price = input('how much did you pay? ')\nprice = float(price)\n\nif price >= 1.00:\n\t# Anything that costs $1.00 or more is charged 7% tax\n\t# All statements indented are only executed if price is > = 1\n\ttax = .07\n\tprint('Tax rate is: ' + str(tax))\nelse:\n\t# Anything else we do not charge any tax\n\t# All statements indented are only executed if price is NOT >= 1 \n\ttax = 0\n\tprint('Tax rate is: ' + str(tax))\n\n\n"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/add_else_different_indentation.py",
    "content": "price = 5.0\nif price >= 1.00:\n\ttax = .07\nelse:\n\ttax = 0\n# the print statement below is not indented so is executed after the if \n# statement is evaluated\nprint(tax)\n"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/case_insensitive_comparisons.py",
    "content": "country = 'CANADA'\n# by converting the string entered to lowercase and comparing it to a string\n# that is all lowercase letters I make the comparison case-insensitive\n# If someone types in CANADA or Canada it will still be a match\nif country.lower() == 'canada':\n\tprint('Hello eh')\nelse:\n\tprint('Hello')\n"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/check_tax.py",
    "content": "#Calculate the tax\n# Anything purchased for more than $1.00 is charged a 7% tax\nprice = input('how much did you pay? ')\n\n# Convert the string to a number\nprice = float(price)\n\n# Check if the price is greater than 1.00\nif price >= 1.00:\n\t# Everything over $1.00 is charged 7% tax\n\ttax = .07\n\tprint('Tax rate is: ' + str(tax))\n"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/code_challenge.py",
    "content": "# Fix the mistakes in this code and test based on the description below\n# If I enter 2.00 I should see the message \"Tax rate is: 0.07\" \n# If I enter 1.00 I should see the message \"Tax rate is: 0.07\" \n# If I enter 0.50 I should see the message \"Tax rate is: 0\" \nprice = input('how much did you pay? ')\n\nif price > 1.00:\n\ttax = .07\n\tprint('Tax rate is: ' + str(tax))\nelse\n\ttax = 0\nprint('Tax rate is: ' + str(tax))"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/code_challenge_solution.py",
    "content": "# Fix the mistakes in this code and test using the following\n# If I enter 2.00 I should see the message \"Tax rate is: 0.07\" \n# If I enter 1.00 I should see the message \"Tax rate is: 0.07\" \n# If I enter 0.50 I should see the message \"Tax rate is: 0\" \nprice = input('how much did you pay? ')\nprice = float(price)\n\nif price >= 1.00:\n\ttax = .07\n\tprint('Tax rate is: ' + str(tax))\nelse:\n    tax = 0\n    print('Tax rate is: ' + str(tax))"
  },
  {
    "path": "python-for-beginners/08 - Handling conditions/comparing_strings.py",
    "content": "country = input('Enter the name of your home country: ')\nif country == 'canada':\n\t# string comparisons are case sensitive\n\t# if you typed in CANADA or Canada it will not match\n\tprint('So you must like hockey!')\nelse:\n\tprint('You are not from Canada')\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/README.md",
    "content": "# Handling conditions\n\nConditional execution can be completed using the [if](https://docs.python.org/3/reference/compound_stmts.html#the-if-statement) statement. Adding `elif` allows you to check multiple conditions\n\n`if` syntax\n\n```python\nif expression:\n    # code to execute\nelif expression:\n    # code to execute\nelse:\n    # code to execute\n```\n\n[Boolean operators](https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not)\n\n- **x *or* y** - If either x OR y is true, the expression is executed\n\n[Comparison operators](https://docs.python.org/3/library/stdtypes.html#comparisons)\n\n- < less than\n- < greater than\n- == is equal to\n- \\>= greater than or equal to\n- <= less than or equal to\n- != not equal to\n- **x *in* [a,b,c]** Does x match the value of a, b, or c\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/add_else_to_elif.py",
    "content": "province = input(\"What province do you live in? \")\ntax = 0\n\nif province == 'Alberta':\n\ttax = 0.05\nelif province == 'Nunavut':\n\ttax = 0.05\nelif province == 'Ontario':\n\ttax = 0.13\nelse:\n\ttax = 0.15\nprint(tax)"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/code_challenge.py",
    "content": "# Ask a user their name\n# If their first name starts with A or B \n# tell them they go to room AB\n# IF their first name starts with C\n# tell them to go to room CD\n# If their first name starts with another letter, ask for their last name\n# IF their last name starts with Z, tell them to go to room Z\n# if their last name starts with any other letter, tell them to go to room OTHER\n# When you are done\n# Anna should be in room AB\n# Bob should be in room AB\n# Charlie should be in room C\n# Khalid Haque should be in room OTHER\n# Xin Zhao should be in room Z"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/code_challenge_solution.py",
    "content": "# Assign people to different rooms when they check in based on their names\n# When you are done\n# Anna should be in room AB\n# Bob should be in room AB\n# Charlie should be in room C\n# Khalid Haque should be in room OTHER\n# Xin Zhao should be in room Z\n# Ask a user their first name\nname = input('What is your name? ')\n\n# If their first name starts with A or B\n# tell them they go to room AB \nfirst_letter = name[0:1]\nif first_letter.upper() in ('A','B'):\n    room = 'AB'\n# If their first name starts with C\n# tell them to go to room C\nelif first_letter.upper() == 'C':\n    room = 'C'\nelse:\n    # If their first name starts with another letter, ask for their last name\n    # If their last name starts with Z, tell them to go to room Z\n    last_name = input('what is your last name? ')\n    last_name_first_letter = last_name[0:1]\n    # if their last name starts with any other letter, tell them to go to room OTHER\n    if last_name_first_letter == 'Z':\n        room = 'Z'\n    else:\n        room = 'OTHER'\nprint('Please go to room ' + room)\n\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/multiple_if_statements.py",
    "content": "\nprovince = input(\"What province do you live in? \")\ntax = 0\n\nif province == 'Alberta': \n\ttax = 0.05\nif province == 'Nunavut':\n\ttax = 0.05\nif province == 'Ontario':\n\ttax = 0.13\nprint(tax)\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/nested_if.py",
    "content": "country = input(\"What country do you live in? \")\n\nif country.lower() == 'canada':\n\tprovince = input(\"What province/state do you live in? \")\n\tif province in('Alberta',\\\n       'Nunavut','Yukon'):\n\t\ttax = 0.05\n\telif province == 'Ontario':\n\t\ttax = 0.13\n\telse:\n\t\ttax = 0.15\nelse:\n\ttax = 0.0\nprint(tax)\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/or_statements.py",
    "content": "province = input(\"What province do you live in? \")\ntax = 0\nif province == 'Alberta' \\\n   or province == 'Nunavut':\n\ttax = 0.05\nelif province == 'Ontario':\n\ttax = 0.13\nelse:\n\ttax = 0.15\nprint(tax)\n"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/use_elif.py",
    "content": "province = input(\"What province do you live in? \")\ntax = 0\nif province == 'Alberta': \n\ttax = 0.05\nelif province == 'Nunavut':\n\ttax = 0.05\nelif province == 'Ontario':\n\ttax = 0.13\nprint(tax)"
  },
  {
    "path": "python-for-beginners/09 - Handling multiple conditions/use_in_statements.py",
    "content": "province = input(\"What province do you live in? \")\ntax = 0\n# If multiple values cause the same output you can combine them by listing all \n# values you want to check for with the in operator\nif province in('Alberta','Nunavut','Yukon'):\n\ttax = 0.05\nelif province == 'Ontario':\n\ttax = 0.13\nelse:\n\ttax = 0.15\nprint(tax)"
  },
  {
    "path": "python-for-beginners/10 - Complex conditon checks/boolean_variables.py",
    "content": "# I check to see if the requirements for honour roll are met\ngpa = float(input('What was your Grade Point Average? '))\nlowest_grade = float(input('What was your lowest grade? '))\n\n# Boolean variables allow you to remember a True/False value\nif gpa >= .85 and lowest_grade >= .70:\n\thonour_roll = True\nelse:\n\thonour_roll = False\n\n# Somewhere later in your code if you need to check if students is \n# on honour roll, all I need to do is check the boolean variable\n# I set earlier in my code\nif honour_roll:\n\tprint('You made honour roll')\n"
  },
  {
    "path": "python-for-beginners/10 - Complex conditon checks/code_challenge.py",
    "content": "# When you join a hockey team you get your name on the back of the jersey\n# but the jersey may not be big enough to hold all the letters\n# Ask the user for their first name\n\n# Ask the user for their last name\n\n# if first name is < 10 characters and last name is < 10 characters \n#       print first and last name on the jersey\n# if first name >= 10 characters long and last name is < 10 characters\n#       print first initial of first name and the entire last name\n# if first name < 10 characters long and last name is >= 10 characters\n#       print entire first name and first initial of last name\n# if first name >= 10 characters long and last name is >= 10 characters\n#       print last name only\n\n# Test with the following values\n# first name: Susan  last name: Ibach\n# output: Susan Ibach\n# first name: Susan  last name: ReallyLongLastName\n# output: Susan R.\n# first name: ReallyLongFirstName  last name: Ibach\n# output: R. Ibach\n# first name: ReallyLongFirstName  last name: ReallyLongLastName\n# output: ReallyLongLastName"
  },
  {
    "path": "python-for-beginners/10 - Complex conditon checks/code_challenge_solution.py",
    "content": "# When you join a hockey team you get your name on the back of the jersey\n# but the jersey may not be big enough to hold all the letters\n# Ask the user for their first name\nfirst_name = input('Please enter your first name: ')\n# Ask the user for their last name\nlast_name = input('Please enter your last name: ')\n\n# if first name is < 10 characters and last name is < 10 characters \n#       print first and last name on the jersey\n# if first name >= 10 characters long and last name is < 10 characters\n#       print first initial of first name and the entire last name\n# if first name < 10 characters long and last name is >= 10 characters\n#       print entire first name and first initial of last name\n# if first name >= 10 characters long and last name is >= 10 characters\n#       print last name only\n\n# Check length of first name\nif len(first_name) >=10:\n    long_first_name = True\nelse:\n    long_first_name = False\n\n# Check length of last name\nif len(last_name) >= 10:\n    long_last_name = True\nelse:\n    long_last_name = False\n \n# Evaluate possible jersey print combinations for different lengths\nif long_first_name and long_last_name:\n    print(last_name)\nelif long_first_name:\n    print(first_name[0:1] + '. ' + last_name)\nelif long_last_name:\n    print(first_name + ' ' + last_name[0:1] + '.')\nelse:\n    print(first_name + ' ' + last_name)"
  },
  {
    "path": "python-for-beginners/10 - Complex conditon checks/readme.md",
    "content": "# Complex condition checks\n\nConditional execution can be completed using the [if](https://docs.python.org/3/reference/compound_stmts.html#the-if-statement) statement.\n\n`if` syntax\n\n```python\nif expression:\n    # code to execute\nelif expression:\n    # code to execute\nelse:\n    # code to execute\n```\n\n[Boolean values](https://docs.python.org/3/library/stdtypes.html#boolean-values) can be either `False` or `True`\n\n[Boolean operators](https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not)\n\n- **x *or* y** - If either x **OR** y is true, the expression is executed\n- **x *and* y** - If x **AND** y are both true, the expression is executed\n\n[Comparison operators](https://docs.python.org/3/library/stdtypes.html#comparisons)\n\n- < less than\n- < greater than\n- == is equal to\n- \\>= greater than or equal to\n- <= less than or equal to\n- != not equal to\n- **x *in* [a,b,c]** Does x match the value of a, b, or c\n"
  },
  {
    "path": "python-for-beginners/10 - Complex conditon checks/using_and.py",
    "content": "# A student makes honour roll if their average is >=85\n# and their lowest grade is not below 70\ngpa = float(input('What was your Grade Point Average? '))\nlowest_grade = input('What was your lowest grade? ')\nlowest_grade = float(lowest_grade)\n\nif gpa >= .85 and lowest_grade >= .70:\n\t\tprint('You made the honour roll')\n\n"
  },
  {
    "path": "python-for-beginners/11 - Collections/README.md",
    "content": "# Collections\n\nCollections are groups of items. Python supports several types of collections. Three of the most common are dictionaries, lists and arrays.\n\n## Lists\n\n[Lists](https://docs.python.org/3/tutorial/introduction.html#lists) are a collection of items. Lists can be expanded or contracted as needed, and can contain any data type. Lists are most commonly used to store a single column collection of information, however it is possible to [nest lists](https://docs.python.org/3/tutorial/datastructures.html#nested-list-comprehensions)\n## Arrays\n\n[Arrays](https://docs.python.org/3/library/array.html) are similar to lists, however are designed to store a uniform basic data type, such as integers or floating point numbers.\n\n## Dictionaries\n\n[Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) are key/value pairs of a collection of items. Unlike a list where items can only be accessed by their index or value, dictionaries use keys to identify each item.\n"
  },
  {
    "path": "python-for-beginners/11 - Collections/arrays.py",
    "content": "from array import array\nscores = array('d')\nscores.append(97)\nscores.append(98)\nprint(scores)"
  },
  {
    "path": "python-for-beginners/11 - Collections/common-operations.py",
    "content": "names = ['Christopher', 'Susan']\nprint(len(names)) # Get the number of items\nnames.insert(0, 'Bill') # Insert before index\nprint(names)\n"
  },
  {
    "path": "python-for-beginners/11 - Collections/dictionaries.py",
    "content": "person = {'first': 'Christopher'}\nperson['last'] = 'Harrison'\nprint(person)\nprint(person['first'])"
  },
  {
    "path": "python-for-beginners/11 - Collections/lists.py",
    "content": "names = ['Christopher', 'Susan']\nscores = []\nscores.append(98)\nscores.append(99)\nprint(names)\nprint(scores)\n"
  },
  {
    "path": "python-for-beginners/11 - Collections/ranges.py",
    "content": "names = ['Susan', 'Christopher', 'Bill']\npresenters = names[0:2] # Get the first two items\n# Starting index and number of items to retrieve\n\nprint(names)\nprint(presenters)\n"
  },
  {
    "path": "python-for-beginners/12 - Loops/README.md",
    "content": "# Loops\n\n## For loops\n\n[For loops](https://docs.python.org/3/reference/compound_stmts.html#the-for-statement) takes each item in an array or collection in order, and assigns it to the variable you define.\n\n``` python\nnames = ['Christopher', 'Susan']\nfor name in names:\n    print(name)\n```\n\n## While loops\n\n[While loops](https://docs.python.org/3/reference/compound_stmts.html#the-while-statement) perform an operation as long as a condition is true.\n\n``` python\nnames = ['Christopher', 'Susan']\nindex = 0\nwhile index < len(names):\n    name = names[index]\n    print(name)\n    index = index + 1\n```\n"
  },
  {
    "path": "python-for-beginners/12 - Loops/for.py",
    "content": "for name in ['Christopher', 'Susan']:\n\tprint(name)\n"
  },
  {
    "path": "python-for-beginners/12 - Loops/number.py",
    "content": "# range creates an array\n# First parameter is the starter\n# Second indicates the number of numbers to create\n# range(0, 2) creates [0, 1]\nfor index in range(0, 2):\n\tprint(index)\n"
  },
  {
    "path": "python-for-beginners/12 - Loops/while.py",
    "content": "names = ['Christopher', 'Susan']\nindex = 0\nwhile index < len(names):\n\tprint(names[index])\n\t# Change the condition!!\n\tindex = index + 1\n"
  },
  {
    "path": "python-for-beginners/13 - Functions/README.md",
    "content": "# Functions\n\nFunctions allow you to take code that is repeated and move it to a module that can be called when needed. Functions are defined with the `def` keyword and must be declared before the function is called in your code. Functions can accept parameters and return values.\n\n- [Functions](https://docs.python.org/3/tutorial/controlflow.html#defining-functions)\n\n```python\ndef functionname(parameter):\n    # code to execute\n    return value\n```\n"
  },
  {
    "path": "python-for-beginners/13 - Functions/code_challenge.py",
    "content": "# Create a calculator function\n# The function should accept three parameters:\n# first_number: a numeric value for the math operation\n# second_number: a numeric value for the math operation\n# operation: the word 'add' or 'subtract'\n# the function should return the result of the two numbers added or subtracted\n# based on the value passed in for the operator\n#\n# Test your function with the values 6,4, add \n# Should return 10\n#\n# Test your function with the values 6,4, subtract \n# Should return 2\n# \n# BONUS: Test your function with the values 6, 4 and divide \n# Have your function return an error message when invalid values are received\n\n"
  },
  {
    "path": "python-for-beginners/13 - Functions/code_challenge_solution.py",
    "content": "# Create a calculator function\n# The function should accept three parameters:\n# first_number: a numeric value for the math operation\n# second_number: a numeric value for the math operation\n# operation: the word 'add' or 'subtract'\n# the function should return the result of the two numbers added or subtracted\n# based on the value passed in for the operator\n#\n\ndef calculator(first_number, second_number, operation):\n    if operation.upper() == 'ADD':\n        return(float(first_number) + float(second_number))\n    elif operation.upper() =='SUBTRACT':\n        return(float(first_number) - float(second_number))\n    else:\n        return('Invalid operation please specify ADD or SUBTRACT')\n# Test your function with the values 6,4, add \n# Should return 10\n#\nprint('Adding 6 + 4 = ' + str(calculator(6,4,'add')))\n# Test your function with the values 6,4, subtract \n# Should return 2\nprint('Subtracting 6 - 4 = ' + str(calculator(6,4,'subtract')))\n# Test your function with the values 6,4, divide \n# Should return some sort of error message\nprint('Dividing 6 / 4 = ' + str(calculator(6,4,'divide')))"
  },
  {
    "path": "python-for-beginners/13 - Functions/get_initails_function.py",
    "content": "# Create function get_initial to accept a name and \n# return the first letter of the name in uppercase\n# Parameters:\n#   name: the name of a person\n# Return value:\n#   first letter of name passed in as a parameter in uppercase \ndef get_initial(name):\n    initial = name[0:1].upper()\n    return initial\n\n# This program will ask for someone's name and return the initials\nfirst_name = input('Enter your first name: ')\n# Call get_initial to retrieve initial of name\nfirst_name_initial = get_initial(first_name)\n\nmiddle_name = input('Enter your middle name: ')\n# Call get_initial to retrieve initial of name\nmiddle_name_initial = get_initial(middle_name)\n\nlast_name = input('Enter your last name: ')\n# Call get_initial to retrieve initial of name\nlast_name_initial = get_initial(last_name)\n\nprint('Your initials are: ' + first_name_initial \\\n    + middle_name_initial + last_name_initial)"
  },
  {
    "path": "python-for-beginners/13 - Functions/get_initials.py",
    "content": "# Ask for a name and return the initials\nfirst_name = input('Enter your first name: ')\nfirst_name_initial = first_name[0:1]\n\nmiddle_name = input('Enter your middle name: ')\nmiddle_name_initial = middle_name[0:1]\n\nlast_name = input('Enter your last name: ')\nlast_name_initial = last_name[0:1]\n\nprint('Your initials are: ' + first_name_initial \\\n\t+ middle_name_initial + last_name_initial)\n\n"
  },
  {
    "path": "python-for-beginners/13 - Functions/getting_clever_with_functions_harder_to_read.py",
    "content": "# Create function get_initial to accept a name and \n# return the first letter of the name in uppercase\n# Parameters:\n#   name: the name of a person\n# Return value:\n#   first letter of name passed in as a parameter in uppercase \ndef get_initial(name):\n    initial = name[0:1].upper()\n    return initial\n\n#Ask for someone's name and return the initials\nfirst_name = input('Enter your first name: ')\nmiddle_name = input('Enter your middle name: ')\nlast_name = input('Enter your last name: ')\n\n# Call get_initial function to return first letter of a name\nprint('Your initials are: ' \\\n    + get_initial(first_name) \\\n    + get_initial(middle_name) \\\n    + get_initial(last_name))"
  },
  {
    "path": "python-for-beginners/13 - Functions/print_time_function.py",
    "content": "import datetime\n# Create a function called print_time\n# This function will print the message and current time\ndef print_time():\n    print('task completed')\n    print(datetime.datetime.now())\n    print() \n\nfirst_name = 'Susan'\n# Call print_time() function to display message and current time\nprint_time()\n\nfor x in range(0,10):\n    print(x)\n# Call print_time() function to display message and current time\nprint_time()"
  },
  {
    "path": "python-for-beginners/13 - Functions/print_time_function_different_messages.py",
    "content": "from datetime import datetime\n\n# What if we want different messages displayed?\n# Can we still use a function?\nfirst_name = 'Susan'\nprint('first name assigned')\nprint(datetime.now())\nprint() \n\nfor x in range(0,10):\n\tprint(x)\nprint('loop completed')\nprint(datetime.now())\nprint()\n"
  },
  {
    "path": "python-for-beginners/13 - Functions/print_time_function_fix_import.py",
    "content": "# Import datetime class from datetime library to simplify calls to datetime.now()\nfrom datetime import datetime\n\n# Create a function called print_time\n# This function will print the message and current time\ndef print_time():\n    print('task completed')\n    print(datetime.now())\n    print()\n\nfirst_name = 'Susan'\n# Call print_time() function to display message and current time\nprint_time()\n\nfor x in range(0,10):\n    print(x)\n# Call print_time() function to display message and current time\nprint_time()"
  },
  {
    "path": "python-for-beginners/13 - Functions/print_time_repeated_code.py",
    "content": "import datetime\n# print timestamps after each section of code\n# to see how long sections of code take to run\n\nfirst_name = 'Susan'\nprint('task completed')\nprint(datetime.datetime.now())\nprint()\n\nfor x in range(0,10):\n    print(x)\nprint('task completed')\nprint(datetime.datetime.now())\nprint()"
  },
  {
    "path": "python-for-beginners/13 - Functions/print_time_with_message_parameter.py",
    "content": "from datetime import datetime\n\n# Define a function to print the current time and task name\n# Function the following parameters:\n#   task_name: Name of the task to display to output screen\ndef print_time(task_name):\n    print(task_name)\n    print(datetime.now())\n    print()\n\nfirst_name = 'Susan'\n# Call print_time() function to display message and current time\n# pass in name of task completed\nprint_time('first name assigned')\n\nfor x in range(0,10):\n\tprint(x)\n# Call print_time() function to display message and current time\n# pass in name of task completed\nprint_time('loop completed')\n"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/code_challenge.py",
    "content": "# Create a calculator function\n# The function should accept three parameters:\n# first_number: a numeric value for the math operation\n# second_number: a numeric value for the math operation\n# operation: the word 'add' or 'subtract'. The default operation is 'add'\n# the function should return the result of the two numbers added or subtracted\n# based on the value passed in for the operator\n#\n# Test your function using named notation passing in only the numbers 6 and 4\n# Should return 10\n#\n# Test your function using named notation with the values 6,4, subtract \n# Should return 2\n# \n# BONUS: Test your function with the values 6, 4 and divide \n# Have your function return an error message when invalid values are received\n"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/code_challenge_solution.py",
    "content": "# Create a calculator function\n# The function should accept three parameters:\n# first_number: a numeric value for the math operation\n# second_number: a numeric value for the math operation\n# operation: the word 'add' or 'subtract'. The default operation is 'add'\n# the function should return the result of the two numbers added or subtracted\n# based on the value passed in for the operator\n#\ndef calculator(first_number, second_number, operation='ADD'):\n    if operation.upper() == 'ADD':\n        return(float(first_number) + float(second_number))\n    elif operation.upper() =='SUBTRACT':\n        return(float(first_number) - float(second_number))\n    else:\n        return('Invalid operation please specify ADD or SUBTRACT')\n\n\n# Test your function using named notation passing in only the numbers 6 and 4\n# Should return 10\n\nprint('Adding 6 + 4 = ' + str(calculator(first_number=6, second_number=4)))\n# Test your function using named notation with the values 6,4, subtract \n# Should return 2\n#\nprint('Subtracting 6 - 4 = ' + str(calculator(first_number=6, second_number=4, operation='subtract')))\n"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/get_initials_default_values.py",
    "content": "# Create a function to return the first initial of a name\n# Parameters:\n#   name: name of person\n#   force_uppercase: indicates if you always want the initial to be in upppercase: default is True\n# Return value\n#   first letter of name passed in\ndef get_initial(name, force_uppercase=True):\n    if force_uppercase:\n        initial = name[0:1].upper()\n    else:\n        initial = name[0:1]\n    return initial\n\n# Ask for someone's name and return the initial\nfirst_name = input('Enter your first name: ')\n\n# Call get_initial function to retrieve first letter of name\n# not passing a value for force_uppercase so default value is used\nfirst_name_initial = get_initial(first_name) \n\nprint('Your initial is: ' + first_name_initial)"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/get_initials_function.py",
    "content": "# This function will take a name and return the \n# Create a function to return the first initial of a name\n# Parameters:\n#   name: name of person\n# Return value\n#   first letter of name passed in\ndef get_initial(name):\n    initial = name[0:1].upper()\n    return initial\n\n# Ask for someone's name and return the initials\nfirst_name = input('Enter your first name: ')\n\n# Call get_initial function to retrieve first letter of name\nfirst_name_initial = get_initial(first_name)\n\nprint('Your initial is: ' + first_name_initial)"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/get_initials_multiple_parameters.py",
    "content": "# Create a function to return the first initial of a name\n# Parameters:\n#   name: name of person\n#   force_uppercase: indicates if you always want the initial to be in upppercase\n# Return value\n#   first letter of name passed in\ndef get_initial(name, force_uppercase):\n    if force_uppercase:\n        initial = name[0:1].upper()\n    else:\n        initial = name[0:1]\n    return initial\n\n#Ask for someone's name and return the initial\nfirst_name = input('Enter your first name: ')\n\n# Call get_initial function to retrieve first letter of name\n# Alwasy return initial in uppercase\nfirst_name_initial = get_initial(first_name, False)\n\nprint('Your initial is: ' + first_name_initial)"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/get_initials_named_parameters.py",
    "content": "# Create a function to return the first initial of a name\n# Parameters:\n#   name: name of person\n#   force_uppercase: indicates if you always want the initial to be in upppercase\n# Return value\n#   first letter of name passed in\ndef get_initial(name, force_uppercase):\n    if force_uppercase:\n        initial = name[0:1].upper()\n    else:\n        initial = name[0:1]\n    return initial\n\n# Ask for someone's name and return the initial\nfirst_name = input('Enter your first name: ')\n\n# Call get_initial to retrieve first letter of name\n# When you use named notation, you can specify parameters in any order\nfirst_name_initial = get_initial(force_uppercase=True, \\\n                                name=first_name) \n\nprint('Your initial is: ' + first_name_initial)"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/named_parameters_make_code_readable.py",
    "content": "# Create a function to handle errors that occur during code execution\n# This will display a message to the user adn may log the error for the support team to\n# help with debugging\n# \n# Parameters:\n#   error_code: Unique error code assigned to each type of error: e.g. 45 is datatype conversion error\n#   error_severity: 0 - fatal error should never occur\n#                   1 - severe error code cannot continue\n#                   2 - warning code can continue but may be missing information in records\n#   log_to_db: Should this error be logged to the database \n#   error_message: Error message to display to user and write to database\n#   source_module: Name of the python module that generated ther error\n\ndef error_logger(error_code, error_severity, log_to_db, error_message, source_module):\n    print('oh no error: ' + error_message)\n    # Imagine code here that logs our error to a database or file\n\nfirst_number = 10\nsecond_number = 5\n    # This function call by itself is confusing, I have to look at the\n    # definition of the error_logger function to understand it\nif first_number > second_number:\n    error_logger(45,1,True,'Second number greater than first','adding_method')\n\n\nif first_number > second_number:\n    # This function call by itself is easier to understand because I can \n    # see how the values I pass in map to the function parameters\n    error_logger(error_code=45, \n                 error_severity=1,\n                 log_to_db=True,\n                 error_message='Second number greater than first',\n                 source_module='adding_method')\n"
  },
  {
    "path": "python-for-beginners/14 - Function parameters/readme.md",
    "content": "# Function parameters\n\nFunctions allow you to take code that is repeated and move it to a module that can be called when needed. Functions are defined with the `def` keyword and must be declared before the function is called in your code. Functions can accept one or more parameters and return values.\n\n- [Functions](https://docs.python.org/3/tutorial/controlflow.html#defining-functions)\n\n```python\ndef function_name(parameter):\n    # code to execute\n    return value\n```\n\nParameters can be assigned a [default value](https://docs.python.org/3/tutorial/controlflow.html#default-argument-values) making them optional when the function is called.\n\n```python\ndef function_name(parameter=default):\n    # code to execute\n    return value\n```\n\nWhen you call a function you may specify the values for the parameters using positional or [named notation](https://docs.python.org/3/tutorial/controlflow.html#keyword-arguments)\n\n```python\ndef function_name(parameter1, parameter2):\n    # code to execute\n    return value\n\n# Positional notation pass in arguments in same order as parameters are declared\nresult = function_name(value1,value2)\n\n# Named notation\nresult = function_name(parameter1=value1, parameter2=value2)\n```\n"
  },
  {
    "path": "python-for-beginners/15 - Packages/README.md",
    "content": "# Packages and modules\n\n## Modules\n\n[Modules](https://docs.python.org/3/tutorial/modules.html) allow you to store reusable blocks of code, such as functions, in separate files. They're referenced by using the `import` statement.\n\n``` python\n# import module as namespace\nimport helpers\nhelpers.display('Not a warning')\n\n# import all into current namespace\nfrom helpers import *\ndisplay('Not a warning')\n\n# import specific items into current namespace\nfrom helpers import display\ndisplay('Not a warning')\n```\n\n## Packages\n\n[Distribution packages](https://packaging.python.org/glossary/#term-distribution-package) are external archive files which contain resources such as classes and functions. Most every application you create will make use of one or more packages. Imports from packages follow the same syntax as modules you've created. The [Python Package index](https://pypi.org/) contains a full list of packages you can install using [pip](https://pip.pypa.io/en/stable/).\n\n## Virtual environments\n\n[Virtual environments](https://docs.python.org/3.7/tutorial/venv.html) allow you to install packages into an isolated folder. This allows you to better manage versions.\n\n``` console\n\n```\n"
  },
  {
    "path": "python-for-beginners/15 - Packages/color_import_demo.py",
    "content": "import colorama\n\ncolorama.init()\nprint(colorama.Fore.RED + 'This is red')\n\nfrom colorama import *\n\ninit()\nprint(Fore.BLUE + 'This is blue')\n\nfrom colorama import init, Fore\nprint(Fore.GREEN + 'This is green')\n"
  },
  {
    "path": "python-for-beginners/15 - Packages/helpers.py",
    "content": "def display(message, is_warning=False):\n    if is_warning:\n        print('Warning!!')\n    print(message)\n"
  },
  {
    "path": "python-for-beginners/15 - Packages/import_module.py",
    "content": "# import module as namespace\nimport helpers\nhelpers.display('Not a warning')\n\n# import all into current namespace\nfrom helpers import *\ndisplay('Not a warning')\n\n# import specific items into current namespace\nfrom helpers import display\ndisplay('Not a warning')"
  },
  {
    "path": "python-for-beginners/15 - Packages/requirements.txt",
    "content": "colorama"
  },
  {
    "path": "python-for-beginners/16 - Calling APIs/call_api.py",
    "content": "# This code will show you how to call the Computer Vision API from Python\n# You can find documentation on the Computer Vision Analyze Image method here\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa\n\n# Use the requests library to simplify making a REST API call from Python \nimport requests\n\n# We will need the json library to read the data passed back \n# by the web service\nimport json\n\n# You need to update the SUBSCRIPTION_KEY to \n# they key for your Computer Vision Service\nSUBSCRIPTION_KEY = \"xxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n\n# You need to update the vision_service_address to the address of\n# your Computer Vision Service\nvision_service_address = \"https://canadacentral.api.cognitive.microsoft.com/vision/v2.0/\"\n\n# Add the name of the function you want to call to the address\naddress = vision_service_address + \"analyze\"\n\n# According to the documentation for the analyze image function \n# There are three optional parameters: language, details & visualFeatures\nparameters  = {'visualFeatures':'Description,Color',\n               'language':'en'}\n\n# Open the image file to get a file object containing the image to analyze\nimage_path = \"./TestImages/PolarBear.jpg\"\nimage_data = open(image_path, \"rb\").read()\n\n# According to the documentation for the analyze image function\n# we need to specify the subscription key and the content type\n# in the HTTP header. Content-Type is application/octet-stream when you pass in a image directly\nheaders    = {'Content-Type': 'application/octet-stream',\n              'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY}\n\n# According to the documentation for the analyze image function\n# we use HTTP POST to call this function\nresponse = requests.post(address, headers=headers, params=parameters, data=image_data)\n\n# Raise an exception if the call returns an error code\nresponse.raise_for_status()\n\n# Display the JSON results returned\nresults = response.json()\nprint(json.dumps(results))\n"
  },
  {
    "path": "python-for-beginners/16 - Calling APIs/code_challenge.py",
    "content": "# Challenge #1\n# Create an Azure Custom Vision Service \n# Analyze an image and return the JSON describing the image.\n# call_api.py is a completed solution, but it will not run unless\n# you do the following:\n#   Create a Custom Vision Service in Azure\n#   Update the Key \n#   Update the address of your service\n#   Update the image file and location\n\n# Bonus Challenge \n# Your skills are growing, it's time to start trying to figure things out on your own\n# based on documentation. You have already called one function of the Computer Vision Service\n# Now try calling another\n# Instead of calling the analyze method of the service, try calling the OCR method \n# Here is some helpful documentation\n# https://docs.microsoft.com/azure/cognitive-services/Computer-vision/concept-recognizing-text#ocr-optical-character-recognition-api\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fc\n# Use the documentation to figure out\n#    The correct function name for the address\n#    The parameters you need to pass the function\n#    The HTTP Headers required    \n# Pass in an image containing text\n# The JSON returned will contain the string of text in the image\n# Good luck!\n"
  },
  {
    "path": "python-for-beginners/16 - Calling APIs/readme.md",
    "content": "# Calling APIs\n\nYou can call functions called by other programs hosted on web servers. [Microsoft Azure Cognitive Services](https://docs.microsoft.com/azure/cognitive-services/?WT.mc_id=python-c9-niner) contain a number of APIs you can call from your code to add intelligence to your apps and websites.\n\nIn the code example you call the [Analyze Image](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa0) function of the [Computer Vision](https://docs.microsoft.com/azure/cognitive-services/computer-vision/?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n\nRequirements for calling an API:\n\n- [API Key](https://azure.microsoft.com/try/cognitive-services/?WT.mc_id=python-c9-niner) to give you permission to call the API\n- Address or Endpoint of the service\n- function name of method to call as listed in the [API documentation](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\n- function parameters as listed in the [API documentation](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa?WT.mc_id=python-c9-niner)\n- HTTP Headers as listed in the [API documentation](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa?WT.mc_id=python-c9-niner)\n"
  },
  {
    "path": "python-for-beginners/17 - JSON/create_json_from_dict.py",
    "content": "import json\n\n# Create a dictionary object\nperson_dict = {'first': 'Christopher', 'last':'Harrison'}\n# Add additional key pairs to dictionary as needed\nperson_dict['City']='Seattle'\n\n# Convert dictionary to JSON object\nperson_json = json.dumps(person_dict)\n\n# Print JSON object\nprint(person_json)\n"
  },
  {
    "path": "python-for-beginners/17 - JSON/create_json_with_list.py",
    "content": "import json\n\n# Create a dictionary object\nperson_dict = {'first': 'Christopher', 'last':'Harrison'}\n# Add additional key pairs to dictionary as needed\nperson_dict['City']='Seattle'\n\n# Create a list object of programming languages \nlanguages_list = ['CSharp','Python','JavaScript']\n\n# Add list object to dictionary for the languages key\nperson_dict['languages']= languages_list\n\n# Convert dictionary to JSON object\nperson_json = json.dumps(person_dict)\n\n# Print JSON object\nprint(person_json)"
  },
  {
    "path": "python-for-beginners/17 - JSON/create_json_with_nested_dict.py",
    "content": "import json\n\n# Create a dictionary object\nperson_dict = {'first': 'Christopher', 'last':'Harrison'}\n# Add additional key pairs to dictionary as needed\nperson_dict['City']='Seattle'\n\n# create a staff dictionary\n# assign a person to a staff position of program manager\nstaff_dict ={}\nstaff_dict['Program Manager']=person_dict\n# Convert dictionary to JSON object\nstaff_json = json.dumps(staff_dict)\n\n# Print JSON object\nprint(staff_json)"
  },
  {
    "path": "python-for-beginners/17 - JSON/read_json.py",
    "content": "# This code will show you how to call the Computer Vision API from Python\n# You can find documentation on the Computer Vision Analyze Image method here\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa\n\n# Use the requests library to simplify making a REST API call from Python \nimport requests\n\n# We will need the json library to read the data passed back \n# by the web service\nimport json\n\n# We need the address of our Computer vision service\nvision_service_address = \"https://canadacentral.api.cognitive.microsoft.com/vision/v2.0/\"\n# Add the name of the function we want to call to the address\naddress = vision_service_address + \"analyze\"\n\n# According to the documentation for the analyze image function \n# There are three optional parameters: language, details & visualFeatures\nparameters  = {'visualFeatures':'Description,Color',\n               'language':'en'}\n\n# We need the key to access our Computer Vision Service\nsubscription_key = \"cf229a23c3054905b5a8ad512edfa9dd\"\n\n# Open the image file to get a file object containing the image to analyze\nimage_path = \"./TestImages/PolarBear.jpg\"\nimage_data = open(image_path, 'rb').read()\n\n# According to the documentation for the analyze image function\n# we need to specify the subscription key and the content type\n# in the HTTP header. Content-Type is application/octet-stream when you pass in a image directly\nheaders    = {'Content-Type': 'application/octet-stream',\n              'Ocp-Apim-Subscription-Key': subscription_key}\n\n# According to the documentation for the analyze image function\n# we use HTTP POST to call this function\nresponse = requests.post(address, headers=headers, params=parameters, data=image_data)\n\n# Raise an exception if the call returns an error code\nresponse.raise_for_status()\n\n# Display the JSON results returned\nresults = response.json()\nprint(json.dumps(results))\n\nprint('requestId')\nprint (results['requestId'])\n\nprint('dominantColorBackground')\nprint(results['color']['dominantColorBackground'])\n\nprint('first_tag')\nprint(results['description']['tags'][0])\n\nfor item in results['description']['tags']:\n    print(item)\n\nprint('caption text')\nprint(results['description']['captions'][0]['text'])\n\n"
  },
  {
    "path": "python-for-beginners/17 - JSON/read_key_pair.py",
    "content": "# This code will show you how to call the Computer Vision API from Python\n# You can find documentation on the Computer Vision Analyze Image method here\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa\n\n# Use the requests library to simplify making a REST API call from Python \nimport requests\n\n# We will need the json library to read the data passed back \n# by the web service\nimport json\n\n# We need the address of our Computer vision service\nvision_service_address = \"https://canadacentral.api.cognitive.microsoft.com/vision/v2.0/\"\n# Add the name of the function we want to call to the address\naddress = vision_service_address + \"analyze\"\n\n# According to the documentation for the analyze image function \n# There are three optional parameters: language, details & visualFeatures\nparameters  = {'visualFeatures':'Description,Color',\n               'language':'en'}\n\n# We need the key to access our Computer Vision Service\nsubscription_key = \"xxxxxxxxxxxxxxxxxxxx\"\n\n# Open the image file to get a file object containing the image to analyze\nimage_path = \"./TestImages/PolarBear.jpg\"\nimage_data = open(image_path, 'rb').read()\n\n# According to the documentation for the analyze image function\n# we need to specify the subscription key and the content type\n# in the HTTP header. Content-Type is application/octet-stream when you pass in a image directly\nheaders    = {'Content-Type': 'application/octet-stream',\n              'Ocp-Apim-Subscription-Key': subscription_key}\n\n# According to the documentation for the analyze image function\n# we use HTTP POST to call this function\nresponse = requests.post(address, headers=headers, params=parameters, data=image_data)\n\n# Raise an exception if the call returns an error code\nresponse.raise_for_status()\n\n# Display the raw JSON results returned\nresults = response.json()\nprint(json.dumps(results))\n\n# print the value for requestId from the JSON output\nprint()\nprint('requestId')\nprint (results['requestId'])"
  },
  {
    "path": "python-for-beginners/17 - JSON/read_key_pair_list.py",
    "content": "# This code will show you how to call the Computer Vision API from Python\n# You can find documentation on the Computer Vision Analyze Image method here\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa\n\n# Use the requests library to simplify making a REST API call from Python \nimport requests\n\n# We will need the json library to read the data passed back \n# by the web service\nimport json\n\n# We need the address of our Computer vision service\nvision_service_address = \"https://canadacentral.api.cognitive.microsoft.com/vision/v2.0/\"\n# Add the name of the function we want to call to the address\naddress = vision_service_address + \"analyze\"\n\n# According to the documentation for the analyze image function \n# There are three optional parameters: language, details & visualFeatures\nparameters  = {'visualFeatures':'Description,Color',\n               'language':'en'}\n\n# We need the key to access our Computer Vision Service\nsubscription_key = \"xxxxxxxxxxxxxxxxxxxxxxx\"\n\n# Open the image file to get a file object containing the image to analyze\nimage_path = \"./TestImages/PolarBear.jpg\"\nimage_data = open(image_path, 'rb').read()\n\n# According to the documentation for the analyze image function\n# we need to specify the subscription key and the content type\n# in the HTTP header. Content-Type is application/octet-stream when you pass in a image directly\nheaders    = {'Content-Type': 'application/octet-stream',\n              'Ocp-Apim-Subscription-Key': subscription_key}\n\n# According to the documentation for the analyze image function\n# we use HTTP POST to call this function\nresponse = requests.post(address, headers=headers, params=parameters, data=image_data)\n\n# Raise an exception if the call returns an error code\nresponse.raise_for_status()\n\n# Display the JSON results returned in their raw JSON format\nresults = response.json()\nprint(json.dumps(results))\n\n# Print out all the tags in the description\nprint()\nprint('all tags')\nfor item in results['description']['tags']:\n    print(item)\n\n# print out the first tag in the description\nprint()\nprint('first_tag')\nprint(results['description']['tags'][0])\n\n\n"
  },
  {
    "path": "python-for-beginners/17 - JSON/read_subkey.py",
    "content": "# This code will show you how to call the Computer Vision API from Python\n# You can find documentation on the Computer Vision Analyze Image method here\n# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa\n\n# Use the requests library to simplify making a REST API call from Python \nimport requests\n\n# We will need the json library to read the data passed back \n# by the web service\nimport json\n\n# We need the address of our Computer vision service\nvision_service_address = \"https://canadacentral.api.cognitive.microsoft.com/vision/v2.0/\"\n# Add the name of the function we want to call to the address\naddress = vision_service_address + \"analyze\"\n\n# According to the documentation for the analyze image function \n# There are three optional parameters: language, details & visualFeatures\nparameters  = {'visualFeatures':'Description,Color',\n               'language':'en'}\n\n# We need the key to access our Computer Vision Service\nsubscription_key = \"xxxxxxxxxxxxxxxxxxxxxxx\"\n\n# Open the image file to get a file object containing the image to analyze\nimage_path = \"./TestImages/PolarBear.jpg\"\nimage_data = open(image_path, 'rb').read()\n\n# According to the documentation for the analyze image function\n# we need to specify the subscription key and the content type\n# in the HTTP header. Content-Type is application/octet-stream when you pass in a image directly\nheaders    = {'Content-Type': 'application/octet-stream',\n              'Ocp-Apim-Subscription-Key': subscription_key}\n\n# According to the documentation for the analyze image function\n# we use HTTP POST to call this function\nresponse = requests.post(address, headers=headers, params=parameters, data=image_data)\n\n# Raise an exception if the call returns an error code\nresponse.raise_for_status()\n\n# Display the raw JSON results returned\nresults = response.json()\nprint(json.dumps(results))\n\n# Print the value for dominantColorBackground from the color keys\nprint()\nprint('dominantColorBackground')\nprint(results['color']['dominantColorBackground'])"
  },
  {
    "path": "python-for-beginners/17 - JSON/readme.md",
    "content": "# JSON\n\nMany APIs return data in [JSON](https://json.org/), JavaScript Object Notation. JSON is a standard format that can is readable by humans and parsed or generated by code. \n\nJSON is built on two structures:\n- collections of key/value pairs\n- lists of values\n\nJSON Linters will format JSON so it easier to read by a human. The following website have JSON linters:\n- [JSONLint](https://jsonlint.com/)\n- [ConvertJson.com](http://www.convertjson.com/jsonlint.htm)\n- [JSON schema linter](https://www.json-schema-linter.com/)\n\nPython includes a [json](https://docs.python.org/2/library/json.html) module which helps you encode and decode JSON"
  },
  {
    "path": "python-for-beginners/18 - Decorators/README.md",
    "content": "# Decorators\n\n[Decorators](https://www.python.org/dev/peps/pep-0318/) are similar to attributes in that they add meaning or functionality to blocks of code in Python. They're frequently used in frameworks such as [Flask](http://flask.pocoo.org/) or [Django](https://www.djangoproject.com/). The most common interaction you'll have with decorators as a Python developer is through using them rather than creating them.\n\n``` python\n# Example decorator\n@log(True)\ndef sample_function():\n    print('this is a sample function')\n```\n"
  },
  {
    "path": "python-for-beginners/18 - Decorators/creating_decorators.py",
    "content": "import functools\nfrom colorama import init, Fore\ninit()\n\ndef color(color):\n    def wrapper(func):\n        @functools.wraps(func)\n        def runner(*args, **kwargs):\n            print(color + 'changing to blue')\n            func(*args, **kwargs)\n        return runner\n    return wrapper\n\n@color(color=Fore.BLUE)\ndef greeter():\n    print('Hello, world!!')\n    print('Just saying hi again')\n\ngreeter()"
  },
  {
    "path": "python-for-beginners/README.md",
    "content": "# Python for beginners\r\n\r\n## Overview\r\n\r\nGetting started with a new environment can be challenging, especially when you literally don't even speak the language. Fortunately, we created a set of videos to help get you up and running with the language, so you can focus on the task at hand - learning how to create applications using Python.\r\n\r\nWe don't dig into specific frameworks, but we help get you ready to start exploring on your own. We'll show you the core Python concepts you'll need as you begin your journey into web development on popular frameworks such as [Django](https://djangoproject.com) and [Flask](https://flask.palletsprojects.com/en/1.1.x/), use AI services such as [Cognitive Services](https://azure.microsoft.com/services/cognitive-services/), or even machine learning.\r\n\r\n### What you'll learn\r\n\r\n- The basics of Python\r\n- Starting a project\r\n- Common syntax\r\n- Package management\r\n\r\n### What we don't cover\r\n\r\n- Class design and inheritance\r\n- Asynchronous programming\r\n- Basics of programming\r\n\r\n## Prerequisites\r\n\r\n- [An understanding of Git](https://git-scm.com/book/en/v1/Getting-Started)\r\n- Light experience with another programming language, such as [JavaScript](https://www.edx.org/course/javascript-introduction)\r\n\r\n## Next steps\r\n\r\nAs the goal of this course is to help get you up to speed on Python so you can work through a quick start, the next step after completing the videos is to follow a tutorial! Here's a few of our favorites:\r\n\r\n- [Quickstart: Detect faces in an image using the Face REST API and Python](https://docs.microsoft.com/azure/cognitive-services/face/QuickStarts/Python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Quickstart: Analyze a local image using the Computer Vision REST API and Python](https://docs.microsoft.com/azure/cognitive-services/computer-vision/quickstarts/python-disk?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Quickstart: Using the Python REST API to call the Text Analytics Cognitive Service](https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/quickstarts/python?WT.mc_id=python-c9-niner?WT.mc_id=python-c9-niner)\r\n- [Tutorial: Build a Flask app with Azure Cognitive Services](https://docs.microsoft.com/azure/cognitive-services/translator/tutorial-build-flask-app-translation-synthesis?WT.mc_id=python-c9-niner)\r\n- [Flask tutorial in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask?WT.mc_id=python-c9-niner)\r\n- [Django tutorial in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-django?WT.mc_id=python-c9-niner)\r\n"
  }
]