From 2ce17dea0ecfcfd0409bf013bb3ee93840b34c84 Mon Sep 17 00:00:00 2001 From: Lutz Hamel Date: Wed, 15 Jan 2025 09:50:09 -0500 Subject: [PATCH] new files --- install/README.md | 19 +++ install/install.ipynb | 325 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 344 insertions(+) create mode 100644 install/README.md create mode 100644 install/install.ipynb diff --git a/install/README.md b/install/README.md new file mode 100644 index 0000000..4eff162 --- /dev/null +++ b/install/README.md @@ -0,0 +1,19 @@ +# VSCode/Jupyter Installation Instructions + +The following instructions should work on all systems +for which VSCode is available. We have tested these instructions +on macOS and Windows. + +* Install Microsoft [Visual Studio Code](https://code.visualstudio.com/) (VSCode) +* Ensure that you have a **working installation of Python 3.x**. + By working we mean that you can invoke Python from + the commandline with the 'python' or 'python3' command. + If this does not work then reinstall [Python](https://www.python.org/) making sure that you allow the installation to modify + your 'path' environment variable. +* Ensure that you have a **working version of git**. Same criteria + as above. If not then + install it from [here](https://git-scm.com/) +* Start VSCode and load the 'install.ipynb' notebook available + in the folder where this readme resides +* Follow the instructions in the notebook + diff --git a/install/install.ipynb b/install/install.ipynb new file mode 100644 index 0000000..f948a77 --- /dev/null +++ b/install/install.ipynb @@ -0,0 +1,325 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Installation Notebook for VSCode\n", + "\n", + "## Installing the Jupyter extension\n", + "\n", + "* Load this notebook into your VSCode editor\n", + "\n", + "* Install the 'Jupyter' extension published by Microsoft. Usuall\n", + " this means simply following the instructions given by VSCode.\n", + "\n", + "* Press the 'Select Kernel' button and keep selecting Python Environment/Python until you have selected a specific Python version (if no specific Python version shows up then you do not have a working Python installation on your machine - see README)\n", + "\n", + "* Once you have a Python kernel selected press the 'Run All' \n", + " button. Your notebook should run and the last code cell \n", + " should print out the message \"*** installation is working ***\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Notebook Autoconfig\n", + "\n", + "The following code cell configures your notebook according to \n", + "the requirements of the CSC310 course." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Already up to date.\n" + ] + } + ], + "source": [ + "import sys, os, platform\n", + "if os.path.isdir(\"ds-assets\"):\n", + " !cd ds-assets && git pull\n", + "else:\n", + " !git clone https://github.com/lutzhamel/ds-assets.git\n", + "colab = True if 'google.colab' in os.sys.modules else False\n", + "system = platform.system() # \"Windows\", \"Linux\", \"Darwin\"\n", + "if system not in [\"Windows\", \"Linux\", \"Darwin\"]:\n", + " raise Exception(\"System not supported: \"+system)\n", + "home = \"ds-assets/assets/\"\n", + "sys.path.append(home) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Install required Modules\n", + "\n", + "The following code cell will install required modules on \n", + "your machine." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (2.2.3)\n", + "Requirement already satisfied: numpy>=1.26.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from pandas) (2.2.0)\n", + "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from pandas) (2.9.0.post0)\n", + "Requirement already satisfied: pytz>=2020.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from pandas) (2024.2)\n", + "Requirement already satisfied: tzdata>=2022.7 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from pandas) (2024.2)\n", + "Requirement already satisfied: six>=1.5 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n", + "Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (2.2.0)\n", + "Requirement already satisfied: scikit-learn in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (1.6.0)\n", + "Requirement already satisfied: numpy>=1.19.5 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from scikit-learn) (2.2.0)\n", + "Requirement already satisfied: scipy>=1.6.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from scikit-learn) (1.14.1)\n", + "Requirement already satisfied: joblib>=1.2.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from scikit-learn) (1.4.2)\n", + "Requirement already satisfied: threadpoolctl>=3.1.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from scikit-learn) (3.5.0)\n", + "Requirement already satisfied: matplotlib in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (3.10.0)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (1.3.1)\n", + "Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (4.55.3)\n", + "Requirement already satisfied: kiwisolver>=1.3.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (1.4.7)\n", + "Requirement already satisfied: numpy>=1.23 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (2.2.0)\n", + "Requirement already satisfied: packaging>=20.0 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from matplotlib) (24.2)\n", + "Requirement already satisfied: pillow>=8 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (11.0.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib) (3.2.0)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from matplotlib) (2.9.0.post0)\n", + "Requirement already satisfied: six>=1.5 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from python-dateutil>=2.7->matplotlib) (1.17.0)\n", + "Requirement already satisfied: seaborn in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (0.13.2)\n", + "Requirement already satisfied: numpy!=1.24.0,>=1.20 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from seaborn) (2.2.0)\n", + "Requirement already satisfied: pandas>=1.2 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from seaborn) (2.2.3)\n", + "Requirement already satisfied: matplotlib!=3.6.1,>=3.4 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from seaborn) (3.10.0)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.3.1)\n", + "Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (4.55.3)\n", + "Requirement already satisfied: kiwisolver>=1.3.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.4.7)\n", + "Requirement already satisfied: packaging>=20.0 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (24.2)\n", + "Requirement already satisfied: pillow>=8 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (11.0.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (3.2.0)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (2.9.0.post0)\n", + "Requirement already satisfied: pytz>=2020.1 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from pandas>=1.2->seaborn) (2024.2)\n", + "Requirement already satisfied: tzdata>=2022.7 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from pandas>=1.2->seaborn) (2024.2)\n", + "Requirement already satisfied: six>=1.5 in /Users/lutz/Library/Python/3.13/lib/python/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.4->seaborn) (1.17.0)\n", + "Requirement already satisfied: PyMySQL in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (1.1.1)\n", + "Requirement already satisfied: nltk in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (3.9.1)\n", + "Requirement already satisfied: click in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from nltk) (8.1.8)\n", + "Requirement already satisfied: joblib in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from nltk) (1.4.2)\n", + "Requirement already satisfied: regex>=2021.8.3 in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from nltk) (2024.11.6)\n", + "Requirement already satisfied: tqdm in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (from nltk) (4.67.1)\n" + ] + } + ], + "source": [ + "!pip3 install pandas\n", + "!pip3 install numpy\n", + "!pip3 install scikit-learn # sklearn\n", + "!pip3 install matplotlib\n", + "!pip3 install seaborn\n", + "!pip3 install PyMySQL\n", + "!pip3 install nltk\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Basic Testing\n", + "\n", + "Run some basic data science tasks to see if your notebook works." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# notebook level imports\n", + "import pandas # general data tool box" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "iris_df = pandas.read_csv(home+'iris.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idSepal.LengthSepal.WidthPetal.LengthPetal.WidthSpecies
015.13.51.40.2setosa
124.93.01.40.2setosa
234.73.21.30.2setosa
344.63.11.50.2setosa
455.03.61.40.2setosa
\n", + "
" + ], + "text/plain": [ + " id Sepal.Length Sepal.Width Petal.Length Petal.Width Species\n", + "0 1 5.1 3.5 1.4 0.2 setosa\n", + "1 2 4.9 3.0 1.4 0.2 setosa\n", + "2 3 4.7 3.2 1.3 0.2 setosa\n", + "3 4 4.6 3.1 1.5 0.2 setosa\n", + "4 5 5.0 3.6 1.4 0.2 setosa" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "iris_df.head(n=5)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(150, 6)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "iris_df.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*** installation is working ***\n" + ] + } + ], + "source": [ + "print(\"*** installation is working ***\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}