├── .gitignore ├── README.md ├── course_material ├── Survival-Guide.pptx ├── tidy-data.pdf ├── titanic │ ├── best_score.png │ └── titanic_competition.md ├── week_01 │ ├── 01_Presentation.pptx │ ├── Data Types.ipynb │ ├── Schedule_template.xlsx │ ├── hw1_problem_set.ipynb │ ├── python_click_through_1.ipynb │ └── week 1 group exercise.pdf ├── week_02 │ ├── Loops and Functions.ipynb │ ├── Week 2 Group Coding Exercise.pdf │ ├── warm-up.ipynb │ ├── week_02_homework.ipynb │ ├── week_02_homework_hints.ipynb │ └── week_02_presentation.pptx ├── week_03 │ ├── Classes.ipynb │ ├── Week 3 Group Exercise.pdf │ ├── cars.csv │ ├── numpy_basics.ipynb │ ├── week_03_homework.ipynb │ └── week_03_presentation.pptx ├── week_04 │ ├── Week 4 Group Activity.pdf │ ├── belize_airbnb_listings.csv │ ├── homework │ │ ├── Output_examples.ipynb │ │ ├── README.md │ │ ├── Resources │ │ │ └── purchase_data.csv │ │ └── week_04_starter.ipynb │ ├── pandas_part_1.ipynb │ ├── pandas_part_2.ipynb │ └── week_04_presentation.pptx ├── week_05 │ ├── JEOPARDY_CSV.csv │ ├── WeatherPy_homework_starter.ipynb │ ├── apis.ipynb │ ├── intro to data viz.ipynb │ ├── week 5 group activity.pdf │ └── week_05_presentation.pptx ├── week_06 │ ├── Week 6 group activity.pdf │ ├── dvdrental │ │ ├── 3055.dat │ │ ├── 3057.dat │ │ ├── 3059.dat │ │ ├── 3061.dat │ │ ├── 3062.dat │ │ ├── 3063.dat │ │ ├── 3065.dat │ │ ├── 3067.dat │ │ ├── 3069.dat │ │ ├── 3071.dat │ │ ├── 3073.dat │ │ ├── 3075.dat │ │ ├── 3077.dat │ │ ├── 3079.dat │ │ ├── 3081.dat │ │ ├── dvdrental.tar │ │ ├── restore.sql │ │ └── toc.dat │ ├── postgresql and pgadmin install instructions.docx │ ├── printable-postgresql-sample-database-diagram.pdf │ ├── week_06_presentation.pptx │ └── week_6_sql_hw.docx ├── week_07 │ ├── week 7 group activity.pdf │ ├── week_07_presentation.pptx │ └── week_7_sql_hw.docx ├── week_08 │ ├── Week 8 group exercise.pdf │ ├── basic_stats.ipynb │ ├── belize_airbnb_listings.csv │ └── week_08_presentation.pptx ├── week_09 │ ├── probability_hw.docx │ ├── week 9 group exercise.pdf │ └── week_09_presentation.pptx ├── week_10 │ ├── intro_to_linear_algebra.ipynb │ ├── intro_to_recursion.ipynb │ ├── linear_algebra_hw.docx │ ├── try_except_examples.ipynb │ ├── week 10 group exercise.pdf │ └── week_10_presentation.pptx ├── week_11 │ ├── intro_to_time_series.ipynb │ ├── temperatures │ │ └── temperature.csv │ ├── timeseries_hw.docx │ ├── uniqlo_stock_2012-2016.csv │ ├── week 11 Group Activity.pdf │ └── week_11_presentation.pptx ├── week_12 │ ├── intro_to_ml.docx │ ├── lambda.ipynb │ ├── ml_preprocessing.ipynb │ ├── week 12 group exercise.pdf │ └── week_12_presentation.pptx ├── week_13 │ ├── crime_data.csv │ ├── diabetes.csv │ ├── intro_to_supervised_learning.ipynb │ ├── supervised_learning.docx │ ├── week 13 group exercise.pdf │ └── week_13_presentation.pptx ├── week_14 │ ├── logistic_regression.ipynb │ ├── multiple_linear_regression.ipynb │ ├── regression_hw.docx │ ├── week 14 group exercise.pdf │ └── week_14_presentation.pptx ├── week_15 │ ├── over_under_sampling.ipynb │ ├── week 15 group exercise.pdf │ └── week_15_presentation.pptx ├── week_16 │ ├── decision_trees.ipynb │ ├── svm_over_under_sampling_hw.docx │ ├── tree.svg │ ├── week 16 group exercise.pdf │ └── week_16_presentation.pptx ├── week_17 │ ├── ensembles.ipynb │ ├── tree.svg │ ├── tree_based_models_hw.docx │ ├── week 17 group exercise.pdf │ └── week_17_presentation.pptx ├── week_18 │ ├── neural_networks.ipynb │ ├── neural_networks_hw.docx │ ├── week 18 group exercise.pdf │ └── week_18_presentation.pptx ├── week_19 │ ├── Data-Science-Assignments - Shortcut.lnk │ ├── USArrests.csv │ ├── unsupervised_learning.ipynb │ ├── unsupervised_learning_hw.docx │ ├── week 19 group exercise.pdf │ └── week_19_presentation.pptx ├── week_20 │ ├── NLP.ipynb │ ├── cats_txt.txt │ ├── map_reduce │ │ ├── mapper.py │ │ └── reducer.py │ ├── natural_language_processing_hw.docx │ ├── week 20 group exercise.pdf │ └── week_20_presentation.pptx ├── week_21 │ ├── APIs_hw.docx │ ├── Azure_flask_app_steps.txt │ ├── flask_demo │ │ ├── flask-app.py │ │ ├── static │ │ │ └── us_gdp.json │ │ └── templates │ │ │ ├── .gitignore │ │ │ └── index.html │ ├── nobel.json │ ├── us_gdp.json │ ├── week 21 group exercise.pdf │ └── week_21_presentation.pptx ├── week_22 │ ├── web_scraping.ipynb │ ├── webscraping_hw.docx │ ├── week 22 group exercise.pdf │ └── week_22_presentation.pptx └── week_23 │ ├── pymongo.ipynb │ ├── pymongo_app │ ├── app.py │ └── templates │ │ └── index.html │ ├── week 23 group exercise.pdf │ └── week_23_presentation.pptx ├── etl_project └── README.md ├── exploratory_data_analysis_project └── README.md └── final_project └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | **/.ipynb_checkpoints 2 | **/__pycache__ 3 | **/api_keys.py 4 | **/.DS_Store 5 | *~ -------------------------------------------------------------------------------- /course_material/Survival-Guide.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/Survival-Guide.pptx -------------------------------------------------------------------------------- /course_material/tidy-data.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/tidy-data.pdf -------------------------------------------------------------------------------- /course_material/titanic/best_score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/titanic/best_score.png -------------------------------------------------------------------------------- /course_material/titanic/titanic_competition.md: -------------------------------------------------------------------------------- 1 | ### Optional Titanic Competition 2 | 3 | 1. This assignment is 100% optional. This could be part of your portfolio. Please use the Holiday Break to work on whatever you feel will benefit you the most such as: 4 | * This assignment. :-) 5 | * Other programming projects. 6 | * Catch up on previous assignments. 7 | * Or take a much needed break. 8 | 2. Instructions for Getting Started 9 | 1. Have fun and learn something! 10 | 2. Head over to Kaggle and [sign up](https://www.kaggle.com/). 11 | 3. Navigate to the [Titanic Competition](https://www.kaggle.com/c/titanic). NOTE: There are a few so use this link to get to the right one. 12 | 1. You may be required to click to enter the competition and accept terms. 13 | 2. Download the `train.csv` and `test.csv` under the Data tab. 14 | 3. Read the Data Overview and Description sections to know what each column actually means. 15 | 3. Submissions 16 | 1. After entering the competition you can score your models by submitting a csv under `Data>Submit Predictions`. Please follow the guidelines outlined to format the csv. 17 | 18 | 4. Gift Card Eligibility 19 | 1. Amazon Gift Cards will be awarded to the team with the highest score. 20 | 2. To be eligible you must meet the following requirements: 21 | 3. Teams of 1-4 Students (self formed) 22 | 4. Submit a link to your github notebook. 23 | * Must have a functioning notebook with model that outputs a predictions csv that can be scored by Kaggle. (Does not have to be your best model). 24 | * Must include a screenshot of your best score. Like the one at the end of this file. Have this image file in your repo. 25 | 5. The team(s) with the Highest accuracy score on Kaggle will receive gift cards. 26 | 6. Submission Deadline is 5:30pm the date of next class. 27 | 7. Must be your original work. 28 | 29 | ![proof of Kaggle score](./best_score.png) 30 | 31 | 32 | ### Tips for The Competition 33 | 1. Have fun and learn! 34 | 2. Read the Kaggle Data Descriptions to know what each column is. 35 | 3. Focus on one or two types of models. You won't have time to try them all. 36 | 4. Get something scored as fast as you can. 37 | * Then work on improvements. 38 | 6. Once you've got a scored model look at the Discussion and other notebooks on Kaggle for inspiration and apply that knowledge. 39 | 7. If you are stuck reach out on Slack. We're here to help! 40 | -------------------------------------------------------------------------------- /course_material/week_01/01_Presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_01/01_Presentation.pptx -------------------------------------------------------------------------------- /course_material/week_01/Data Types.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Data Types" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "#to run cells, you can press shift-enter on windows and command-enter on mac\n", 17 | "# integers are whole numbers\n", 18 | "# floats are decimals\n", 19 | "x = 5\n", 20 | "y = 5.0 " 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "\n" 33 | ] 34 | } 35 | ], 36 | "source": [ 37 | "print(type(x))" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 3, 43 | "metadata": {}, 44 | "outputs": [ 45 | { 46 | "name": "stdout", 47 | "output_type": "stream", 48 | "text": [ 49 | "\n" 50 | ] 51 | } 52 | ], 53 | "source": [ 54 | "print(type(y))" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": 4, 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [ 63 | "# Dictionaries are key:value pairs\n", 64 | "breakfast = {\"eggs\":18,\n", 65 | " \"bacon\":10}" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": 5, 71 | "metadata": {}, 72 | "outputs": [ 73 | { 74 | "name": "stdout", 75 | "output_type": "stream", 76 | "text": [ 77 | "18\n" 78 | ] 79 | } 80 | ], 81 | "source": [ 82 | "print(breakfast[\"eggs\"])" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 6, 88 | "metadata": {}, 89 | "outputs": [ 90 | { 91 | "name": "stdout", 92 | "output_type": "stream", 93 | "text": [ 94 | "\n" 95 | ] 96 | } 97 | ], 98 | "source": [ 99 | "#Boolean\n", 100 | "is_true = False\n", 101 | "print(type(is_true))" 102 | ] 103 | }, 104 | { 105 | "cell_type": "code", 106 | "execution_count": 7, 107 | "metadata": {}, 108 | "outputs": [ 109 | { 110 | "name": "stdout", 111 | "output_type": "stream", 112 | "text": [ 113 | "{'bacon', 'coffee', 'eggs'}\n" 114 | ] 115 | } 116 | ], 117 | "source": [ 118 | "#sets have unordered values and unchangeable values (immutable)\n", 119 | "breakfast_set = {\"eggs\",\"bacon\"}\n", 120 | "#can add items to a set (but only if its not there yet)\n", 121 | "breakfast_set.add(\"coffee\")\n", 122 | "\n", 123 | "print(breakfast_set)" 124 | ] 125 | }, 126 | { 127 | "cell_type": "code", 128 | "execution_count": 11, 129 | "metadata": {}, 130 | "outputs": [ 131 | { 132 | "data": { 133 | "text/plain": [ 134 | "'February'" 135 | ] 136 | }, 137 | "execution_count": 11, 138 | "metadata": {}, 139 | "output_type": "execute_result" 140 | } 141 | ], 142 | "source": [ 143 | "# list values can be changed and they are ordered\n", 144 | "months = [\"January\",\"February\",\"March\"]\n", 145 | "months[0]" 146 | ] 147 | }, 148 | { 149 | "cell_type": "code", 150 | "execution_count": 12, 151 | "metadata": {}, 152 | "outputs": [ 153 | { 154 | "data": { 155 | "text/plain": [ 156 | "'coffee'" 157 | ] 158 | }, 159 | "execution_count": 12, 160 | "metadata": {}, 161 | "output_type": "execute_result" 162 | } 163 | ], 164 | "source": [ 165 | "# tuples are ordered but unchangeable (immutable)\n", 166 | "breakfast_tuple = (\"coffee\",\"bagels\",\"cereal\")\n", 167 | "breakfast_tuple[0]" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": 14, 173 | "metadata": {}, 174 | "outputs": [ 175 | { 176 | "name": "stdout", 177 | "output_type": "stream", 178 | "text": [ 179 | "3\n" 180 | ] 181 | } 182 | ], 183 | "source": [ 184 | "print(len(breakfast_tuple))" 185 | ] 186 | }, 187 | { 188 | "cell_type": "code", 189 | "execution_count": null, 190 | "metadata": {}, 191 | "outputs": [], 192 | "source": [] 193 | } 194 | ], 195 | "metadata": { 196 | "kernelspec": { 197 | "display_name": "Python 3", 198 | "language": "python", 199 | "name": "python3" 200 | }, 201 | "language_info": { 202 | "codemirror_mode": { 203 | "name": "ipython", 204 | "version": 3 205 | }, 206 | "file_extension": ".py", 207 | "mimetype": "text/x-python", 208 | "name": "python", 209 | "nbconvert_exporter": "python", 210 | "pygments_lexer": "ipython3", 211 | "version": "3.8.3" 212 | } 213 | }, 214 | "nbformat": 4, 215 | "nbformat_minor": 4 216 | } 217 | -------------------------------------------------------------------------------- /course_material/week_01/Schedule_template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_01/Schedule_template.xlsx -------------------------------------------------------------------------------- /course_material/week_01/hw1_problem_set.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### Homework 1\n", 8 | "\n", 9 | "Skim this Homework before you do your reading assignments. It will help focus your attention. \n", 10 | "\n", 11 | "Provide written answers to questions with a `#comment`. \n", 12 | "\n", 13 | "Answer the following question **first**. The rest may be completed in any order." 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "1. How can you get more information about a function or an object from inside a jupyter cell? " 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [] 29 | }, 30 | { 31 | "cell_type": "markdown", 32 | "metadata": {}, 33 | "source": [ 34 | "2. How can you determine the data type of an object? " 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [] 43 | }, 44 | { 45 | "cell_type": "markdown", 46 | "metadata": {}, 47 | "source": [ 48 | "3. Assign a variable named `foo` and give it a value of `'bar'`. Oh, and what is assignment?" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": null, 54 | "metadata": {}, 55 | "outputs": [], 56 | "source": [] 57 | }, 58 | { 59 | "cell_type": "markdown", 60 | "metadata": {}, 61 | "source": [ 62 | "4. What is a data structure in another language that is not built into python? Does python have a similar data structure that may serve the same purpose? " 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": {}, 69 | "outputs": [], 70 | "source": [] 71 | }, 72 | { 73 | "cell_type": "markdown", 74 | "metadata": {}, 75 | "source": [ 76 | "5. You have an assortment of items you will need to keep track of. What would be a good data structure to keep them in? Provide an example." 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": null, 82 | "metadata": {}, 83 | "outputs": [], 84 | "source": [] 85 | }, 86 | { 87 | "cell_type": "markdown", 88 | "metadata": {}, 89 | "source": [ 90 | "6. You have an assortment of names and telephone numbers. What might be a good data structure to keep them in? Show an example. " 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [] 99 | }, 100 | { 101 | "cell_type": "markdown", 102 | "metadata": {}, 103 | "source": [ 104 | "7. You need to create a copy of an important list and alter the copy. Why is the following code a bad idea? " 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 2, 110 | "metadata": {}, 111 | "outputs": [], 112 | "source": [ 113 | "list1 = [1,2,3]\n", 114 | "list2 = list1\n", 115 | "list2[0]= 9" 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": null, 121 | "metadata": {}, 122 | "outputs": [], 123 | "source": [] 124 | }, 125 | { 126 | "cell_type": "markdown", 127 | "metadata": {}, 128 | "source": [ 129 | "8. What is truthy and falsey? Provide a list example and a string example. " 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": null, 135 | "metadata": {}, 136 | "outputs": [], 137 | "source": [] 138 | }, 139 | { 140 | "cell_type": "markdown", 141 | "metadata": {}, 142 | "source": [ 143 | "9. What is the difference between a dynamically typed and statically typed language? \n", 144 | "\n", 145 | "Which one is python? \n", 146 | "\n", 147 | "When is that a good thing? \n", 148 | "\n", 149 | "When is that a bad thing? " 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": null, 155 | "metadata": {}, 156 | "outputs": [], 157 | "source": [] 158 | }, 159 | { 160 | "cell_type": "markdown", 161 | "metadata": {}, 162 | "source": [ 163 | "10. Here is a [link](https://docs.python.org/3/library/functions.html) to the python `built-in functions`. Choose 2 and give an example of how to use them. " 164 | ] 165 | }, 166 | { 167 | "cell_type": "code", 168 | "execution_count": null, 169 | "metadata": {}, 170 | "outputs": [], 171 | "source": [] 172 | }, 173 | { 174 | "cell_type": "markdown", 175 | "metadata": {}, 176 | "source": [ 177 | "11. I need to know if an integer is odd or even. What `operator` might help me do that? " 178 | ] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": null, 183 | "metadata": {}, 184 | "outputs": [], 185 | "source": [] 186 | }, 187 | { 188 | "cell_type": "markdown", 189 | "metadata": {}, 190 | "source": [ 191 | "12. What is an operator? " 192 | ] 193 | }, 194 | { 195 | "cell_type": "code", 196 | "execution_count": null, 197 | "metadata": {}, 198 | "outputs": [], 199 | "source": [] 200 | }, 201 | { 202 | "cell_type": "markdown", 203 | "metadata": {}, 204 | "source": [ 205 | "13. What is a data type in another language does not exist in python? Does python have a similar data type" 206 | ] 207 | }, 208 | { 209 | "cell_type": "code", 210 | "execution_count": null, 211 | "metadata": {}, 212 | "outputs": [], 213 | "source": [] 214 | }, 215 | { 216 | "cell_type": "markdown", 217 | "metadata": {}, 218 | "source": [ 219 | "14. What is a python expression? And what does it evalute to? " 220 | ] 221 | }, 222 | { 223 | "cell_type": "code", 224 | "execution_count": null, 225 | "metadata": {}, 226 | "outputs": [], 227 | "source": [] 228 | }, 229 | { 230 | "cell_type": "markdown", 231 | "metadata": {}, 232 | "source": [ 233 | "15. Provide an expression that evaluates which variable is greater. (Hint: you can just test them and don't need to say which is greater)" 234 | ] 235 | }, 236 | { 237 | "cell_type": "code", 238 | "execution_count": 3, 239 | "metadata": {}, 240 | "outputs": [], 241 | "source": [ 242 | "foo = 23\n", 243 | "bar = 48" 244 | ] 245 | }, 246 | { 247 | "cell_type": "markdown", 248 | "metadata": {}, 249 | "source": [ 250 | "16. Provide an if statement (inside the provided for loop) that prints 'even' if the number is even, 'odd' if the number is odd and 'three' if the number is 3." 251 | ] 252 | }, 253 | { 254 | "cell_type": "code", 255 | "execution_count": 4, 256 | "metadata": {}, 257 | "outputs": [], 258 | "source": [ 259 | "my_list = [1,2,3,4,5,6,7,8,9]\n", 260 | "for i in my_list:\n", 261 | " pass\n", 262 | " #Your if statement goes here.\n", 263 | " #Be sure to indent the statement\n", 264 | " #And delete the word 'pass'" 265 | ] 266 | }, 267 | { 268 | "cell_type": "markdown", 269 | "metadata": {}, 270 | "source": [ 271 | "17. What is the equal operator? `# comment it out`\n", 272 | "And show an example of how it is used. " 273 | ] 274 | }, 275 | { 276 | "cell_type": "code", 277 | "execution_count": null, 278 | "metadata": {}, 279 | "outputs": [], 280 | "source": [] 281 | }, 282 | { 283 | "cell_type": "markdown", 284 | "metadata": {}, 285 | "source": [ 286 | "18. What is the less than equal to operator? And show an example of how it is used. " 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": null, 292 | "metadata": {}, 293 | "outputs": [], 294 | "source": [] 295 | }, 296 | { 297 | "cell_type": "markdown", 298 | "metadata": {}, 299 | "source": [ 300 | "19. What is the modulo remainder operator? And show an example of how it is used. " 301 | ] 302 | }, 303 | { 304 | "cell_type": "code", 305 | "execution_count": null, 306 | "metadata": {}, 307 | "outputs": [], 308 | "source": [] 309 | }, 310 | { 311 | "cell_type": "markdown", 312 | "metadata": {}, 313 | "source": [ 314 | "20. What is the floored division operator? And show an example of how it is used. " 315 | ] 316 | }, 317 | { 318 | "cell_type": "code", 319 | "execution_count": null, 320 | "metadata": {}, 321 | "outputs": [], 322 | "source": [] 323 | }, 324 | { 325 | "cell_type": "markdown", 326 | "metadata": {}, 327 | "source": [ 328 | "21. Why is this assigment not a good idea? (Hint: focus on the word hex)" 329 | ] 330 | }, 331 | { 332 | "cell_type": "code", 333 | "execution_count": 5, 334 | "metadata": {}, 335 | "outputs": [], 336 | "source": [ 337 | "hex = 'some text value'" 338 | ] 339 | }, 340 | { 341 | "cell_type": "markdown", 342 | "metadata": {}, 343 | "source": [ 344 | "22. Why does the following give an error? Show an example of how to fix it." 345 | ] 346 | }, 347 | { 348 | "cell_type": "code", 349 | "execution_count": 6, 350 | "metadata": {}, 351 | "outputs": [ 352 | { 353 | "ename": "SyntaxError", 354 | "evalue": "invalid syntax (, line 1)", 355 | "output_type": "error", 356 | "traceback": [ 357 | "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 2cars = ('Ferarri', 'Mustang')\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" 358 | ] 359 | } 360 | ], 361 | "source": [ 362 | "2cars = ('Ferarri', 'Mustang')" 363 | ] 364 | }, 365 | { 366 | "cell_type": "code", 367 | "execution_count": null, 368 | "metadata": {}, 369 | "outputs": [], 370 | "source": [] 371 | }, 372 | { 373 | "cell_type": "markdown", 374 | "metadata": {}, 375 | "source": [ 376 | "23. Why does this if statement evaluate to true? \n", 377 | "You will see this shortcut a lot and it can be confusing as to what is going on. " 378 | ] 379 | }, 380 | { 381 | "cell_type": "code", 382 | "execution_count": 7, 383 | "metadata": {}, 384 | "outputs": [ 385 | { 386 | "name": "stdout", 387 | "output_type": "stream", 388 | "text": [ 389 | "Hooray!\n" 390 | ] 391 | } 392 | ], 393 | "source": [ 394 | "some_list = ['fizz','buzz',1,{'key':'value'}]\n", 395 | "\n", 396 | "if some_list:\n", 397 | " print('Hooray!')" 398 | ] 399 | }, 400 | { 401 | "cell_type": "code", 402 | "execution_count": null, 403 | "metadata": {}, 404 | "outputs": [], 405 | "source": [] 406 | }, 407 | { 408 | "cell_type": "markdown", 409 | "metadata": {}, 410 | "source": [ 411 | "24. Write an expression that adds two numbers. " 412 | ] 413 | }, 414 | { 415 | "cell_type": "code", 416 | "execution_count": null, 417 | "metadata": {}, 418 | "outputs": [], 419 | "source": [] 420 | }, 421 | { 422 | "cell_type": "markdown", 423 | "metadata": {}, 424 | "source": [ 425 | "25. Write an expression that divides two numbers. " 426 | ] 427 | }, 428 | { 429 | "cell_type": "code", 430 | "execution_count": null, 431 | "metadata": {}, 432 | "outputs": [], 433 | "source": [] 434 | }, 435 | { 436 | "cell_type": "markdown", 437 | "metadata": {}, 438 | "source": [ 439 | "26. Write an expression that raises one number to the power of 3. " 440 | ] 441 | }, 442 | { 443 | "cell_type": "code", 444 | "execution_count": null, 445 | "metadata": {}, 446 | "outputs": [], 447 | "source": [] 448 | }, 449 | { 450 | "cell_type": "markdown", 451 | "metadata": {}, 452 | "source": [ 453 | "27. You've been asked to do some semi-avanced mathematics and create a report. What module might you import to help make your job easier? \n", 454 | "\n", 455 | "Import this module below. (Hint: It's part of the Python Standard Library)" 456 | ] 457 | }, 458 | { 459 | "cell_type": "code", 460 | "execution_count": null, 461 | "metadata": {}, 462 | "outputs": [], 463 | "source": [] 464 | }, 465 | { 466 | "cell_type": "markdown", 467 | "metadata": {}, 468 | "source": [ 469 | "28. How can you change `my_var` form an `int` to a `str`?" 470 | ] 471 | }, 472 | { 473 | "cell_type": "code", 474 | "execution_count": 12, 475 | "metadata": {}, 476 | "outputs": [], 477 | "source": [ 478 | "my_var = 42" 479 | ] 480 | }, 481 | { 482 | "cell_type": "code", 483 | "execution_count": null, 484 | "metadata": {}, 485 | "outputs": [], 486 | "source": [] 487 | }, 488 | { 489 | "cell_type": "markdown", 490 | "metadata": {}, 491 | "source": [ 492 | "29. Slice `some_string` to only include the words `lazy`. " 493 | ] 494 | }, 495 | { 496 | "cell_type": "code", 497 | "execution_count": 13, 498 | "metadata": {}, 499 | "outputs": [], 500 | "source": [ 501 | "some_string = \"The quick brown fox jumped over the lazy dog.\"" 502 | ] 503 | }, 504 | { 505 | "cell_type": "code", 506 | "execution_count": null, 507 | "metadata": {}, 508 | "outputs": [], 509 | "source": [] 510 | }, 511 | { 512 | "cell_type": "markdown", 513 | "metadata": {}, 514 | "source": [ 515 | "30. Assign a new variable `sport` to the 3rd element in the list." 516 | ] 517 | }, 518 | { 519 | "cell_type": "code", 520 | "execution_count": 14, 521 | "metadata": {}, 522 | "outputs": [], 523 | "source": [ 524 | "my_favorite_teams= ['Chiefs', 'Cardinals', 'Blues', 'Lakers','Manchester United', 'Couch Surfing']" 525 | ] 526 | }, 527 | { 528 | "cell_type": "code", 529 | "execution_count": null, 530 | "metadata": {}, 531 | "outputs": [], 532 | "source": [] 533 | }, 534 | { 535 | "cell_type": "markdown", 536 | "metadata": {}, 537 | "source": [ 538 | "**Optional Questions:**" 539 | ] 540 | }, 541 | { 542 | "cell_type": "markdown", 543 | "metadata": {}, 544 | "source": [ 545 | "Write a function that takes in a number and doubles it. " 546 | ] 547 | }, 548 | { 549 | "cell_type": "code", 550 | "execution_count": null, 551 | "metadata": {}, 552 | "outputs": [], 553 | "source": [] 554 | }, 555 | { 556 | "cell_type": "markdown", 557 | "metadata": {}, 558 | "source": [ 559 | "What is the use case for the `dir()` method? " 560 | ] 561 | }, 562 | { 563 | "cell_type": "code", 564 | "execution_count": null, 565 | "metadata": {}, 566 | "outputs": [], 567 | "source": [] 568 | }, 569 | { 570 | "cell_type": "markdown", 571 | "metadata": {}, 572 | "source": [ 573 | "Reverse the following string using only slicing methods." 574 | ] 575 | }, 576 | { 577 | "cell_type": "code", 578 | "execution_count": 15, 579 | "metadata": {}, 580 | "outputs": [], 581 | "source": [ 582 | "irreversible = \"Can you reverse me?\"" 583 | ] 584 | }, 585 | { 586 | "cell_type": "code", 587 | "execution_count": null, 588 | "metadata": {}, 589 | "outputs": [], 590 | "source": [] 591 | }, 592 | { 593 | "cell_type": "code", 594 | "execution_count": null, 595 | "metadata": {}, 596 | "outputs": [], 597 | "source": [] 598 | }, 599 | { 600 | "cell_type": "code", 601 | "execution_count": null, 602 | "metadata": {}, 603 | "outputs": [], 604 | "source": [] 605 | } 606 | ], 607 | "metadata": { 608 | "kernelspec": { 609 | "display_name": "Python 3", 610 | "language": "python", 611 | "name": "python3" 612 | }, 613 | "language_info": { 614 | "codemirror_mode": { 615 | "name": "ipython", 616 | "version": 3 617 | }, 618 | "file_extension": ".py", 619 | "mimetype": "text/x-python", 620 | "name": "python", 621 | "nbconvert_exporter": "python", 622 | "pygments_lexer": "ipython3", 623 | "version": "3.8.3" 624 | } 625 | }, 626 | "nbformat": 4, 627 | "nbformat_minor": 4 628 | } 629 | -------------------------------------------------------------------------------- /course_material/week_01/week 1 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_01/week 1 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_02/Loops and Functions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Loops and Functions\n" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 4, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "b is greater\n" 20 | ] 21 | } 22 | ], 23 | "source": [ 24 | "# if... elif...else\n", 25 | "# if a equals b, return \"they are equal\", if a >b return \"a is greater\", and if b>a return \"b is greater\"\n", 26 | "a = 2\n", 27 | "b = 3\n", 28 | "\n", 29 | "#what happens if you do if a>=b instead of the elif line?\n", 30 | "if a==b:\n", 31 | " print(\"they are equal\")\n", 32 | "elif a>b:\n", 33 | " print(\"a is greater\")\n", 34 | "#elif b>a:\n", 35 | "else:\n", 36 | " print(\"b is greater\")" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 6, 42 | "metadata": {}, 43 | "outputs": [ 44 | { 45 | "name": "stdout", 46 | "output_type": "stream", 47 | "text": [ 48 | "7\n", 49 | "6\n" 50 | ] 51 | } 52 | ], 53 | "source": [ 54 | "# while loops\n", 55 | "# repeatedly testing an expression and continuing to run what happens in the loop until a condition is met\n", 56 | "x = 7\n", 57 | "while x > 5:\n", 58 | " print(x)\n", 59 | " #x= x -1\n", 60 | " x-=1" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 7, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "name": "stdout", 70 | "output_type": "stream", 71 | "text": [ 72 | "3\n", 73 | "4\n", 74 | "5\n", 75 | "6\n", 76 | "7\n", 77 | "8\n", 78 | "9\n" 79 | ] 80 | } 81 | ], 82 | "source": [ 83 | "#Create a scenaio where x starts at 3 and is incremented, and you print the value of x while x is less than 10\n", 84 | "x = 3\n", 85 | "while x < 10:\n", 86 | " print(x)\n", 87 | " x+=1" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 8, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "Dexter\n", 100 | "Frank\n", 101 | "Tigger\n", 102 | "Panda\n", 103 | "Penguin\n", 104 | "Basil\n" 105 | ] 106 | } 107 | ], 108 | "source": [ 109 | "# for loops\n", 110 | "cats = ['Dexter','Frank','Tigger','Panda','Penguin','Basil']\n", 111 | "for cat in cats:\n", 112 | " print(cat)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 19, 118 | "metadata": {}, 119 | "outputs": [ 120 | { 121 | "name": "stdout", 122 | "output_type": "stream", 123 | "text": [ 124 | "0\n", 125 | "1\n", 126 | "2\n", 127 | "3\n", 128 | "4\n", 129 | "5\n", 130 | "6\n", 131 | "7\n", 132 | "8\n", 133 | "9\n", 134 | "10\n", 135 | "11\n", 136 | "12\n", 137 | "13\n", 138 | "14\n" 139 | ] 140 | } 141 | ], 142 | "source": [ 143 | "#https://docs.python.org/3/library/functions.html#func-range\n", 144 | "#range(start, stop[,step])\n", 145 | "#the start value is inclusive BUT the stop value is not\n", 146 | "\n", 147 | "#for r in range(0,10,2):\n", 148 | "for r in range(1,20):\n", 149 | " print(r)" 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": 18, 155 | "metadata": {}, 156 | "outputs": [ 157 | { 158 | "name": "stdout", 159 | "output_type": "stream", 160 | "text": [ 161 | "b is greater\n", 162 | "a is greater\n" 163 | ] 164 | } 165 | ], 166 | "source": [ 167 | "# functions\n", 168 | "# functions let us encapsulate chunks of code that we might want to\n", 169 | "#use again\n", 170 | "\n", 171 | "def comparing(a,b):\n", 172 | " if a==b:\n", 173 | " print(\"they are equal\")\n", 174 | " elif a>b:\n", 175 | " print(\"a is greater\")\n", 176 | " #elif b>a:\n", 177 | " else:\n", 178 | " print(\"b is greater\")\n", 179 | "\n", 180 | "comparing(7,10)\n", 181 | "comparing(12,10)" 182 | ] 183 | }, 184 | { 185 | "cell_type": "code", 186 | "execution_count": null, 187 | "metadata": {}, 188 | "outputs": [], 189 | "source": [] 190 | } 191 | ], 192 | "metadata": { 193 | "kernelspec": { 194 | "display_name": "Python 3", 195 | "language": "python", 196 | "name": "python3" 197 | }, 198 | "language_info": { 199 | "codemirror_mode": { 200 | "name": "ipython", 201 | "version": 3 202 | }, 203 | "file_extension": ".py", 204 | "mimetype": "text/x-python", 205 | "name": "python", 206 | "nbconvert_exporter": "python", 207 | "pygments_lexer": "ipython3", 208 | "version": "3.8.3" 209 | } 210 | }, 211 | "nbformat": 4, 212 | "nbformat_minor": 4 213 | } 214 | -------------------------------------------------------------------------------- /course_material/week_02/Week 2 Group Coding Exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_02/Week 2 Group Coding Exercise.pdf -------------------------------------------------------------------------------- /course_material/week_02/warm-up.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 10, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "Enter a number:3\n" 13 | ] 14 | } 15 | ], 16 | "source": [ 17 | "#whats wrong with this code\n", 18 | "#what is it doing\n", 19 | "num = int(input(\"Enter a number:\"))\n" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 11, 25 | "metadata": {}, 26 | "outputs": [ 27 | { 28 | "name": "stdout", 29 | "output_type": "stream", 30 | "text": [ 31 | "divisible by 3\n" 32 | ] 33 | } 34 | ], 35 | "source": [ 36 | "if num %2 ==0:\n", 37 | " print(\"Even\")\n", 38 | "elif num %3 ==0: \n", 39 | " print(\"divisible by 3\")\n", 40 | "else:\n", 41 | " print(\"Odd\")" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": null, 47 | "metadata": {}, 48 | "outputs": [], 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": null, 54 | "metadata": {}, 55 | "outputs": [], 56 | "source": [] 57 | } 58 | ], 59 | "metadata": { 60 | "kernelspec": { 61 | "display_name": "Python 3", 62 | "language": "python", 63 | "name": "python3" 64 | }, 65 | "language_info": { 66 | "codemirror_mode": { 67 | "name": "ipython", 68 | "version": 3 69 | }, 70 | "file_extension": ".py", 71 | "mimetype": "text/x-python", 72 | "name": "python", 73 | "nbconvert_exporter": "python", 74 | "pygments_lexer": "ipython3", 75 | "version": "3.8.3" 76 | } 77 | }, 78 | "nbformat": 4, 79 | "nbformat_minor": 4 80 | } 81 | -------------------------------------------------------------------------------- /course_material/week_02/week_02_homework_hints.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "#### Week 02 Homework Hints\n", 8 | "\n", 9 | "The homework was more challenging than anticipated. So here are some helpful hints. \n", 10 | "\n", 11 | "1. Don't worry about how your code looks. We only care about if it works. \n", 12 | "2. If you have struggled with it don't be afraid to google for help. \n", 13 | " * Start with basic questions and if necessary google the answers. \n", 14 | " * If you do this please work through a couple of solutions so you understand them. \n", 15 | " * We want you to learn not just hand in working code. \n", 16 | "3. Some questions are a little ambiguous. Interpret them the easiest way first. Then you can modify your code to interpret them in a harder way if you choose. \n" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 30, 22 | "metadata": {}, 23 | "outputs": [ 24 | { 25 | "name": "stdout", 26 | "output_type": "stream", 27 | "text": [ 28 | "0 cat\n", 29 | "1 dog\n", 30 | "2 bat\n", 31 | "3 rate\n" 32 | ] 33 | } 34 | ], 35 | "source": [ 36 | "# enumerate may be a helpful function for looping lists\n", 37 | "# enumerate gives you the index as well as the value\n", 38 | "\n", 39 | "some_list = ['cat','dog','bat','rate']\n", 40 | "\n", 41 | "for index, item in enumerate(some_list):\n", 42 | " print(index, item)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 31, 48 | "metadata": {}, 49 | "outputs": [ 50 | { 51 | "name": "stdout", 52 | "output_type": "stream", 53 | "text": [ 54 | "cat marvin\n", 55 | "dog zeus\n", 56 | "rat polly\n" 57 | ] 58 | } 59 | ], 60 | "source": [ 61 | "# dict.items() is useful for getting the key/value together\n", 62 | "\n", 63 | "my_dict = {'cat':'marvin','dog':'zeus','rat':'polly'}\n", 64 | "\n", 65 | "for key,value in my_dict.items():\n", 66 | " print(key, value)" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "execution_count": 32, 72 | "metadata": {}, 73 | "outputs": [ 74 | { 75 | "name": "stdout", 76 | "output_type": "stream", 77 | "text": [ 78 | "[1, 2, 4, 5, 6, 7, 9]\n" 79 | ] 80 | } 81 | ], 82 | "source": [ 83 | "# Don't worry about modifying lists or strings or dicts in place. \n", 84 | "# Feel free to return your own copy! \n", 85 | "\n", 86 | "my_list = [1,2,3,4,5,6,7,3,3,9,3]\n", 87 | "no_threes = []\n", 88 | "\n", 89 | "for i in my_list:\n", 90 | " if i !=3:\n", 91 | " no_threes.append(i)\n", 92 | "\n", 93 | "print(no_threes)" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": 33, 99 | "metadata": {}, 100 | "outputs": [ 101 | { 102 | "name": "stdout", 103 | "output_type": "stream", 104 | "text": [ 105 | "['A', 's', 't', 'r', 'i', 'n', 'g', 't', 'h', 'a', 't', 'I', 'n', 'e', 'e', 'd', 't', 'o', 'm', 'a', 'n', 'i', 'p', 'u', 'l', 'a', 't', 'e', '.']\n", 106 | "AstringthatIneedtomanipulate.\n", 107 | "\n", 108 | "Help on built-in function join:\n", 109 | "\n", 110 | "join(iterable, /) method of builtins.str instance\n", 111 | " Concatenate any number of strings.\n", 112 | " \n", 113 | " The string whose method is called is inserted in between each given string.\n", 114 | " The result is returned as a new string.\n", 115 | " \n", 116 | " Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'\n", 117 | "\n" 118 | ] 119 | } 120 | ], 121 | "source": [ 122 | "# use the \"\".join(somelist) method to turn a list of characters into a string. \n", 123 | "\n", 124 | "some_string = 'Astrin2gth2atI2needtom2a2nipu2late.'\n", 125 | "\n", 126 | "char_list = []\n", 127 | "\n", 128 | "for char in some_string:\n", 129 | " if char != '2':\n", 130 | " char_list.append(char)\n", 131 | "print(char_list)\n", 132 | "\n", 133 | "print(\"\".join(char_list))\n", 134 | "\n", 135 | "# \"\" is an object. It has the .join() method available. \n", 136 | "\n", 137 | "print()\n", 138 | "help(\"\".join)" 139 | ] 140 | }, 141 | { 142 | "cell_type": "markdown", 143 | "metadata": {}, 144 | "source": [ 145 | "### Classes\n", 146 | "**instance variables** apply only to that object. \n", 147 | "\n", 148 | "**class variables** apply to every instance of a class. \n", 149 | "\n", 150 | "\n", 151 | "\n", 152 | "\n", 153 | "**regular methods** (instance methods) must use instance variables and MAY use class variables too.\n", 154 | "\n", 155 | "**class methods** use only class variables.\n", 156 | "\n", 157 | "**static methods** do not use either class variables or instance variables. \n", 158 | "\n", 159 | "Don't forget arguments such as `cls` and `self` in your classes! \n" 160 | ] 161 | }, 162 | { 163 | "cell_type": "code", 164 | "execution_count": 36, 165 | "metadata": {}, 166 | "outputs": [ 167 | { 168 | "name": "stdout", 169 | "output_type": "stream", 170 | "text": [ 171 | "935.02\n", 172 | "1135.02\n", 173 | "3\n", 174 | "Learn Python the Hard Way, by: John Smith, cost the library $19.99\n", 175 | "['Learn Python the Hard Way', 'SQL in 20 Minutes', 'Apple a Day']\n", 176 | "['Apple a Day', 'Learn Python the Hard Way', 'SQL in 20 Minutes']\n", 177 | "3\n" 178 | ] 179 | } 180 | ], 181 | "source": [ 182 | "import webbrowser\n", 183 | "\n", 184 | "class Book():\n", 185 | " \n", 186 | " # class variables\n", 187 | " collection_count = 0 # nunmber of books in our collection\n", 188 | " library_funds = 1000 # money we have for buying books\n", 189 | " collection = [] # list of books in our collection\n", 190 | " \n", 191 | " def __init__(self,title, author, ISBN, cost): # create a Book object\n", 192 | " \n", 193 | " # instance variables\n", 194 | " self.title = title \n", 195 | " self.author = author\n", 196 | " self.ISBN = ISBN\n", 197 | " self.cost = cost\n", 198 | " \n", 199 | " # change our class variables\n", 200 | " Book.library_funds -= cost # reduce our library funds by the cost of the book\n", 201 | " Book.collection_count +=1 # add to our collection count\n", 202 | " Book.collection.append(title) # add book title to our collection\n", 203 | " \n", 204 | " # @Classmethod decorator is required otherwise it will expect a 'self' argument. \n", 205 | " @classmethod # classmethod. Only uses class variables. Applies to all instances of Book. \n", 206 | " def funds(cls,funding):\n", 207 | " cls.library_funds += funding\n", 208 | " \n", 209 | " def info(self): # regular method (instance method)\n", 210 | " \n", 211 | " return f'{self.title}, by: {self.author}, cost the library ${self.cost}'\n", 212 | " \n", 213 | " # @staticmethod decorator is required otherwise it will expect a 'self' argument. \n", 214 | " @staticmethod # static mehtods do not rely on instance variables or class variables. But have related functionality. \n", 215 | " def nearest_library():\n", 216 | " \"\"\"Search the web for the nearest library.\"\"\"\n", 217 | " webbrowser.open('https://www.google.com/search?channel=fs&client=ubuntu&q=nearest+library', new=0)\n", 218 | " \n", 219 | " # @Classmethod decorator is required otherwise it will expect a 'self' argument. \n", 220 | " @classmethod # classmethod. Only uses class variables. Applies to all instances of Book. \n", 221 | " def sort_books(cls):\n", 222 | " \n", 223 | " cls.collection.sort() # sort the collection (sort is an inplace operation)\n", 224 | " return cls.collection\n", 225 | " \n", 226 | "\n", 227 | "python = Book('Learn Python the Hard Way', 'John Smith', '694868464', 19.99) # create book\n", 228 | "\n", 229 | "sql = Book('SQL in 20 Minutes', 'Jane Doe', '98468468468', 32.99) # create book\n", 230 | "\n", 231 | "apple = Book('Apple a Day','Bill Brown', '123456789', 12.00)\n", 232 | "\n", 233 | "print(Book.library_funds) # funds decrease\n", 234 | "Book.funds(200) # add some money to our library\n", 235 | "\n", 236 | "print(Book.library_funds)\n", 237 | "\n", 238 | "print(Book.collection_count) # we have 2 books in our library\n", 239 | "\n", 240 | "print(python.info())\n", 241 | "\n", 242 | "# sql.nearest_library() # Search Google to find nearest library. \n", 243 | "print(Book.collection)\n", 244 | "Book.sort_books()\n", 245 | "\n", 246 | "print(Book.collection)\n", 247 | "print(Book.collection_count) # Books are now sorted" 248 | ] 249 | }, 250 | { 251 | "cell_type": "code", 252 | "execution_count": 38, 253 | "metadata": {}, 254 | "outputs": [], 255 | "source": [ 256 | "Book.nearest_library() # Search Google to find nearest library. " 257 | ] 258 | }, 259 | { 260 | "cell_type": "code", 261 | "execution_count": null, 262 | "metadata": {}, 263 | "outputs": [], 264 | "source": [] 265 | }, 266 | { 267 | "cell_type": "code", 268 | "execution_count": null, 269 | "metadata": {}, 270 | "outputs": [], 271 | "source": [] 272 | } 273 | ], 274 | "metadata": { 275 | "kernelspec": { 276 | "display_name": "Python 3", 277 | "language": "python", 278 | "name": "python3" 279 | }, 280 | "language_info": { 281 | "codemirror_mode": { 282 | "name": "ipython", 283 | "version": 3 284 | }, 285 | "file_extension": ".py", 286 | "mimetype": "text/x-python", 287 | "name": "python", 288 | "nbconvert_exporter": "python", 289 | "pygments_lexer": "ipython3", 290 | "version": "3.8.3" 291 | } 292 | }, 293 | "nbformat": 4, 294 | "nbformat_minor": 4 295 | } 296 | -------------------------------------------------------------------------------- /course_material/week_02/week_02_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_02/week_02_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_03/Classes.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "class Music:\n", 10 | " @staticmethod\n", 11 | " def play():\n", 12 | " print(\"*playing music*\")\n", 13 | " \n", 14 | " #self implies that the method is related to an instance of the class\n", 15 | " def stop(self):\n", 16 | " print(\"stop playing\")" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 2, 22 | "metadata": {}, 23 | "outputs": [ 24 | { 25 | "name": "stdout", 26 | "output_type": "stream", 27 | "text": [ 28 | "*playing music*\n" 29 | ] 30 | } 31 | ], 32 | "source": [ 33 | "#dont need to create an instance to call\n", 34 | "Music.play()" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": 4, 40 | "metadata": {}, 41 | "outputs": [ 42 | { 43 | "name": "stdout", 44 | "output_type": "stream", 45 | "text": [ 46 | "stop playing\n" 47 | ] 48 | } 49 | ], 50 | "source": [ 51 | "#need to create an instance to call\n", 52 | "song = Music()\n", 53 | "song.stop()" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 6, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "class AllTheClassMethods:\n", 63 | " def method(self):\n", 64 | " return 'instance method called', self\n", 65 | " \n", 66 | " @classmethod\n", 67 | " def classmethod(cls):\n", 68 | " #cls implies that the method belongs to a class\n", 69 | " return 'class method called', cls\n", 70 | " \n", 71 | " @staticmethod\n", 72 | " def staticmethod():\n", 73 | " return 'static method called'" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 7, 79 | "metadata": {}, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/plain": [ 84 | "('class method called', __main__.AllTheClassMethods)" 85 | ] 86 | }, 87 | "execution_count": 7, 88 | "metadata": {}, 89 | "output_type": "execute_result" 90 | } 91 | ], 92 | "source": [ 93 | "AllTheClassMethods.classmethod()" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": 10, 99 | "metadata": {}, 100 | "outputs": [ 101 | { 102 | "data": { 103 | "text/plain": [ 104 | "'static method called'" 105 | ] 106 | }, 107 | "execution_count": 10, 108 | "metadata": {}, 109 | "output_type": "execute_result" 110 | } 111 | ], 112 | "source": [ 113 | "AllTheClassMethods.staticmethod()" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 11, 119 | "metadata": {}, 120 | "outputs": [ 121 | { 122 | "ename": "TypeError", 123 | "evalue": "method() missing 1 required positional argument: 'self'", 124 | "output_type": "error", 125 | "traceback": [ 126 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 127 | "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", 128 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mAllTheClassMethods\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmethod\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", 129 | "\u001b[1;31mTypeError\u001b[0m: method() missing 1 required positional argument: 'self'" 130 | ] 131 | } 132 | ], 133 | "source": [ 134 | "AllTheClassMethods.method()" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": 12, 140 | "metadata": {}, 141 | "outputs": [ 142 | { 143 | "data": { 144 | "text/plain": [ 145 | "('instance method called', <__main__.AllTheClassMethods at 0x1cbdef4ba30>)" 146 | ] 147 | }, 148 | "execution_count": 12, 149 | "metadata": {}, 150 | "output_type": "execute_result" 151 | } 152 | ], 153 | "source": [ 154 | "obj = AllTheClassMethods()\n", 155 | "obj.method()" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": null, 161 | "metadata": {}, 162 | "outputs": [], 163 | "source": [] 164 | } 165 | ], 166 | "metadata": { 167 | "kernelspec": { 168 | "display_name": "Python 3", 169 | "language": "python", 170 | "name": "python3" 171 | }, 172 | "language_info": { 173 | "codemirror_mode": { 174 | "name": "ipython", 175 | "version": 3 176 | }, 177 | "file_extension": ".py", 178 | "mimetype": "text/x-python", 179 | "name": "python", 180 | "nbconvert_exporter": "python", 181 | "pygments_lexer": "ipython3", 182 | "version": "3.8.3" 183 | } 184 | }, 185 | "nbformat": 4, 186 | "nbformat_minor": 4 187 | } 188 | -------------------------------------------------------------------------------- /course_material/week_03/Week 3 Group Exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_03/Week 3 Group Exercise.pdf -------------------------------------------------------------------------------- /course_material/week_03/numpy_basics.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 10, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/plain": [ 11 | "array([[1., 2., 3.],\n", 12 | " [4., 5., 6.]], dtype=float32)" 13 | ] 14 | }, 15 | "execution_count": 10, 16 | "metadata": {}, 17 | "output_type": "execute_result" 18 | } 19 | ], 20 | "source": [ 21 | "import numpy as np\n", 22 | "a = np.array([[1,2,3],[4,5,6]],dtype=np.float32)\n", 23 | "a" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 11, 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "name": "stdout", 33 | "output_type": "stream", 34 | "text": [ 35 | "2\n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "print(a.ndim)" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 12, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "name": "stdout", 50 | "output_type": "stream", 51 | "text": [ 52 | "(2, 3)\n" 53 | ] 54 | } 55 | ], 56 | "source": [ 57 | "print(a.shape)" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 13, 63 | "metadata": {}, 64 | "outputs": [ 65 | { 66 | "data": { 67 | "text/plain": [ 68 | "dtype('float32')" 69 | ] 70 | }, 71 | "execution_count": 13, 72 | "metadata": {}, 73 | "output_type": "execute_result" 74 | } 75 | ], 76 | "source": [ 77 | "a.dtype" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": 14, 83 | "metadata": {}, 84 | "outputs": [], 85 | "source": [ 86 | "# Array Exercise\n", 87 | "#1\n", 88 | "b = np.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]])" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 15, 94 | "metadata": {}, 95 | "outputs": [ 96 | { 97 | "data": { 98 | "text/plain": [ 99 | "3" 100 | ] 101 | }, 102 | "execution_count": 15, 103 | "metadata": {}, 104 | "output_type": "execute_result" 105 | } 106 | ], 107 | "source": [ 108 | "b.ndim" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": 16, 114 | "metadata": {}, 115 | "outputs": [], 116 | "source": [ 117 | "#2\n", 118 | "c = np.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]],ndmin=6)" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": 17, 124 | "metadata": {}, 125 | "outputs": [ 126 | { 127 | "data": { 128 | "text/plain": [ 129 | "array([[[[[[1, 2, 3],\n", 130 | " [4, 5, 6]],\n", 131 | "\n", 132 | " [[1, 2, 3],\n", 133 | " [4, 5, 6]]]]]])" 134 | ] 135 | }, 136 | "execution_count": 17, 137 | "metadata": {}, 138 | "output_type": "execute_result" 139 | } 140 | ], 141 | "source": [ 142 | "c" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": 19, 148 | "metadata": {}, 149 | "outputs": [ 150 | { 151 | "data": { 152 | "text/plain": [ 153 | "6" 154 | ] 155 | }, 156 | "execution_count": 19, 157 | "metadata": {}, 158 | "output_type": "execute_result" 159 | } 160 | ], 161 | "source": [ 162 | "c.ndim" 163 | ] 164 | }, 165 | { 166 | "cell_type": "code", 167 | "execution_count": 22, 168 | "metadata": {}, 169 | "outputs": [], 170 | "source": [ 171 | "d = np.ones((3,2))" 172 | ] 173 | }, 174 | { 175 | "cell_type": "code", 176 | "execution_count": 23, 177 | "metadata": {}, 178 | "outputs": [ 179 | { 180 | "data": { 181 | "text/plain": [ 182 | "2" 183 | ] 184 | }, 185 | "execution_count": 23, 186 | "metadata": {}, 187 | "output_type": "execute_result" 188 | } 189 | ], 190 | "source": [ 191 | "d.ndim" 192 | ] 193 | }, 194 | { 195 | "cell_type": "code", 196 | "execution_count": 24, 197 | "metadata": {}, 198 | "outputs": [ 199 | { 200 | "data": { 201 | "text/plain": [ 202 | "(3, 2)" 203 | ] 204 | }, 205 | "execution_count": 24, 206 | "metadata": {}, 207 | "output_type": "execute_result" 208 | } 209 | ], 210 | "source": [ 211 | "d.shape" 212 | ] 213 | }, 214 | { 215 | "cell_type": "code", 216 | "execution_count": null, 217 | "metadata": {}, 218 | "outputs": [], 219 | "source": [] 220 | } 221 | ], 222 | "metadata": { 223 | "kernelspec": { 224 | "display_name": "Python 3", 225 | "language": "python", 226 | "name": "python3" 227 | }, 228 | "language_info": { 229 | "codemirror_mode": { 230 | "name": "ipython", 231 | "version": 3 232 | }, 233 | "file_extension": ".py", 234 | "mimetype": "text/x-python", 235 | "name": "python", 236 | "nbconvert_exporter": "python", 237 | "pygments_lexer": "ipython3", 238 | "version": "3.8.3" 239 | } 240 | }, 241 | "nbformat": 4, 242 | "nbformat_minor": 4 243 | } 244 | -------------------------------------------------------------------------------- /course_material/week_03/week_03_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_03/week_03_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_04/Week 4 Group Activity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_04/Week 4 Group Activity.pdf -------------------------------------------------------------------------------- /course_material/week_04/homework/README.md: -------------------------------------------------------------------------------- 1 | # Week 4 | Assignment - Pandas, Pandas, Pandas 2 | 3 | ## Background 4 | 5 | You need to take the things you have learned about pandas and great some summary reports. 6 | 7 | ## Assignment 8 | 9 | You need to create a report that summarizes various facts in dataframes. 10 | 11 | Your final report should include each of the following: 12 | 13 | ### Player Count 14 | 15 | * Total Number of Players 16 | 17 | ### Purchasing Analysis (Total) 18 | 19 | * Number of Unique Items 20 | * Average Purchase Price 21 | * Total Number of Purchases 22 | * Total Revenue 23 | 24 | ### Gender Demographics 25 | 26 | * Percentage and Count of Male Players 27 | * Percentage and Count of Female Players 28 | * Percentage and Count of Other / Non-Disclosed 29 | 30 | ### Purchasing Analysis (Gender) 31 | 32 | * The below each broken by gender 33 | * Purchase Count 34 | * Average Purchase Price 35 | * Total Purchase Value 36 | * Average Purchase Total per Person by Gender 37 | 38 | ### Age Demographics 39 | 40 | * The below each broken into bins of 4 years (i.e. <10, 10-14, 15-19, etc.) 41 | * Purchase Count 42 | * Average Purchase Price 43 | * Total Purchase Value 44 | * Average Purchase Total per Person by Age Group 45 | 46 | ### Top Spenders 47 | 48 | * Identify the the top 5 spenders in the game by total purchase value, then list (in a table): 49 | * SN 50 | * Purchase Count 51 | * Average Purchase Price 52 | * Total Purchase Value 53 | 54 | ### Most Popular Items 55 | 56 | * Identify the 5 most popular items by purchase count, then list (in a table): 57 | * Item ID 58 | * Item Name 59 | * Purchase Count 60 | * Item Price 61 | * Total Purchase Value 62 | 63 | ### Most Profitable Items 64 | 65 | * Identify the 5 most profitable items by total purchase value, then list (in a table): 66 | * Item ID 67 | * Item Name 68 | * Purchase Count 69 | * Item Price 70 | * Total Purchase Value 71 | 72 | As final considerations: 73 | 74 | * You must use the Pandas Library and the Jupyter Notebook. 75 | * You must submit a link to your Jupyter Notebook with the viewable Data Frames. 76 | * You must include a written description of three observable trends based on the data. 77 | * See [Example Output](Output_examples.ipynb) for a reference on expected format. 78 | * Your output may be slightly different! -------------------------------------------------------------------------------- /course_material/week_04/week_04_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_04/week_04_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_05/apis.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from api_keys import api_key\n", 10 | "\n", 11 | "#you import a variable named api_key\n", 12 | "#the file is called api_keys\n", 13 | "#the interpreter assumes its a .py file, so you dont need to specify\n", 14 | "#print(api_key)" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 3, 20 | "metadata": { 21 | "scrolled": true 22 | }, 23 | "outputs": [ 24 | { 25 | "name": "stdout", 26 | "output_type": "stream", 27 | "text": [ 28 | "\n", 29 | "\n", 30 | "\n", 31 | " Example Domain\n", 32 | "\n", 33 | " \n", 34 | " \n", 35 | " \n", 36 | " \n", 63 | "\n", 64 | "\n", 65 | "\n", 66 | "
\n", 67 | "

Example Domain

\n", 68 | "

This domain is for use in illustrative examples in documents. You may use this\n", 69 | " domain in literature without prior coordination or asking for permission.

\n", 70 | "

More information...

\n", 71 | "
\n", 72 | "\n", 73 | "\n", 74 | "\n" 75 | ] 76 | } 77 | ], 78 | "source": [ 79 | "import requests\n", 80 | "import pandas as pd\n", 81 | "\n", 82 | "#variable for the url\n", 83 | "url = 'http://www.example.com'\n", 84 | "\n", 85 | "#requests library/module is used to send all types\n", 86 | "#of http requests\n", 87 | "req = requests.get(url)\n", 88 | "print(req.text)" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 5, 94 | "metadata": {}, 95 | "outputs": [ 96 | { 97 | "name": "stdout", 98 | "output_type": "stream", 99 | "text": [ 100 | "http://api.openweathermap.org/data/2.5/weather?units=Imperial&APPID=95282a298c2729d61f377316f5967d33&q=st. louis\n", 101 | "{'coord': {'lon': -90.1979, 'lat': 38.6273}, 'weather': [{'id': 804, 'main': 'Clouds', 'description': 'overcast clouds', 'icon': '04n'}], 'base': 'stations', 'main': {'temp': 77.79, 'feels_like': 78.75, 'temp_min': 75.88, 'temp_max': 79.38, 'pressure': 1011, 'humidity': 74}, 'visibility': 10000, 'wind': {'speed': 10.11, 'deg': 187, 'gust': 22.3}, 'clouds': {'all': 96}, 'dt': 1634169725, 'sys': {'type': 2, 'id': 2009674, 'country': 'US', 'sunrise': 1634126883, 'sunset': 1634167530}, 'timezone': -18000, 'id': 4407066, 'name': 'St Louis', 'cod': 200}\n" 102 | ] 103 | } 104 | ], 105 | "source": [ 106 | "base_url = \"http://api.openweathermap.org/data/2.5/weather?units=Imperial&APPID=\" + api_key\n", 107 | "city = 'st. louis'\n", 108 | "\n", 109 | "#q represents the city\n", 110 | "req = requests.get(base_url + f'&q={city}')\n", 111 | "\n", 112 | "#you can play around with the full url in your browser if youre stuck\n", 113 | "print(base_url + f'&q={city}')\n", 114 | "#create a json output of the data\n", 115 | "json_data = req.json()\n", 116 | "print(json_data)" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 9, 122 | "metadata": {}, 123 | "outputs": [ 124 | { 125 | "name": "stdout", 126 | "output_type": "stream", 127 | "text": [ 128 | "{'temp': 77.79, 'feels_like': 78.75, 'temp_min': 75.88, 'temp_max': 79.38, 'pressure': 1011, 'humidity': 74}\n" 129 | ] 130 | }, 131 | { 132 | "data": { 133 | "text/plain": [ 134 | "'overcast clouds'" 135 | ] 136 | }, 137 | "execution_count": 9, 138 | "metadata": {}, 139 | "output_type": "execute_result" 140 | } 141 | ], 142 | "source": [ 143 | "main = json_data['main']\n", 144 | "print(main)\n", 145 | "\n", 146 | "weather_desc = json_data['weather'][0]['description']\n", 147 | "weather_desc" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 13, 153 | "metadata": {}, 154 | "outputs": [ 155 | { 156 | "name": "stdout", 157 | "output_type": "stream", 158 | "text": [ 159 | "processing denver\n", 160 | "processing st louis\n", 161 | "processing phoenix\n" 162 | ] 163 | } 164 | ], 165 | "source": [ 166 | "cities_list = ['denver','st louis','phoenix']\n", 167 | "\n", 168 | "city_weather = {'city':[],\n", 169 | " 'humidity':[],\n", 170 | " 'pressure':[]}\n", 171 | "\n", 172 | "#loop over cities and add data to dictionary\n", 173 | "for city in cities_list:\n", 174 | " base_url = \"http://api.openweathermap.org/data/2.5/weather?units=Imperial&APPID=\" + api_key\n", 175 | "\n", 176 | " try:\n", 177 | " #q represents the city\n", 178 | " req = requests.get(base_url + f'&q={city}')\n", 179 | " \n", 180 | " data = req.json()\n", 181 | " \n", 182 | " #add values to our city_weather dictionary\n", 183 | " city_weather['city'].append(data['name'])\n", 184 | " city_weather['humidity'].append(data['main']['humidity'])\n", 185 | " city_weather['pressure'].append(data['main']['pressure'])\n", 186 | " \n", 187 | " print(\"processing \" + city)\n", 188 | " except:\n", 189 | " print(city+ \" not found\")\n", 190 | " pass" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 14, 196 | "metadata": {}, 197 | "outputs": [ 198 | { 199 | "data": { 200 | "text/plain": [ 201 | "{'city': ['Denver', 'St Louis', 'Phoenix'],\n", 202 | " 'humidity': [29, 74, 22],\n", 203 | " 'pressure': [1006, 1011, 1008]}" 204 | ] 205 | }, 206 | "execution_count": 14, 207 | "metadata": {}, 208 | "output_type": "execute_result" 209 | } 210 | ], 211 | "source": [ 212 | "city_weather" 213 | ] 214 | }, 215 | { 216 | "cell_type": "code", 217 | "execution_count": 16, 218 | "metadata": {}, 219 | "outputs": [ 220 | { 221 | "data": { 222 | "text/html": [ 223 | "
\n", 224 | "\n", 237 | "\n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | " \n", 264 | " \n", 265 | " \n", 266 | "
cityhumiditypressure
0Denver291006
1St Louis741011
2Phoenix221008
\n", 267 | "
" 268 | ], 269 | "text/plain": [ 270 | " city humidity pressure\n", 271 | "0 Denver 29 1006\n", 272 | "1 St Louis 74 1011\n", 273 | "2 Phoenix 22 1008" 274 | ] 275 | }, 276 | "execution_count": 16, 277 | "metadata": {}, 278 | "output_type": "execute_result" 279 | } 280 | ], 281 | "source": [ 282 | "weather_df = pd.DataFrame.from_dict(city_weather)\n", 283 | "weather_df" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": null, 289 | "metadata": {}, 290 | "outputs": [], 291 | "source": [] 292 | } 293 | ], 294 | "metadata": { 295 | "kernelspec": { 296 | "display_name": "Python 3", 297 | "language": "python", 298 | "name": "python3" 299 | }, 300 | "language_info": { 301 | "codemirror_mode": { 302 | "name": "ipython", 303 | "version": 3 304 | }, 305 | "file_extension": ".py", 306 | "mimetype": "text/x-python", 307 | "name": "python", 308 | "nbconvert_exporter": "python", 309 | "pygments_lexer": "ipython3", 310 | "version": "3.8.3" 311 | } 312 | }, 313 | "nbformat": 4, 314 | "nbformat_minor": 4 315 | } 316 | -------------------------------------------------------------------------------- /course_material/week_05/week 5 group activity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_05/week 5 group activity.pdf -------------------------------------------------------------------------------- /course_material/week_05/week_05_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_05/week_05_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_06/Week 6 group activity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/Week 6 group activity.pdf -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3057.dat: -------------------------------------------------------------------------------- 1 | 1 Penelope Guiness 2013-05-26 14:47:57.62 2 | 2 Nick Wahlberg 2013-05-26 14:47:57.62 3 | 3 Ed Chase 2013-05-26 14:47:57.62 4 | 4 Jennifer Davis 2013-05-26 14:47:57.62 5 | 5 Johnny Lollobrigida 2013-05-26 14:47:57.62 6 | 6 Bette Nicholson 2013-05-26 14:47:57.62 7 | 7 Grace Mostel 2013-05-26 14:47:57.62 8 | 8 Matthew Johansson 2013-05-26 14:47:57.62 9 | 9 Joe Swank 2013-05-26 14:47:57.62 10 | 10 Christian Gable 2013-05-26 14:47:57.62 11 | 11 Zero Cage 2013-05-26 14:47:57.62 12 | 12 Karl Berry 2013-05-26 14:47:57.62 13 | 13 Uma Wood 2013-05-26 14:47:57.62 14 | 14 Vivien Bergen 2013-05-26 14:47:57.62 15 | 15 Cuba Olivier 2013-05-26 14:47:57.62 16 | 16 Fred Costner 2013-05-26 14:47:57.62 17 | 17 Helen Voight 2013-05-26 14:47:57.62 18 | 18 Dan Torn 2013-05-26 14:47:57.62 19 | 19 Bob Fawcett 2013-05-26 14:47:57.62 20 | 20 Lucille Tracy 2013-05-26 14:47:57.62 21 | 21 Kirsten Paltrow 2013-05-26 14:47:57.62 22 | 22 Elvis Marx 2013-05-26 14:47:57.62 23 | 23 Sandra Kilmer 2013-05-26 14:47:57.62 24 | 24 Cameron Streep 2013-05-26 14:47:57.62 25 | 25 Kevin Bloom 2013-05-26 14:47:57.62 26 | 26 Rip Crawford 2013-05-26 14:47:57.62 27 | 27 Julia Mcqueen 2013-05-26 14:47:57.62 28 | 28 Woody Hoffman 2013-05-26 14:47:57.62 29 | 29 Alec Wayne 2013-05-26 14:47:57.62 30 | 30 Sandra Peck 2013-05-26 14:47:57.62 31 | 31 Sissy Sobieski 2013-05-26 14:47:57.62 32 | 32 Tim Hackman 2013-05-26 14:47:57.62 33 | 33 Milla Peck 2013-05-26 14:47:57.62 34 | 34 Audrey Olivier 2013-05-26 14:47:57.62 35 | 35 Judy Dean 2013-05-26 14:47:57.62 36 | 36 Burt Dukakis 2013-05-26 14:47:57.62 37 | 37 Val Bolger 2013-05-26 14:47:57.62 38 | 38 Tom Mckellen 2013-05-26 14:47:57.62 39 | 39 Goldie Brody 2013-05-26 14:47:57.62 40 | 40 Johnny Cage 2013-05-26 14:47:57.62 41 | 41 Jodie Degeneres 2013-05-26 14:47:57.62 42 | 42 Tom Miranda 2013-05-26 14:47:57.62 43 | 43 Kirk Jovovich 2013-05-26 14:47:57.62 44 | 44 Nick Stallone 2013-05-26 14:47:57.62 45 | 45 Reese Kilmer 2013-05-26 14:47:57.62 46 | 46 Parker Goldberg 2013-05-26 14:47:57.62 47 | 47 Julia Barrymore 2013-05-26 14:47:57.62 48 | 48 Frances Day-Lewis 2013-05-26 14:47:57.62 49 | 49 Anne Cronyn 2013-05-26 14:47:57.62 50 | 50 Natalie Hopkins 2013-05-26 14:47:57.62 51 | 51 Gary Phoenix 2013-05-26 14:47:57.62 52 | 52 Carmen Hunt 2013-05-26 14:47:57.62 53 | 53 Mena Temple 2013-05-26 14:47:57.62 54 | 54 Penelope Pinkett 2013-05-26 14:47:57.62 55 | 55 Fay Kilmer 2013-05-26 14:47:57.62 56 | 56 Dan Harris 2013-05-26 14:47:57.62 57 | 57 Jude Cruise 2013-05-26 14:47:57.62 58 | 58 Christian Akroyd 2013-05-26 14:47:57.62 59 | 59 Dustin Tautou 2013-05-26 14:47:57.62 60 | 60 Henry Berry 2013-05-26 14:47:57.62 61 | 61 Christian Neeson 2013-05-26 14:47:57.62 62 | 62 Jayne Neeson 2013-05-26 14:47:57.62 63 | 63 Cameron Wray 2013-05-26 14:47:57.62 64 | 64 Ray Johansson 2013-05-26 14:47:57.62 65 | 65 Angela Hudson 2013-05-26 14:47:57.62 66 | 66 Mary Tandy 2013-05-26 14:47:57.62 67 | 67 Jessica Bailey 2013-05-26 14:47:57.62 68 | 68 Rip Winslet 2013-05-26 14:47:57.62 69 | 69 Kenneth Paltrow 2013-05-26 14:47:57.62 70 | 70 Michelle Mcconaughey 2013-05-26 14:47:57.62 71 | 71 Adam Grant 2013-05-26 14:47:57.62 72 | 72 Sean Williams 2013-05-26 14:47:57.62 73 | 73 Gary Penn 2013-05-26 14:47:57.62 74 | 74 Milla Keitel 2013-05-26 14:47:57.62 75 | 75 Burt Posey 2013-05-26 14:47:57.62 76 | 76 Angelina Astaire 2013-05-26 14:47:57.62 77 | 77 Cary Mcconaughey 2013-05-26 14:47:57.62 78 | 78 Groucho Sinatra 2013-05-26 14:47:57.62 79 | 79 Mae Hoffman 2013-05-26 14:47:57.62 80 | 80 Ralph Cruz 2013-05-26 14:47:57.62 81 | 81 Scarlett Damon 2013-05-26 14:47:57.62 82 | 82 Woody Jolie 2013-05-26 14:47:57.62 83 | 83 Ben Willis 2013-05-26 14:47:57.62 84 | 84 James Pitt 2013-05-26 14:47:57.62 85 | 85 Minnie Zellweger 2013-05-26 14:47:57.62 86 | 143 River Dean 2013-05-26 14:47:57.62 87 | 86 Greg Chaplin 2013-05-26 14:47:57.62 88 | 87 Spencer Peck 2013-05-26 14:47:57.62 89 | 88 Kenneth Pesci 2013-05-26 14:47:57.62 90 | 89 Charlize Dench 2013-05-26 14:47:57.62 91 | 90 Sean Guiness 2013-05-26 14:47:57.62 92 | 91 Christopher Berry 2013-05-26 14:47:57.62 93 | 92 Kirsten Akroyd 2013-05-26 14:47:57.62 94 | 93 Ellen Presley 2013-05-26 14:47:57.62 95 | 94 Kenneth Torn 2013-05-26 14:47:57.62 96 | 95 Daryl Wahlberg 2013-05-26 14:47:57.62 97 | 96 Gene Willis 2013-05-26 14:47:57.62 98 | 97 Meg Hawke 2013-05-26 14:47:57.62 99 | 98 Chris Bridges 2013-05-26 14:47:57.62 100 | 99 Jim Mostel 2013-05-26 14:47:57.62 101 | 100 Spencer Depp 2013-05-26 14:47:57.62 102 | 101 Susan Davis 2013-05-26 14:47:57.62 103 | 102 Walter Torn 2013-05-26 14:47:57.62 104 | 103 Matthew Leigh 2013-05-26 14:47:57.62 105 | 104 Penelope Cronyn 2013-05-26 14:47:57.62 106 | 105 Sidney Crowe 2013-05-26 14:47:57.62 107 | 106 Groucho Dunst 2013-05-26 14:47:57.62 108 | 107 Gina Degeneres 2013-05-26 14:47:57.62 109 | 108 Warren Nolte 2013-05-26 14:47:57.62 110 | 109 Sylvester Dern 2013-05-26 14:47:57.62 111 | 110 Susan Davis 2013-05-26 14:47:57.62 112 | 111 Cameron Zellweger 2013-05-26 14:47:57.62 113 | 112 Russell Bacall 2013-05-26 14:47:57.62 114 | 113 Morgan Hopkins 2013-05-26 14:47:57.62 115 | 114 Morgan Mcdormand 2013-05-26 14:47:57.62 116 | 115 Harrison Bale 2013-05-26 14:47:57.62 117 | 116 Dan Streep 2013-05-26 14:47:57.62 118 | 117 Renee Tracy 2013-05-26 14:47:57.62 119 | 118 Cuba Allen 2013-05-26 14:47:57.62 120 | 119 Warren Jackman 2013-05-26 14:47:57.62 121 | 120 Penelope Monroe 2013-05-26 14:47:57.62 122 | 121 Liza Bergman 2013-05-26 14:47:57.62 123 | 122 Salma Nolte 2013-05-26 14:47:57.62 124 | 123 Julianne Dench 2013-05-26 14:47:57.62 125 | 124 Scarlett Bening 2013-05-26 14:47:57.62 126 | 125 Albert Nolte 2013-05-26 14:47:57.62 127 | 126 Frances Tomei 2013-05-26 14:47:57.62 128 | 127 Kevin Garland 2013-05-26 14:47:57.62 129 | 128 Cate Mcqueen 2013-05-26 14:47:57.62 130 | 129 Daryl Crawford 2013-05-26 14:47:57.62 131 | 130 Greta Keitel 2013-05-26 14:47:57.62 132 | 131 Jane Jackman 2013-05-26 14:47:57.62 133 | 132 Adam Hopper 2013-05-26 14:47:57.62 134 | 133 Richard Penn 2013-05-26 14:47:57.62 135 | 134 Gene Hopkins 2013-05-26 14:47:57.62 136 | 135 Rita Reynolds 2013-05-26 14:47:57.62 137 | 136 Ed Mansfield 2013-05-26 14:47:57.62 138 | 137 Morgan Williams 2013-05-26 14:47:57.62 139 | 138 Lucille Dee 2013-05-26 14:47:57.62 140 | 139 Ewan Gooding 2013-05-26 14:47:57.62 141 | 140 Whoopi Hurt 2013-05-26 14:47:57.62 142 | 141 Cate Harris 2013-05-26 14:47:57.62 143 | 142 Jada Ryder 2013-05-26 14:47:57.62 144 | 144 Angela Witherspoon 2013-05-26 14:47:57.62 145 | 145 Kim Allen 2013-05-26 14:47:57.62 146 | 146 Albert Johansson 2013-05-26 14:47:57.62 147 | 147 Fay Winslet 2013-05-26 14:47:57.62 148 | 148 Emily Dee 2013-05-26 14:47:57.62 149 | 149 Russell Temple 2013-05-26 14:47:57.62 150 | 150 Jayne Nolte 2013-05-26 14:47:57.62 151 | 151 Geoffrey Heston 2013-05-26 14:47:57.62 152 | 152 Ben Harris 2013-05-26 14:47:57.62 153 | 153 Minnie Kilmer 2013-05-26 14:47:57.62 154 | 154 Meryl Gibson 2013-05-26 14:47:57.62 155 | 155 Ian Tandy 2013-05-26 14:47:57.62 156 | 156 Fay Wood 2013-05-26 14:47:57.62 157 | 157 Greta Malden 2013-05-26 14:47:57.62 158 | 158 Vivien Basinger 2013-05-26 14:47:57.62 159 | 159 Laura Brody 2013-05-26 14:47:57.62 160 | 160 Chris Depp 2013-05-26 14:47:57.62 161 | 161 Harvey Hope 2013-05-26 14:47:57.62 162 | 162 Oprah Kilmer 2013-05-26 14:47:57.62 163 | 163 Christopher West 2013-05-26 14:47:57.62 164 | 164 Humphrey Willis 2013-05-26 14:47:57.62 165 | 165 Al Garland 2013-05-26 14:47:57.62 166 | 166 Nick Degeneres 2013-05-26 14:47:57.62 167 | 167 Laurence Bullock 2013-05-26 14:47:57.62 168 | 168 Will Wilson 2013-05-26 14:47:57.62 169 | 169 Kenneth Hoffman 2013-05-26 14:47:57.62 170 | 170 Mena Hopper 2013-05-26 14:47:57.62 171 | 171 Olympia Pfeiffer 2013-05-26 14:47:57.62 172 | 172 Groucho Williams 2013-05-26 14:47:57.62 173 | 173 Alan Dreyfuss 2013-05-26 14:47:57.62 174 | 174 Michael Bening 2013-05-26 14:47:57.62 175 | 175 William Hackman 2013-05-26 14:47:57.62 176 | 176 Jon Chase 2013-05-26 14:47:57.62 177 | 177 Gene Mckellen 2013-05-26 14:47:57.62 178 | 178 Lisa Monroe 2013-05-26 14:47:57.62 179 | 179 Ed Guiness 2013-05-26 14:47:57.62 180 | 180 Jeff Silverstone 2013-05-26 14:47:57.62 181 | 181 Matthew Carrey 2013-05-26 14:47:57.62 182 | 182 Debbie Akroyd 2013-05-26 14:47:57.62 183 | 183 Russell Close 2013-05-26 14:47:57.62 184 | 184 Humphrey Garland 2013-05-26 14:47:57.62 185 | 185 Michael Bolger 2013-05-26 14:47:57.62 186 | 186 Julia Zellweger 2013-05-26 14:47:57.62 187 | 187 Renee Ball 2013-05-26 14:47:57.62 188 | 188 Rock Dukakis 2013-05-26 14:47:57.62 189 | 189 Cuba Birch 2013-05-26 14:47:57.62 190 | 190 Audrey Bailey 2013-05-26 14:47:57.62 191 | 191 Gregory Gooding 2013-05-26 14:47:57.62 192 | 192 John Suvari 2013-05-26 14:47:57.62 193 | 193 Burt Temple 2013-05-26 14:47:57.62 194 | 194 Meryl Allen 2013-05-26 14:47:57.62 195 | 195 Jayne Silverstone 2013-05-26 14:47:57.62 196 | 196 Bela Walken 2013-05-26 14:47:57.62 197 | 197 Reese West 2013-05-26 14:47:57.62 198 | 198 Mary Keitel 2013-05-26 14:47:57.62 199 | 199 Julia Fawcett 2013-05-26 14:47:57.62 200 | 200 Thora Temple 2013-05-26 14:47:57.62 201 | \. 202 | 203 | 204 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3059.dat: -------------------------------------------------------------------------------- 1 | 1 Action 2006-02-15 09:46:27 2 | 2 Animation 2006-02-15 09:46:27 3 | 3 Children 2006-02-15 09:46:27 4 | 4 Classics 2006-02-15 09:46:27 5 | 5 Comedy 2006-02-15 09:46:27 6 | 6 Documentary 2006-02-15 09:46:27 7 | 7 Drama 2006-02-15 09:46:27 8 | 8 Family 2006-02-15 09:46:27 9 | 9 Foreign 2006-02-15 09:46:27 10 | 10 Games 2006-02-15 09:46:27 11 | 11 Horror 2006-02-15 09:46:27 12 | 12 Music 2006-02-15 09:46:27 13 | 13 New 2006-02-15 09:46:27 14 | 14 Sci-Fi 2006-02-15 09:46:27 15 | 15 Sports 2006-02-15 09:46:27 16 | 16 Travel 2006-02-15 09:46:27 17 | \. 18 | 19 | 20 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3069.dat: -------------------------------------------------------------------------------- 1 | 1 Afghanistan 2006-02-15 09:44:00 2 | 2 Algeria 2006-02-15 09:44:00 3 | 3 American Samoa 2006-02-15 09:44:00 4 | 4 Angola 2006-02-15 09:44:00 5 | 5 Anguilla 2006-02-15 09:44:00 6 | 6 Argentina 2006-02-15 09:44:00 7 | 7 Armenia 2006-02-15 09:44:00 8 | 8 Australia 2006-02-15 09:44:00 9 | 9 Austria 2006-02-15 09:44:00 10 | 10 Azerbaijan 2006-02-15 09:44:00 11 | 11 Bahrain 2006-02-15 09:44:00 12 | 12 Bangladesh 2006-02-15 09:44:00 13 | 13 Belarus 2006-02-15 09:44:00 14 | 14 Bolivia 2006-02-15 09:44:00 15 | 15 Brazil 2006-02-15 09:44:00 16 | 16 Brunei 2006-02-15 09:44:00 17 | 17 Bulgaria 2006-02-15 09:44:00 18 | 18 Cambodia 2006-02-15 09:44:00 19 | 19 Cameroon 2006-02-15 09:44:00 20 | 20 Canada 2006-02-15 09:44:00 21 | 21 Chad 2006-02-15 09:44:00 22 | 22 Chile 2006-02-15 09:44:00 23 | 23 China 2006-02-15 09:44:00 24 | 24 Colombia 2006-02-15 09:44:00 25 | 25 Congo, The Democratic Republic of the 2006-02-15 09:44:00 26 | 26 Czech Republic 2006-02-15 09:44:00 27 | 27 Dominican Republic 2006-02-15 09:44:00 28 | 28 Ecuador 2006-02-15 09:44:00 29 | 29 Egypt 2006-02-15 09:44:00 30 | 30 Estonia 2006-02-15 09:44:00 31 | 31 Ethiopia 2006-02-15 09:44:00 32 | 32 Faroe Islands 2006-02-15 09:44:00 33 | 33 Finland 2006-02-15 09:44:00 34 | 34 France 2006-02-15 09:44:00 35 | 35 French Guiana 2006-02-15 09:44:00 36 | 36 French Polynesia 2006-02-15 09:44:00 37 | 37 Gambia 2006-02-15 09:44:00 38 | 38 Germany 2006-02-15 09:44:00 39 | 39 Greece 2006-02-15 09:44:00 40 | 40 Greenland 2006-02-15 09:44:00 41 | 41 Holy See (Vatican City State) 2006-02-15 09:44:00 42 | 42 Hong Kong 2006-02-15 09:44:00 43 | 43 Hungary 2006-02-15 09:44:00 44 | 44 India 2006-02-15 09:44:00 45 | 45 Indonesia 2006-02-15 09:44:00 46 | 46 Iran 2006-02-15 09:44:00 47 | 47 Iraq 2006-02-15 09:44:00 48 | 48 Israel 2006-02-15 09:44:00 49 | 49 Italy 2006-02-15 09:44:00 50 | 50 Japan 2006-02-15 09:44:00 51 | 51 Kazakstan 2006-02-15 09:44:00 52 | 52 Kenya 2006-02-15 09:44:00 53 | 53 Kuwait 2006-02-15 09:44:00 54 | 54 Latvia 2006-02-15 09:44:00 55 | 55 Liechtenstein 2006-02-15 09:44:00 56 | 56 Lithuania 2006-02-15 09:44:00 57 | 57 Madagascar 2006-02-15 09:44:00 58 | 58 Malawi 2006-02-15 09:44:00 59 | 59 Malaysia 2006-02-15 09:44:00 60 | 60 Mexico 2006-02-15 09:44:00 61 | 61 Moldova 2006-02-15 09:44:00 62 | 62 Morocco 2006-02-15 09:44:00 63 | 63 Mozambique 2006-02-15 09:44:00 64 | 64 Myanmar 2006-02-15 09:44:00 65 | 65 Nauru 2006-02-15 09:44:00 66 | 66 Nepal 2006-02-15 09:44:00 67 | 67 Netherlands 2006-02-15 09:44:00 68 | 68 New Zealand 2006-02-15 09:44:00 69 | 69 Nigeria 2006-02-15 09:44:00 70 | 70 North Korea 2006-02-15 09:44:00 71 | 71 Oman 2006-02-15 09:44:00 72 | 72 Pakistan 2006-02-15 09:44:00 73 | 73 Paraguay 2006-02-15 09:44:00 74 | 74 Peru 2006-02-15 09:44:00 75 | 75 Philippines 2006-02-15 09:44:00 76 | 76 Poland 2006-02-15 09:44:00 77 | 77 Puerto Rico 2006-02-15 09:44:00 78 | 78 Romania 2006-02-15 09:44:00 79 | 79 Runion 2006-02-15 09:44:00 80 | 80 Russian Federation 2006-02-15 09:44:00 81 | 81 Saint Vincent and the Grenadines 2006-02-15 09:44:00 82 | 82 Saudi Arabia 2006-02-15 09:44:00 83 | 83 Senegal 2006-02-15 09:44:00 84 | 84 Slovakia 2006-02-15 09:44:00 85 | 85 South Africa 2006-02-15 09:44:00 86 | 86 South Korea 2006-02-15 09:44:00 87 | 87 Spain 2006-02-15 09:44:00 88 | 88 Sri Lanka 2006-02-15 09:44:00 89 | 89 Sudan 2006-02-15 09:44:00 90 | 90 Sweden 2006-02-15 09:44:00 91 | 91 Switzerland 2006-02-15 09:44:00 92 | 92 Taiwan 2006-02-15 09:44:00 93 | 93 Tanzania 2006-02-15 09:44:00 94 | 94 Thailand 2006-02-15 09:44:00 95 | 95 Tonga 2006-02-15 09:44:00 96 | 96 Tunisia 2006-02-15 09:44:00 97 | 97 Turkey 2006-02-15 09:44:00 98 | 98 Turkmenistan 2006-02-15 09:44:00 99 | 99 Tuvalu 2006-02-15 09:44:00 100 | 100 Ukraine 2006-02-15 09:44:00 101 | 101 United Arab Emirates 2006-02-15 09:44:00 102 | 102 United Kingdom 2006-02-15 09:44:00 103 | 103 United States 2006-02-15 09:44:00 104 | 104 Venezuela 2006-02-15 09:44:00 105 | 105 Vietnam 2006-02-15 09:44:00 106 | 106 Virgin Islands, U.S. 2006-02-15 09:44:00 107 | 107 Yemen 2006-02-15 09:44:00 108 | 108 Yugoslavia 2006-02-15 09:44:00 109 | 109 Zambia 2006-02-15 09:44:00 110 | \. 111 | 112 | 113 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3073.dat: -------------------------------------------------------------------------------- 1 | 1 English 2006-02-15 10:02:19 2 | 2 Italian 2006-02-15 10:02:19 3 | 3 Japanese 2006-02-15 10:02:19 4 | 4 Mandarin 2006-02-15 10:02:19 5 | 5 French 2006-02-15 10:02:19 6 | 6 German 2006-02-15 10:02:19 7 | \. 8 | 9 | 10 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3079.dat: -------------------------------------------------------------------------------- 1 | 1 Mike Hillyer 3 Mike.Hillyer@sakilastaff.com 1 t Mike 8cb2237d0679ca88db6464eac60da96345513964 2006-05-16 16:13:11.79328 \\x89504e470d0a5a0a 2 | 2 Jon Stephens 4 Jon.Stephens@sakilastaff.com 2 t Jon 8cb2237d0679ca88db6464eac60da96345513964 2006-05-16 16:13:11.79328 \N 3 | \. 4 | 5 | 6 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/3081.dat: -------------------------------------------------------------------------------- 1 | 1 1 1 2006-02-15 09:57:12 2 | 2 2 2 2006-02-15 09:57:12 3 | \. 4 | 5 | 6 | -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/dvdrental.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/dvdrental/dvdrental.tar -------------------------------------------------------------------------------- /course_material/week_06/dvdrental/toc.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/dvdrental/toc.dat -------------------------------------------------------------------------------- /course_material/week_06/postgresql and pgadmin install instructions.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/postgresql and pgadmin install instructions.docx -------------------------------------------------------------------------------- /course_material/week_06/printable-postgresql-sample-database-diagram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/printable-postgresql-sample-database-diagram.pdf -------------------------------------------------------------------------------- /course_material/week_06/week_06_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/week_06_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_06/week_6_sql_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_06/week_6_sql_hw.docx -------------------------------------------------------------------------------- /course_material/week_07/week 7 group activity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_07/week 7 group activity.pdf -------------------------------------------------------------------------------- /course_material/week_07/week_07_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_07/week_07_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_07/week_7_sql_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_07/week_7_sql_hw.docx -------------------------------------------------------------------------------- /course_material/week_08/Week 8 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_08/Week 8 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_08/week_08_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_08/week_08_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_09/probability_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_09/probability_hw.docx -------------------------------------------------------------------------------- /course_material/week_09/week 9 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_09/week 9 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_09/week_09_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_09/week_09_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_10/intro_to_linear_algebra.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Vectors" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 8, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "[[1]\n", 20 | " [2]\n", 21 | " [3]]\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "import numpy as np\n", 27 | "v = np.array([[1],[2],[3]])\n", 28 | "v2 = np.array([[-1],[-2],[-3]])\n", 29 | "print(v)" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "name": "stdout", 39 | "output_type": "stream", 40 | "text": [ 41 | "[[1 2 3]]\n" 42 | ] 43 | } 44 | ], 45 | "source": [ 46 | "print(v.T)" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 4, 52 | "metadata": {}, 53 | "outputs": [ 54 | { 55 | "data": { 56 | "text/plain": [ 57 | "(3, 1)" 58 | ] 59 | }, 60 | "execution_count": 4, 61 | "metadata": {}, 62 | "output_type": "execute_result" 63 | } 64 | ], 65 | "source": [ 66 | "v.shape" 67 | ] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "# Matrices" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 6, 79 | "metadata": {}, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/plain": [ 84 | "array([[1, 2, 3],\n", 85 | " [4, 5, 6],\n", 86 | " [7, 8, 9]])" 87 | ] 88 | }, 89 | "execution_count": 6, 90 | "metadata": {}, 91 | "output_type": "execute_result" 92 | } 93 | ], 94 | "source": [ 95 | "M = np.array([[1,2,3],[4,5,6],[7,8,9]])\n", 96 | "M" 97 | ] 98 | }, 99 | { 100 | "cell_type": "code", 101 | "execution_count": 7, 102 | "metadata": {}, 103 | "outputs": [ 104 | { 105 | "data": { 106 | "text/plain": [ 107 | "(3, 3)" 108 | ] 109 | }, 110 | "execution_count": 7, 111 | "metadata": {}, 112 | "output_type": "execute_result" 113 | } 114 | ], 115 | "source": [ 116 | "M.shape" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 10, 122 | "metadata": {}, 123 | "outputs": [ 124 | { 125 | "data": { 126 | "text/plain": [ 127 | "[(array([1]), array([-1])),\n", 128 | " (array([2]), array([-2])),\n", 129 | " (array([3]), array([-3]))]" 130 | ] 131 | }, 132 | "execution_count": 10, 133 | "metadata": {}, 134 | "output_type": "execute_result" 135 | } 136 | ], 137 | "source": [ 138 | "#Scalar\n", 139 | "x=3.5\n", 140 | "\n", 141 | "#zipping\n", 142 | "new_matrix = list(zip(v,v2))\n", 143 | "new_matrix" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": 11, 149 | "metadata": {}, 150 | "outputs": [ 151 | { 152 | "data": { 153 | "text/plain": [ 154 | "list" 155 | ] 156 | }, 157 | "execution_count": 11, 158 | "metadata": {}, 159 | "output_type": "execute_result" 160 | } 161 | ], 162 | "source": [ 163 | "type(new_matrix)" 164 | ] 165 | }, 166 | { 167 | "cell_type": "markdown", 168 | "metadata": {}, 169 | "source": [ 170 | "# dot product\n", 171 | "\n", 172 | "We use the dot product to multiply vectors. With 2D vectors, this is the same as matrix multiplication, and we produce a scaler value (a number, not a vector).\n", 173 | "\n", 174 | "Result tells you the degree to which the vectors interact, or the interaction between similar dimensions.\n", 175 | "\n", 176 | "Why do we care? rendering, force diagrams, solar panel tracking" 177 | ] 178 | }, 179 | { 180 | "cell_type": "code", 181 | "execution_count": 12, 182 | "metadata": {}, 183 | "outputs": [ 184 | { 185 | "name": "stdout", 186 | "output_type": "stream", 187 | "text": [ 188 | "[[1 2 3]]\n", 189 | "[[1]\n", 190 | " [2]\n", 191 | " [3]]\n" 192 | ] 193 | } 194 | ], 195 | "source": [ 196 | "print(v.T)\n", 197 | "print(v)" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": 13, 203 | "metadata": {}, 204 | "outputs": [ 205 | { 206 | "data": { 207 | "text/plain": [ 208 | "array([[14]])" 209 | ] 210 | }, 211 | "execution_count": 13, 212 | "metadata": {}, 213 | "output_type": "execute_result" 214 | } 215 | ], 216 | "source": [ 217 | "# 1*1+ 2*2 + 3*3 \n", 218 | "np.dot(v.T,v)" 219 | ] 220 | }, 221 | { 222 | "cell_type": "code", 223 | "execution_count": 17, 224 | "metadata": {}, 225 | "outputs": [ 226 | { 227 | "data": { 228 | "text/plain": [ 229 | "0" 230 | ] 231 | }, 232 | "execution_count": 17, 233 | "metadata": {}, 234 | "output_type": "execute_result" 235 | } 236 | ], 237 | "source": [ 238 | "#directionality example\n", 239 | "north = np.array([0,1])\n", 240 | "east = np.array([1,0])\n", 241 | "south = np.array([0,-1])\n", 242 | "west = np.array([-1,0])\n", 243 | "\n", 244 | "#to what degree are the two directions the same\n", 245 | "np.dot(north, east)" 246 | ] 247 | }, 248 | { 249 | "cell_type": "code", 250 | "execution_count": 18, 251 | "metadata": {}, 252 | "outputs": [ 253 | { 254 | "data": { 255 | "text/plain": [ 256 | "-1" 257 | ] 258 | }, 259 | "execution_count": 18, 260 | "metadata": {}, 261 | "output_type": "execute_result" 262 | } 263 | ], 264 | "source": [ 265 | "# to what degree are north and south the same?\n", 266 | "# create an example\n", 267 | "np.dot(north, south)" 268 | ] 269 | }, 270 | { 271 | "cell_type": "markdown", 272 | "metadata": {}, 273 | "source": [ 274 | "# Cross product\n", 275 | "\n", 276 | "Type of vector multiplication, but it shows the interaction\n", 277 | "between different components of the vector. It tracks all \n", 278 | "the cross interactions between dimensions\n", 279 | "\n", 280 | "when you compute the cross product, you get a new vector\n", 281 | "that is perpendicular to both the input vectors\n", 282 | "\n", 283 | "* In each part of the cross product calcualtion, you are leaving out an interaction. * this could be stated better\n", 284 | "\n", 285 | "why do we care? torque and \"moment\" of a force.\n", 286 | "Moment = measure of the tendency to rotate about a particular point" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 19, 292 | "metadata": {}, 293 | "outputs": [ 294 | { 295 | "name": "stdout", 296 | "output_type": "stream", 297 | "text": [ 298 | "[[1]\n", 299 | " [2]\n", 300 | " [3]]\n", 301 | "[[-1]\n", 302 | " [-2]\n", 303 | " [-3]]\n" 304 | ] 305 | } 306 | ], 307 | "source": [ 308 | "print(v)\n", 309 | "print(v2)" 310 | ] 311 | }, 312 | { 313 | "cell_type": "code", 314 | "execution_count": 22, 315 | "metadata": {}, 316 | "outputs": [ 317 | { 318 | "data": { 319 | "text/plain": [ 320 | "array([[0, 0, 0]])" 321 | ] 322 | }, 323 | "execution_count": 22, 324 | "metadata": {}, 325 | "output_type": "execute_result" 326 | } 327 | ], 328 | "source": [ 329 | "np.cross(v, v2, axisa = 0,axisb=0)" 330 | ] 331 | }, 332 | { 333 | "cell_type": "markdown", 334 | "metadata": {}, 335 | "source": [ 336 | "# Orthogonality\n", 337 | "\n", 338 | "Two vectors are orthogonal is theyre perpendicular. \n", 339 | "The dot product is 0 or the identity matrix.\n", 340 | "\n", 341 | "$$ A \\cdot A^T = I $$" 342 | ] 343 | }, 344 | { 345 | "cell_type": "code", 346 | "execution_count": 24, 347 | "metadata": {}, 348 | "outputs": [ 349 | { 350 | "data": { 351 | "text/plain": [ 352 | "array([[1, 0, 0],\n", 353 | " [0, 1, 0],\n", 354 | " [0, 0, 1]])" 355 | ] 356 | }, 357 | "execution_count": 24, 358 | "metadata": {}, 359 | "output_type": "execute_result" 360 | } 361 | ], 362 | "source": [ 363 | "M = np.array([[1,0,0],\n", 364 | " [0,1,0],\n", 365 | " [0,0,1]])\n", 366 | "M" 367 | ] 368 | }, 369 | { 370 | "cell_type": "code", 371 | "execution_count": 26, 372 | "metadata": {}, 373 | "outputs": [ 374 | { 375 | "data": { 376 | "text/plain": [ 377 | "array([[1, 0, 0],\n", 378 | " [0, 1, 0],\n", 379 | " [0, 0, 1]])" 380 | ] 381 | }, 382 | "execution_count": 26, 383 | "metadata": {}, 384 | "output_type": "execute_result" 385 | } 386 | ], 387 | "source": [ 388 | "# a test for orthogonality is if the matrix and its \n", 389 | "#transpose equal the identity matrix\n", 390 | "\n", 391 | "np.dot(M, M.T)" 392 | ] 393 | }, 394 | { 395 | "cell_type": "code", 396 | "execution_count": 27, 397 | "metadata": {}, 398 | "outputs": [ 399 | { 400 | "data": { 401 | "text/plain": [ 402 | "array([[ 14, 32, 50],\n", 403 | " [ 32, 77, 122],\n", 404 | " [ 50, 122, 194]])" 405 | ] 406 | }, 407 | "execution_count": 27, 408 | "metadata": {}, 409 | "output_type": "execute_result" 410 | } 411 | ], 412 | "source": [ 413 | "#doesnt produce an identity matrix, and therefor is not orthogonal\n", 414 | "M = np.array([[1,2,3],[4,5,6],[7,8,9]])\n", 415 | "np.dot(M,M.T)" 416 | ] 417 | }, 418 | { 419 | "cell_type": "code", 420 | "execution_count": null, 421 | "metadata": {}, 422 | "outputs": [], 423 | "source": [ 424 | "# can you find another matrix that is orthogonal?\n" 425 | ] 426 | } 427 | ], 428 | "metadata": { 429 | "kernelspec": { 430 | "display_name": "Python 3", 431 | "language": "python", 432 | "name": "python3" 433 | }, 434 | "language_info": { 435 | "codemirror_mode": { 436 | "name": "ipython", 437 | "version": 3 438 | }, 439 | "file_extension": ".py", 440 | "mimetype": "text/x-python", 441 | "name": "python", 442 | "nbconvert_exporter": "python", 443 | "pygments_lexer": "ipython3", 444 | "version": "3.8.3" 445 | } 446 | }, 447 | "nbformat": 4, 448 | "nbformat_minor": 4 449 | } 450 | -------------------------------------------------------------------------------- /course_material/week_10/intro_to_recursion.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 6, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "def countdown(n):\n", 10 | " #if we print here we get n, n-1, n-2, ...0\n", 11 | " print(n)\n", 12 | " #count backwards from n until we get to 0\n", 13 | " if n>0:\n", 14 | " #call function again\n", 15 | " countdown(n-1)\n", 16 | " # if you print after you call the function again\n", 17 | " # it has to almost unwind until it gets to the\n", 18 | " #stopping condition\n", 19 | " #last in, first out (LIFO) stack\n", 20 | " #print(n)\n", 21 | " else:\n", 22 | " return #stopping condition - terminates the recursion\n", 23 | " #if we print here we get n, n-1, n-2, ... (and no 0)\n", 24 | " #print(n)" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 5, 30 | "metadata": {}, 31 | "outputs": [ 32 | { 33 | "name": "stdout", 34 | "output_type": "stream", 35 | "text": [ 36 | "1\n", 37 | "2\n" 38 | ] 39 | } 40 | ], 41 | "source": [ 42 | "countdown(2)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | } 52 | ], 53 | "metadata": { 54 | "kernelspec": { 55 | "display_name": "Python 3", 56 | "language": "python", 57 | "name": "python3" 58 | }, 59 | "language_info": { 60 | "codemirror_mode": { 61 | "name": "ipython", 62 | "version": 3 63 | }, 64 | "file_extension": ".py", 65 | "mimetype": "text/x-python", 66 | "name": "python", 67 | "nbconvert_exporter": "python", 68 | "pygments_lexer": "ipython3", 69 | "version": "3.8.3" 70 | } 71 | }, 72 | "nbformat": 4, 73 | "nbformat_minor": 4 74 | } 75 | -------------------------------------------------------------------------------- /course_material/week_10/linear_algebra_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_10/linear_algebra_hw.docx -------------------------------------------------------------------------------- /course_material/week_10/try_except_examples.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### Python Bonus Material\n", 8 | "Useful concepts we did not cover.\n", 9 | "\n", 10 | "1. [Try Except Blocks](https://www.w3schools.com/python/python_try_except.asp)\n", 11 | "- Try/Except blocks run code even if an error is raised. \n" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 5, 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "name": "stdout", 21 | "output_type": "stream", 22 | "text": [ 23 | "5.0\n", 24 | "2.5\n", 25 | "1.6666666666666667\n", 26 | "1.25\n" 27 | ] 28 | }, 29 | { 30 | "ename": "ZeroDivisionError", 31 | "evalue": "division by zero", 32 | "output_type": "error", 33 | "traceback": [ 34 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 35 | "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", 36 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# gives an error\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0msome_list\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", 37 | "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" 38 | ] 39 | } 40 | ], 41 | "source": [ 42 | "some_list = [1,2,3,4,0,5,6]\n", 43 | "\n", 44 | "# gives an error\n", 45 | "for i in some_list:\n", 46 | " print(5/i)\n", 47 | " " 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 6, 53 | "metadata": {}, 54 | "outputs": [ 55 | { 56 | "name": "stdout", 57 | "output_type": "stream", 58 | "text": [ 59 | "5.0\n", 60 | "2.5\n", 61 | "1.6666666666666667\n", 62 | "1.25\n", 63 | "division by zero\n", 64 | "1.0\n", 65 | "0.8333333333333334\n" 66 | ] 67 | } 68 | ], 69 | "source": [ 70 | "# try block to the rescue!\n", 71 | "for i in some_list:\n", 72 | " try:\n", 73 | " print(5/i)\n", 74 | " except Exception as e:\n", 75 | " print(e)" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 17, 81 | "metadata": {}, 82 | "outputs": [ 83 | { 84 | "name": "stdout", 85 | "output_type": "stream", 86 | "text": [ 87 | "5.0\n", 88 | "I run no matter what.\n", 89 | "2.5\n", 90 | "I run no matter what.\n", 91 | "1.6666666666666667\n", 92 | "I run no matter what.\n", 93 | "Can't Divide by zero!\n", 94 | "I run no matter what.\n", 95 | "Can't divite by that type!\n", 96 | "I run no matter what.\n", 97 | "0.5555555555555556\n", 98 | "I run no matter what.\n" 99 | ] 100 | } 101 | ], 102 | "source": [ 103 | "#many programmers are 'lazy' and don't properly utilize the try/except block. \n", 104 | "# Here's an example of a complete block. \n", 105 | "some_list = [1,2,3,0,'foo',9]\n", 106 | "\n", 107 | "for i in some_list:\n", 108 | " try: # try the thing that might fail. Only the thing that might fail goes here.\n", 109 | " foo = (5/i)\n", 110 | " except ZeroDivisionError: # Except specific error\n", 111 | " print(\"Can't Divide by zero!\")\n", 112 | " except TypeError: # Except specific error\n", 113 | " print(\"Can't divite by that type!\")\n", 114 | " except Exception as e: #Except all other errors\n", 115 | " print(e) \n", 116 | " else: # else block runs if try block succeeds!\n", 117 | " print(foo)\n", 118 | " finally: # Finally block runs no matter what. useful for closing connections or files. \n", 119 | " print(\"I run no matter what.\")" 120 | ] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "2. [Files and Context Managers](https://www.geeksforgeeks.org/context-manager-in-python/)" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": 26, 132 | "metadata": {}, 133 | "outputs": [ 134 | { 135 | "name": "stdout", 136 | "output_type": "stream", 137 | "text": [ 138 | "Hello from jupyter line 0!\n", 139 | "\n", 140 | "['Hello from jupyter line 1!\\n', 'Hello from jupyter line 2!\\n', 'Hello from jupyter line 3!\\n', 'Hello from jupyter line 4!\\n']\n" 141 | ] 142 | } 143 | ], 144 | "source": [ 145 | "# Always use a context manager when opening files\n", 146 | "\n", 147 | "with open('newfile.txt', 'w') as file:\n", 148 | " for i in range(5):\n", 149 | " file.write(f'Hello from jupyter line {i}!\\n')\n", 150 | " \n", 151 | "with open('newfile.txt','r') as file2:\n", 152 | " first_line = file2.readline()\n", 153 | " print(first_line)\n", 154 | " \n", 155 | " the_rest = file2.readlines() # this is a list of the lines\n", 156 | " print(the_rest)\n", 157 | " \n", 158 | " " 159 | ] 160 | }, 161 | { 162 | "cell_type": "markdown", 163 | "metadata": {}, 164 | "source": [ 165 | "3. [List Comprehensions](https://realpython.com/list-comprehension-python/)\n", 166 | "- Preferred way to modify lists\n", 167 | "- Can be hard to read if they are too complicated\n", 168 | "- fastest way to create a list" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": 33, 174 | "metadata": {}, 175 | "outputs": [ 176 | { 177 | "name": "stdout", 178 | "output_type": "stream", 179 | "text": [ 180 | "[2, 4, 6, 8]\n", 181 | "[1, 3, 5, 7, 9]\n" 182 | ] 183 | } 184 | ], 185 | "source": [ 186 | "some_list = [1,2,3,4,5,6,7,8,9]\n", 187 | "\n", 188 | "evens = [i for i in some_list if i % 2 == 0]\n", 189 | "print(evens)\n", 190 | "\n", 191 | "odds = [i for i in some_list if i % 2 != 0]\n", 192 | "print(odds)" 193 | ] 194 | }, 195 | { 196 | "cell_type": "markdown", 197 | "metadata": {}, 198 | "source": [ 199 | "4. [lambda functions]()\n", 200 | "- Anonymous functions" 201 | ] 202 | }, 203 | { 204 | "cell_type": "code", 205 | "execution_count": 42, 206 | "metadata": {}, 207 | "outputs": [ 208 | { 209 | "name": "stdout", 210 | "output_type": "stream", 211 | "text": [ 212 | "[1, 4, 9, 16, 25]\n" 213 | ] 214 | } 215 | ], 216 | "source": [ 217 | "some_list = [1,2,3,4,5]\n", 218 | "\n", 219 | "foo = map(lambda x : x**2, some_list) # define an anonymous function\n", 220 | "\n", 221 | "print(list(foo))" 222 | ] 223 | }, 224 | { 225 | "cell_type": "markdown", 226 | "metadata": {}, 227 | "source": [ 228 | "5. [Generators](https://realpython.com/introduction-to-python-generators/)\n", 229 | "- Iterate 1 item at a time. \n", 230 | "- Can only go forward. \n", 231 | "- Saves on memory. \n", 232 | "- Can be a tricky conecpt. " 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 1, 238 | "metadata": {}, 239 | "outputs": [ 240 | { 241 | "name": "stdout", 242 | "output_type": "stream", 243 | "text": [ 244 | "Hello, I am the integer 0.\n", 245 | "Hello, I am the integer 1.\n", 246 | "Hello, I am the integer 2.\n", 247 | "Hello, I am the integer 3.\n", 248 | "Hello, I am the integer 4.\n" 249 | ] 250 | } 251 | ], 252 | "source": [ 253 | "def non_generator():\n", 254 | " for i in range(5):\n", 255 | " print(f'Hello, I am the integer {i}.')\n", 256 | " \n", 257 | "non_generator() # does everything at once. " 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": 4, 263 | "metadata": {}, 264 | "outputs": [], 265 | "source": [ 266 | "def generator():\n", 267 | " for i in range(5):\n", 268 | " yield print(i)\n", 269 | " \n", 270 | "foo = generator() # nothing happens" 271 | ] 272 | }, 273 | { 274 | "cell_type": "code", 275 | "execution_count": 2, 276 | "metadata": {}, 277 | "outputs": [ 278 | { 279 | "name": "stdout", 280 | "output_type": "stream", 281 | "text": [ 282 | "0\n", 283 | "1\n", 284 | "2\n", 285 | "3\n", 286 | "4\n" 287 | ] 288 | }, 289 | { 290 | "ename": "StopIteration", 291 | "evalue": "", 292 | "output_type": "error", 293 | "traceback": [ 294 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 295 | "\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)", 296 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfoo\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfoo\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfoo\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# Uh 0h! We have exhausted our generator.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 297 | "\u001b[0;31mStopIteration\u001b[0m: " 298 | ] 299 | } 300 | ], 301 | "source": [ 302 | "next(foo) # use next to access the first value\n", 303 | "next(foo)\n", 304 | "next(foo)\n", 305 | "next(foo)\n", 306 | "next(foo)\n", 307 | "next(foo) # Uh 0h! We have exhausted our generator. " 308 | ] 309 | }, 310 | { 311 | "cell_type": "code", 312 | "execution_count": null, 313 | "metadata": {}, 314 | "outputs": [], 315 | "source": [ 316 | "\n" 317 | ] 318 | } 319 | ], 320 | "metadata": { 321 | "kernelspec": { 322 | "display_name": "Python 3", 323 | "language": "python", 324 | "name": "python3" 325 | }, 326 | "language_info": { 327 | "codemirror_mode": { 328 | "name": "ipython", 329 | "version": 3 330 | }, 331 | "file_extension": ".py", 332 | "mimetype": "text/x-python", 333 | "name": "python", 334 | "nbconvert_exporter": "python", 335 | "pygments_lexer": "ipython3", 336 | "version": "3.8.3" 337 | } 338 | }, 339 | "nbformat": 4, 340 | "nbformat_minor": 4 341 | } 342 | -------------------------------------------------------------------------------- /course_material/week_10/week 10 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_10/week 10 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_10/week_10_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_10/week_10_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_11/timeseries_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_11/timeseries_hw.docx -------------------------------------------------------------------------------- /course_material/week_11/week 11 Group Activity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_11/week 11 Group Activity.pdf -------------------------------------------------------------------------------- /course_material/week_11/week_11_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_11/week_11_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_12/intro_to_ml.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_12/intro_to_ml.docx -------------------------------------------------------------------------------- /course_material/week_12/ml_preprocessing.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Preprocessing " 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 2, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "data": { 17 | "text/html": [ 18 | "
\n", 19 | "\n", 32 | "\n", 33 | " \n", 34 | " \n", 35 | " \n", 36 | " \n", 37 | " \n", 38 | " \n", 39 | " \n", 40 | " \n", 41 | " \n", 42 | " \n", 43 | " \n", 44 | " \n", 45 | " \n", 46 | " \n", 47 | " \n", 48 | " \n", 49 | " \n", 50 | " \n", 51 | " \n", 52 | " \n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | "
colorsizepricetype
0greenM10shirt
1blueL20pants
2whiteM30shirt
\n", 66 | "
" 67 | ], 68 | "text/plain": [ 69 | " color size price type\n", 70 | "0 green M 10 shirt\n", 71 | "1 blue L 20 pants\n", 72 | "2 white M 30 shirt" 73 | ] 74 | }, 75 | "execution_count": 2, 76 | "metadata": {}, 77 | "output_type": "execute_result" 78 | } 79 | ], 80 | "source": [ 81 | "import pandas as pd\n", 82 | "df_clothes = pd.DataFrame(data = \n", 83 | " [['green','M',10,'shirt'],\n", 84 | " ['blue','L',20,'pants'],\n", 85 | " ['white','M',30,'shirt']])\n", 86 | "df_clothes.columns = ['color','size','price','type']\n", 87 | "df_clothes" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 3, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "data": { 97 | "text/html": [ 98 | "
\n", 99 | "\n", 112 | "\n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | " \n", 130 | " \n", 131 | " \n", 132 | " \n", 133 | " \n", 134 | " \n", 135 | " \n", 136 | " \n", 137 | " \n", 138 | " \n", 139 | " \n", 140 | " \n", 141 | " \n", 142 | " \n", 143 | " \n", 144 | " \n", 145 | "
colorsizepricetype
0green210shirt
1blue320pants
2white230shirt
\n", 146 | "
" 147 | ], 148 | "text/plain": [ 149 | " color size price type\n", 150 | "0 green 2 10 shirt\n", 151 | "1 blue 3 20 pants\n", 152 | "2 white 2 30 shirt" 153 | ] 154 | }, 155 | "execution_count": 3, 156 | "metadata": {}, 157 | "output_type": "execute_result" 158 | } 159 | ], 160 | "source": [ 161 | "#have 1 for S\n", 162 | "#size is ordinal, so it can be encoded\n", 163 | "size_map = {'S':1,'M':2,'L':3}\n", 164 | "df_clothes['size'] = df_clothes['size'].map(size_map)\n", 165 | "df_clothes" 166 | ] 167 | }, 168 | { 169 | "cell_type": "code", 170 | "execution_count": 4, 171 | "metadata": {}, 172 | "outputs": [ 173 | { 174 | "data": { 175 | "text/html": [ 176 | "
\n", 177 | "\n", 190 | "\n", 191 | " \n", 192 | " \n", 193 | " \n", 194 | " \n", 195 | " \n", 196 | " \n", 197 | " \n", 198 | " \n", 199 | " \n", 200 | " \n", 201 | " \n", 202 | " \n", 203 | " \n", 204 | " \n", 205 | " \n", 206 | " \n", 207 | " \n", 208 | " \n", 209 | " \n", 210 | " \n", 211 | " \n", 212 | " \n", 213 | " \n", 214 | " \n", 215 | " \n", 216 | " \n", 217 | " \n", 218 | " \n", 219 | " \n", 220 | " \n", 221 | " \n", 222 | " \n", 223 | "
colorsizepricetype
0green2101
1blue3200
2white2301
\n", 224 | "
" 225 | ], 226 | "text/plain": [ 227 | " color size price type\n", 228 | "0 green 2 10 1\n", 229 | "1 blue 3 20 0\n", 230 | "2 white 2 30 1" 231 | ] 232 | }, 233 | "execution_count": 4, 234 | "metadata": {}, 235 | "output_type": "execute_result" 236 | } 237 | ], 238 | "source": [ 239 | "#nominal values\n", 240 | "from sklearn.preprocessing import LabelEncoder\n", 241 | "class_labels = LabelEncoder()\n", 242 | "df_clothes['type']=class_labels.fit_transform(df_clothes['type'].values)\n", 243 | "df_clothes" 244 | ] 245 | }, 246 | { 247 | "cell_type": "code", 248 | "execution_count": 5, 249 | "metadata": {}, 250 | "outputs": [ 251 | { 252 | "data": { 253 | "text/html": [ 254 | "
\n", 255 | "\n", 268 | "\n", 269 | " \n", 270 | " \n", 271 | " \n", 272 | " \n", 273 | " \n", 274 | " \n", 275 | " \n", 276 | " \n", 277 | " \n", 278 | " \n", 279 | " \n", 280 | " \n", 281 | " \n", 282 | " \n", 283 | " \n", 284 | " \n", 285 | " \n", 286 | " \n", 287 | " \n", 288 | " \n", 289 | " \n", 290 | " \n", 291 | " \n", 292 | " \n", 293 | " \n", 294 | " \n", 295 | " \n", 296 | " \n", 297 | " \n", 298 | " \n", 299 | " \n", 300 | " \n", 301 | " \n", 302 | " \n", 303 | " \n", 304 | " \n", 305 | "
sizepricecolor_bluecolor_greencolor_white
0210010
1320100
2230001
\n", 306 | "
" 307 | ], 308 | "text/plain": [ 309 | " size price color_blue color_green color_white\n", 310 | "0 2 10 0 1 0\n", 311 | "1 3 20 1 0 0\n", 312 | "2 2 30 0 0 1" 313 | ] 314 | }, 315 | "execution_count": 5, 316 | "metadata": {}, 317 | "output_type": "execute_result" 318 | } 319 | ], 320 | "source": [ 321 | "#one hot encoding - easiest way\n", 322 | "#it wont work if you have data that is already numerical. It will just skip over it.\n", 323 | "df_clothes = pd.get_dummies(df_clothes[['color','size','price']])\n", 324 | "df_clothes" 325 | ] 326 | }, 327 | { 328 | "cell_type": "code", 329 | "execution_count": null, 330 | "metadata": {}, 331 | "outputs": [], 332 | "source": [] 333 | } 334 | ], 335 | "metadata": { 336 | "kernelspec": { 337 | "display_name": "Python 3", 338 | "language": "python", 339 | "name": "python3" 340 | }, 341 | "language_info": { 342 | "codemirror_mode": { 343 | "name": "ipython", 344 | "version": 3 345 | }, 346 | "file_extension": ".py", 347 | "mimetype": "text/x-python", 348 | "name": "python", 349 | "nbconvert_exporter": "python", 350 | "pygments_lexer": "ipython3", 351 | "version": "3.8.3" 352 | } 353 | }, 354 | "nbformat": 4, 355 | "nbformat_minor": 4 356 | } 357 | -------------------------------------------------------------------------------- /course_material/week_12/week 12 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_12/week 12 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_12/week_12_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_12/week_12_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_13/crime_data.csv: -------------------------------------------------------------------------------- 1 | X1,X2,X3,X4,X5,X6,X7 2 | 478,184,40,74,11,31,20 3 | 494,213,32,72,11,43,18 4 | 643,347,57,70,18,16,16 5 | 341,565,31,71,11,25,19 6 | 773,327,67,72,9,29,24 7 | 603,260,25,68,8,32,15 8 | 484,325,34,68,12,24,14 9 | 546,102,33,62,13,28,11 10 | 424,38,36,69,7,25,12 11 | 548,226,31,66,9,58,15 12 | 506,137,35,60,13,21,9 13 | 819,369,30,81,4,77,36 14 | 541,109,44,66,9,37,12 15 | 491,809,32,67,11,37,16 16 | 514,29,30,65,12,35,11 17 | 371,245,16,64,10,42,14 18 | 457,118,29,64,12,21,10 19 | 437,148,36,62,7,81,27 20 | 570,387,30,59,15,31,16 21 | 432,98,23,56,15,50,15 22 | 619,608,33,46,22,24,8 23 | 357,218,35,54,14,27,13 24 | 623,254,38,54,20,22,11 25 | 547,697,44,45,26,18,8 26 | 792,827,28,57,12,23,11 27 | 799,693,35,57,9,60,18 28 | 439,448,31,61,19,14,12 29 | 867,942,39,52,17,31,10 30 | 912,1017,27,44,21,24,9 31 | 462,216,36,43,18,23,8 32 | 859,673,38,48,19,22,10 33 | 805,989,46,57,14,25,12 34 | 652,630,29,47,19,25,9 35 | 776,404,32,50,19,21,9 36 | 919,692,39,48,16,32,11 37 | 732,1517,44,49,13,31,14 38 | 657,879,33,72,13,13,22 39 | 1419,631,43,59,14,21,13 40 | 989,1375,22,49,9,46,13 41 | 821,1139,30,54,13,27,12 42 | 1740,3545,86,62,22,18,15 43 | 815,706,30,47,17,39,11 44 | 760,451,32,45,34,15,10 45 | 936,433,43,48,26,23,12 46 | 863,601,20,69,23,7,12 47 | 783,1024,55,42,23,23,11 48 | 715,457,44,49,18,30,12 49 | 1504,1441,37,57,15,35,13 50 | 1324,1022,82,72,22,15,16 51 | 940,1244,66,67,26,18,16 52 | -------------------------------------------------------------------------------- /course_material/week_13/supervised_learning.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_13/supervised_learning.docx -------------------------------------------------------------------------------- /course_material/week_13/week 13 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_13/week 13 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_13/week_13_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_13/week_13_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_14/logistic_regression.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/html": [ 11 | "
\n", 12 | "\n", 25 | "\n", 26 | " \n", 27 | " \n", 28 | " \n", 29 | " \n", 30 | " \n", 31 | " \n", 32 | " \n", 33 | " \n", 34 | " \n", 35 | " \n", 36 | " \n", 37 | " \n", 38 | " \n", 39 | " \n", 40 | " \n", 41 | " \n", 42 | " \n", 43 | " \n", 44 | " \n", 45 | " \n", 46 | " \n", 47 | " \n", 48 | " \n", 49 | " \n", 50 | " \n", 51 | " \n", 52 | " \n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | "
PregnanciesGlucoseBloodPressureSkinThicknessInsulinBMIDiabetesPedigreeFunctionAgeOutcome
061487235033.60.627501
11856629026.60.351310
28183640023.30.672321
318966239428.10.167210
40137403516843.12.288331
\n", 103 | "
" 104 | ], 105 | "text/plain": [ 106 | " Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n", 107 | "0 6 148 72 35 0 33.6 \n", 108 | "1 1 85 66 29 0 26.6 \n", 109 | "2 8 183 64 0 0 23.3 \n", 110 | "3 1 89 66 23 94 28.1 \n", 111 | "4 0 137 40 35 168 43.1 \n", 112 | "\n", 113 | " DiabetesPedigreeFunction Age Outcome \n", 114 | "0 0.627 50 1 \n", 115 | "1 0.351 31 0 \n", 116 | "2 0.672 32 1 \n", 117 | "3 0.167 21 0 \n", 118 | "4 2.288 33 1 " 119 | ] 120 | }, 121 | "execution_count": 1, 122 | "metadata": {}, 123 | "output_type": "execute_result" 124 | } 125 | ], 126 | "source": [ 127 | "import numpy as np\n", 128 | "import pandas as pd\n", 129 | "import matplotlib.pyplot as plt\n", 130 | "import seaborn as sns\n", 131 | "\n", 132 | "diabetes_df = pd.read_csv(\"../week_13/diabetes.csv\")\n", 133 | "\n", 134 | "diabetes_df.head()" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": 3, 140 | "metadata": {}, 141 | "outputs": [ 142 | { 143 | "name": "stdout", 144 | "output_type": "stream", 145 | "text": [ 146 | "Optimization terminated successfully.\n", 147 | " Current function value: 0.519116\n", 148 | " Iterations 6\n", 149 | "Intercept -5.912449\n", 150 | "Age 0.024778\n", 151 | "Glucose 0.035644\n", 152 | "dtype: float64\n" 153 | ] 154 | } 155 | ], 156 | "source": [ 157 | "from statsmodels.formula.api import logit\n", 158 | "\n", 159 | "#no interaction\n", 160 | "age_gl_no_int = logit('Outcome ~ Age + Glucose', data=diabetes_df).fit()\n", 161 | "print(age_gl_no_int.params)\n", 162 | "\n", 163 | "# Outcome = -5.9 + 0.02*Age + .04*Glucose" 164 | ] 165 | }, 166 | { 167 | "cell_type": "code", 168 | "execution_count": 4, 169 | "metadata": {}, 170 | "outputs": [ 171 | { 172 | "name": "stdout", 173 | "output_type": "stream", 174 | "text": [ 175 | "Optimization terminated successfully.\n", 176 | " Current function value: 0.513197\n", 177 | " Iterations 6\n", 178 | "Intercept -9.510659\n", 179 | "Age 0.126536\n", 180 | "Glucose 0.063854\n", 181 | "Age:Glucose -0.000789\n", 182 | "dtype: float64\n" 183 | ] 184 | } 185 | ], 186 | "source": [ 187 | "#interaction\n", 188 | "age_gl_int = logit('Outcome ~ Age * Glucose', data=diabetes_df).fit()\n", 189 | "print(age_gl_int.params)\n", 190 | "# Outcome = -9.5 + 0.12*Age + 0.06*Glucose - 0.0008*Age*Glucose" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 5, 196 | "metadata": {}, 197 | "outputs": [], 198 | "source": [ 199 | "from sklearn.linear_model import LogisticRegression\n", 200 | "from sklearn.model_selection import train_test_split\n", 201 | "from sklearn.preprocessing import StandardScaler\n", 202 | "\n", 203 | "X = diabetes_df.drop('Outcome', axis=1)\n", 204 | "y = diabetes_df['Outcome']\n", 205 | "\n", 206 | "# Split into training and test set\n", 207 | "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=42, stratify=y)\n", 208 | "\n", 209 | "#Standardize\n", 210 | "sc= StandardScaler()\n", 211 | "X_train=sc.fit_transform(X_train)\n", 212 | "X_test=sc.fit_transform(X_test)" 213 | ] 214 | }, 215 | { 216 | "cell_type": "code", 217 | "execution_count": 6, 218 | "metadata": {}, 219 | "outputs": [], 220 | "source": [ 221 | "#Simplest logistic regression approach\n", 222 | "regression = LogisticRegression(random_state=0).fit(X_train, y_train)\n", 223 | "\n", 224 | "y_predicted = regression.predict(X_test)" 225 | ] 226 | }, 227 | { 228 | "cell_type": "code", 229 | "execution_count": 7, 230 | "metadata": {}, 231 | "outputs": [ 232 | { 233 | "data": { 234 | "text/plain": [ 235 | "0.7077922077922078" 236 | ] 237 | }, 238 | "execution_count": 7, 239 | "metadata": {}, 240 | "output_type": "execute_result" 241 | } 242 | ], 243 | "source": [ 244 | "regression.score(X_test, y_test)" 245 | ] 246 | }, 247 | { 248 | "cell_type": "code", 249 | "execution_count": 8, 250 | "metadata": {}, 251 | "outputs": [ 252 | { 253 | "data": { 254 | "text/plain": [ 255 | "0.7915309446254072" 256 | ] 257 | }, 258 | "execution_count": 8, 259 | "metadata": {}, 260 | "output_type": "execute_result" 261 | } 262 | ], 263 | "source": [ 264 | "#we see a huge improvement in performance\n", 265 | "#but, we basically cheated by getting performance based on\n", 266 | "# data we trained the model on\n", 267 | "regression.score(X_train, y_train)" 268 | ] 269 | }, 270 | { 271 | "cell_type": "code", 272 | "execution_count": 9, 273 | "metadata": {}, 274 | "outputs": [ 275 | { 276 | "name": "stdout", 277 | "output_type": "stream", 278 | "text": [ 279 | " precision recall f1-score support\n", 280 | "\n", 281 | " 0 0.75 0.82 0.78 100\n", 282 | " 1 0.60 0.50 0.55 54\n", 283 | "\n", 284 | " accuracy 0.71 154\n", 285 | " macro avg 0.68 0.66 0.67 154\n", 286 | "weighted avg 0.70 0.71 0.70 154\n", 287 | "\n" 288 | ] 289 | } 290 | ], 291 | "source": [ 292 | "from sklearn.metrics import confusion_matrix, plot_confusion_matrix, classification_report\n", 293 | "\n", 294 | "print(classification_report(y_test, y_predicted))" 295 | ] 296 | }, 297 | { 298 | "cell_type": "code", 299 | "execution_count": 10, 300 | "metadata": {}, 301 | "outputs": [], 302 | "source": [ 303 | "conf_matrix = confusion_matrix(y_test, y_predicted)" 304 | ] 305 | }, 306 | { 307 | "cell_type": "code", 308 | "execution_count": 11, 309 | "metadata": {}, 310 | "outputs": [ 311 | { 312 | "data": { 313 | "text/plain": [ 314 | "(
,\n", 315 | " OrderedDict([(('0', '0'), (0.0, 0.0, 0.6461200491051238, 0.8172757475083056)),\n", 316 | " (('0', '1'),\n", 317 | " (0.0,\n", 318 | " 0.8205980066445181,\n", 319 | " 0.6461200491051238,\n", 320 | " 0.17940199335548176)),\n", 321 | " (('1', '0'),\n", 322 | " (0.6510951734832332,\n", 323 | " 0.0,\n", 324 | " 0.34890482651676685,\n", 325 | " 0.4983388704318937)),\n", 326 | " (('1', '1'),\n", 327 | " (0.6510951734832332,\n", 328 | " 0.5016611295681063,\n", 329 | " 0.34890482651676685,\n", 330 | " 0.4983388704318937))]))" 331 | ] 332 | }, 333 | "execution_count": 11, 334 | "metadata": {}, 335 | "output_type": "execute_result" 336 | }, 337 | { 338 | "data": { 339 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJM0lEQVR4nO3dz4td9R3G8ed772QmPyZGhsgwaCQSJRiwEC3u3YiuslV0ZcVV/wB31j/CTRZBRGhx6aJQXAjddNGCWKqlEKMYS0cHIwkJk0nuzOmisY02Njdl7pzz4b5euxnC4VnceefMmfudaV3XBYA6Rn0PAODeCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFLMzioq21rs3iwkDa6F/3WzvdTs9L2FVd0nXTpXM24U7yxvHjs7g0zL03Pv88SfLIm4/0vITd9MWvvpj6f2KPSgCKEW6AYoQboBjhBihGuAGKEW6AYoQboBjhBihGuAGKmcnJSer44NKlXNzayv0LCzlz9GjGzS8rgKFzxz3H1m/cyJXt7byytpaj+/bl02vX+p4ETEG459jF69dz4sCBJMmjBw7ky62tnhcB0xDuOba5s5OlW49GlkajbO74bXNQgXDPsf2jUba6LkmytbOTAyMvB6jgrl+prbVzrbVvWmt/2YtB7J1jS0u5sLmZJDm/uZmHl5Z6XgRMY5pbrLeTPDfjHfRgbWkpy+Nxzv3jH9m4eTOPHzrU9yRgCnd9O2DXdb9vrR3fgy304NmVlb4nAPfIQ02AYnbtAE5r7bUkr+3W9QC4s10Ld9d1Z5OcTZJRa91uXZfZub6zk3fW17Nx82ZeXVvL6uJi35OAKXhUMsf2tZaXVldz6uDBvqcA92CatwP+OskfkpxsrX3VWvvF7GexF8at5dB43PcM4B5N866SF/diCADT8agEoBjhBijG7+Oec+9+/XXWb9zIt5NJnlpezunDh/ueBNyFcM+5l1dX+54A3COPSgCKEW6AYoQboBjhBihGuAGKEW6AYoQboBjhBihGuAGKEW6AYmZy5L2NRnnj889ncWmAuTeTcHc7O3nzmWdmcWmYe298+GHfE+iZRyUAxQg3QDHCDVCMcAMU4w8pAIO0c30n6++s5+bGzay9upbF1cW+Jw2GO25gkNq+ltWXVnPw1MG+pwyOcAOD1MYt40PjvmcMknADFCPcAMUIN0Ax3lUCDNbX736dG+s3Mvl2kuWnlnP49OG+Jw2CcAODtfryat8TBsmjEoBihBugGOEGKMYzbmCQHHn/ae64gUFy5P2nCTcwSI68/zThBihGuAGKEW6AYryrBBgsR97vTLiBwXLk/c48KgEoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoRrgBihFugGKEG6AY4QYoZqHvAcD/53iO9z2BXfRFvpj637rjBihGuAGKEW6AYoQboBjhBihGuAGKEW6AYoQboBjhBihGuAGKceR9zn3w2We5eOVK7t+/P2dOnsx45P9yGDpfpXNs/erVXNnayiunT+fowYP5dGOj70nAFIR7jl28fDknVlaSJI+urOTLy5d7XgRMQ7jn2OZkkqXxOEmyNB5nczLpeREwDeGeY/sXFrK1vZ0k2drezoEFP/KACqYKd2vtudba31pr51trr896FHvj2H335cJ33yVJzl+6lIePHOl5ETCNu4a7tTZO8laS55OcSvJia+3UrIcxe2uHD2d5cTHnPvooG9eu5fEHHuh7EjCFab43fjrJ+a7rLiRJa+03Sc4k+XSWw9gbz5440fcE4B5N86jkwSQXb/v4q1ufA6AHu/bTqNbaa0le263rAXBn04T770mO3fbxQ7c+9wNd151NcjZJRq11u7KOmXNyEuqZ5qv0j0kea6090lpbTPJCkvdnO4u94OQk1HTXcHddN0nyyyS/S/LXJO91XffJrIcxe05OQk1TPePuuu63SX474y3ssc3JJMuLi0mcnIRKPNCcY05OQk3CPcecnISahHuOOTkJNfneeM45OQn1uOMGKEa4AYoRboBihBugGOEGKEa4AYoRboBihBugGOEGKEa4AYoRboBihBugGOEGKEa4AYoRboBihBugGH9IARikyfVJPn7n41zbuJYnX30yy6vLfU8aDHfcwCCN9o3yxEtP5IFT/qTejwk3MEij8SiLhxb7njFIwg1QjHADFCPcAMV4VwkwWH9+98+5un41m99uZu2ptaydXut70iAINzBYP3v5Z31PGCSPSgCKEW6AYoQboBjPuIHB+uyDz3Ll4pXsv39/Tp45mdHYvWbijhsYqKvrV7N1ZSunXzmdg0cPZuPTjb4nDYZwA4N0+eLlrJxYSZKsPLqSy19e7nnRcAg3MEiTzUnGS+MkyXhpnMnmpOdFwyHcwCAt7F/I9tZ2kmR7azsLB/xI7nvCDQzSfcfuy3cXvkuSXDp/KUcePtLzouEQbmCQDq8dzuLyYj4691GubVzLA4/7vdzf870HMFgnnj3R94RBcscNUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUIxwAxQj3ADFCDdAMcINUEzrum73L9pal2Rn1y/MrLQku/9CgN0xL6/PUdd1bZp/OJNwU0tr7U9d1/287x1wJ16f/82jEoBihBugGOEmSc72PQD+B6/PH/GMG6AYd9wAxQj3HGutPdda+1tr7Xxr7fW+98DtWmvnWmvftNb+0veWoRHuOdVaGyd5K8nzSU4lebG1dqrfVfADbyd5ru8RQyTc8+vpJOe7rrvQdd2NJL9JcqbnTfBvXdf9PsmlvncMkXDPrweTXLzt469ufQ4YOOEGKEa459ffkxy77eOHbn0OGDjhnl9/TPJYa+2R1tpikheSvN/zJmAKwj2nuq6bJPllkt8l+WuS97qu+6TfVfAfrbVfJ/lDkpOtta9aa7/oe9NQODkJUIw7boBihBugGOEGKEa4AYoRboBihBugGOEGKEa4AYr5J2dBoKLExBiWAAAAAElFTkSuQmCC\n", 340 | "text/plain": [ 341 | "
" 342 | ] 343 | }, 344 | "metadata": { 345 | "needs_background": "light" 346 | }, 347 | "output_type": "display_data" 348 | } 349 | ], 350 | "source": [ 351 | "from statsmodels.graphics.mosaicplot import mosaic\n", 352 | "mosaic(conf_matrix)" 353 | ] 354 | }, 355 | { 356 | "cell_type": "code", 357 | "execution_count": null, 358 | "metadata": {}, 359 | "outputs": [], 360 | "source": [] 361 | } 362 | ], 363 | "metadata": { 364 | "kernelspec": { 365 | "display_name": "Python 3", 366 | "language": "python", 367 | "name": "python3" 368 | }, 369 | "language_info": { 370 | "codemirror_mode": { 371 | "name": "ipython", 372 | "version": 3 373 | }, 374 | "file_extension": ".py", 375 | "mimetype": "text/x-python", 376 | "name": "python", 377 | "nbconvert_exporter": "python", 378 | "pygments_lexer": "ipython3", 379 | "version": "3.8.3" 380 | } 381 | }, 382 | "nbformat": 4, 383 | "nbformat_minor": 4 384 | } 385 | -------------------------------------------------------------------------------- /course_material/week_14/regression_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_14/regression_hw.docx -------------------------------------------------------------------------------- /course_material/week_14/week 14 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_14/week 14 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_14/week_14_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_14/week_14_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_15/over_under_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/html": [ 11 | "
\n", 12 | "\n", 25 | "\n", 26 | " \n", 27 | " \n", 28 | " \n", 29 | " \n", 30 | " \n", 31 | " \n", 32 | " \n", 33 | " \n", 34 | " \n", 35 | " \n", 36 | " \n", 37 | " \n", 38 | " \n", 39 | " \n", 40 | " \n", 41 | " \n", 42 | " \n", 43 | " \n", 44 | " \n", 45 | " \n", 46 | " \n", 47 | " \n", 48 | " \n", 49 | " \n", 50 | " \n", 51 | " \n", 52 | " \n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | "
PregnanciesGlucoseBloodPressureSkinThicknessInsulinBMIDiabetesPedigreeFunctionAgeOutcome
061487235033.60.627501
11856629026.60.351310
28183640023.30.672321
318966239428.10.167210
40137403516843.12.288331
\n", 103 | "
" 104 | ], 105 | "text/plain": [ 106 | " Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n", 107 | "0 6 148 72 35 0 33.6 \n", 108 | "1 1 85 66 29 0 26.6 \n", 109 | "2 8 183 64 0 0 23.3 \n", 110 | "3 1 89 66 23 94 28.1 \n", 111 | "4 0 137 40 35 168 43.1 \n", 112 | "\n", 113 | " DiabetesPedigreeFunction Age Outcome \n", 114 | "0 0.627 50 1 \n", 115 | "1 0.351 31 0 \n", 116 | "2 0.672 32 1 \n", 117 | "3 0.167 21 0 \n", 118 | "4 2.288 33 1 " 119 | ] 120 | }, 121 | "execution_count": 1, 122 | "metadata": {}, 123 | "output_type": "execute_result" 124 | } 125 | ], 126 | "source": [ 127 | "import numpy as np\n", 128 | "import pandas as pd\n", 129 | "import matplotlib.pyplot as plt\n", 130 | "import seaborn as sns\n", 131 | "diabetes_df = pd.read_csv('../week_13/diabetes.csv')\n", 132 | "diabetes_df.head()" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": 2, 138 | "metadata": {}, 139 | "outputs": [ 140 | { 141 | "data": { 142 | "text/plain": [ 143 | "0 500\n", 144 | "1 268\n", 145 | "Name: Outcome, dtype: int64" 146 | ] 147 | }, 148 | "execution_count": 2, 149 | "metadata": {}, 150 | "output_type": "execute_result" 151 | } 152 | ], 153 | "source": [ 154 | "diabetes_df['Outcome'].value_counts()" 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": 3, 160 | "metadata": {}, 161 | "outputs": [], 162 | "source": [ 163 | "from sklearn.linear_model import LogisticRegression\n", 164 | "from sklearn.model_selection import train_test_split\n", 165 | "from sklearn.preprocessing import StandardScaler\n", 166 | "\n", 167 | "X = diabetes_df.drop('Outcome', axis=1)\n", 168 | "y = diabetes_df['Outcome']\n", 169 | "\n", 170 | "X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.3, random_state=42, stratify=y)\n", 171 | "\n", 172 | "#Standardize\n", 173 | "sc = StandardScaler()\n", 174 | "X_train_scaler = sc.fit_transform(X_train)\n", 175 | "X_test_scaler = sc.fit_transform(X_test)" 176 | ] 177 | }, 178 | { 179 | "cell_type": "markdown", 180 | "metadata": {}, 181 | "source": [ 182 | "# Oversampling" 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": 4, 188 | "metadata": {}, 189 | "outputs": [], 190 | "source": [ 191 | "#Resample training data with RandomOversampler (naive approach)\n", 192 | "from imblearn.over_sampling import RandomOverSampler\n", 193 | "\n", 194 | "ros = RandomOverSampler(random_state=42)\n", 195 | "X_resampled, y_resampled = ros.fit_resample(X_train_scaler, y_train)" 196 | ] 197 | }, 198 | { 199 | "cell_type": "code", 200 | "execution_count": 5, 201 | "metadata": {}, 202 | "outputs": [ 203 | { 204 | "data": { 205 | "text/plain": [ 206 | "LogisticRegression(random_state=42)" 207 | ] 208 | }, 209 | "execution_count": 5, 210 | "metadata": {}, 211 | "output_type": "execute_result" 212 | } 213 | ], 214 | "source": [ 215 | "#train using resampled data\n", 216 | "model = LogisticRegression(random_state=42)\n", 217 | "model.fit(X_resampled, y_resampled)\n" 218 | ] 219 | }, 220 | { 221 | "cell_type": "code", 222 | "execution_count": 6, 223 | "metadata": {}, 224 | "outputs": [ 225 | { 226 | "data": { 227 | "text/plain": [ 228 | "0.7575308641975309" 229 | ] 230 | }, 231 | "execution_count": 6, 232 | "metadata": {}, 233 | "output_type": "execute_result" 234 | } 235 | ], 236 | "source": [ 237 | "#calculate accuracy\n", 238 | "from sklearn.metrics import balanced_accuracy_score\n", 239 | "y_pred = model.predict(X_test_scaler)\n", 240 | "balanced_accuracy_score(y_test, y_pred)" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 8, 246 | "metadata": {}, 247 | "outputs": [ 248 | { 249 | "name": "stdout", 250 | "output_type": "stream", 251 | "text": [ 252 | " pre rec spe f1 geo iba sup\n", 253 | "\n", 254 | " 0 0.84 0.79 0.73 0.81 0.76 0.58 150\n", 255 | " 1 0.65 0.73 0.79 0.69 0.76 0.57 81\n", 256 | "\n", 257 | "avg / total 0.77 0.77 0.75 0.77 0.76 0.57 231\n", 258 | "\n" 259 | ] 260 | } 261 | ], 262 | "source": [ 263 | "from imblearn.metrics import classification_report_imbalanced\n", 264 | "print(classification_report_imbalanced(y_test, y_pred))\n", 265 | "#a technique for improving recall is to resample because it gives us a \n", 266 | "#better understanding of the postives, thus improving our true positive rate" 267 | ] 268 | }, 269 | { 270 | "cell_type": "markdown", 271 | "metadata": {}, 272 | "source": [ 273 | "# Undersampling" 274 | ] 275 | }, 276 | { 277 | "cell_type": "code", 278 | "execution_count": 9, 279 | "metadata": {}, 280 | "outputs": [], 281 | "source": [ 282 | "#clusterCentroids uses k-means to reduce the number of samples\n", 283 | "from imblearn.under_sampling import ClusterCentroids\n", 284 | "rus = ClusterCentroids(random_state=42)\n", 285 | "\n", 286 | "X_resampled, y_resampled = rus.fit_resample(X_train_scaler, y_train)\n" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 10, 292 | "metadata": {}, 293 | "outputs": [ 294 | { 295 | "data": { 296 | "text/plain": [ 297 | "LogisticRegression(random_state=42)" 298 | ] 299 | }, 300 | "execution_count": 10, 301 | "metadata": {}, 302 | "output_type": "execute_result" 303 | } 304 | ], 305 | "source": [ 306 | "model = LogisticRegression(random_state=42)\n", 307 | "model.fit(X_resampled, y_resampled)" 308 | ] 309 | }, 310 | { 311 | "cell_type": "code", 312 | "execution_count": 11, 313 | "metadata": {}, 314 | "outputs": [], 315 | "source": [ 316 | "y_pred = model.predict(X_test_scaler)" 317 | ] 318 | }, 319 | { 320 | "cell_type": "code", 321 | "execution_count": 12, 322 | "metadata": {}, 323 | "outputs": [ 324 | { 325 | "name": "stdout", 326 | "output_type": "stream", 327 | "text": [ 328 | " pre rec spe f1 geo iba sup\n", 329 | "\n", 330 | " 0 0.82 0.80 0.67 0.81 0.73 0.54 150\n", 331 | " 1 0.64 0.67 0.80 0.65 0.73 0.53 81\n", 332 | "\n", 333 | "avg / total 0.76 0.75 0.71 0.75 0.73 0.54 231\n", 334 | "\n" 335 | ] 336 | } 337 | ], 338 | "source": [ 339 | "print(classification_report_imbalanced(y_test, y_pred))" 340 | ] 341 | }, 342 | { 343 | "cell_type": "code", 344 | "execution_count": null, 345 | "metadata": {}, 346 | "outputs": [], 347 | "source": [] 348 | } 349 | ], 350 | "metadata": { 351 | "kernelspec": { 352 | "display_name": "Python 3", 353 | "language": "python", 354 | "name": "python3" 355 | }, 356 | "language_info": { 357 | "codemirror_mode": { 358 | "name": "ipython", 359 | "version": 3 360 | }, 361 | "file_extension": ".py", 362 | "mimetype": "text/x-python", 363 | "name": "python", 364 | "nbconvert_exporter": "python", 365 | "pygments_lexer": "ipython3", 366 | "version": "3.8.3" 367 | } 368 | }, 369 | "nbformat": 4, 370 | "nbformat_minor": 4 371 | } 372 | -------------------------------------------------------------------------------- /course_material/week_15/week 15 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_15/week 15 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_15/week_15_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_15/week_15_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_16/svm_over_under_sampling_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_16/svm_over_under_sampling_hw.docx -------------------------------------------------------------------------------- /course_material/week_16/week 16 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_16/week 16 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_16/week_16_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_16/week_16_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_17/tree_based_models_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_17/tree_based_models_hw.docx -------------------------------------------------------------------------------- /course_material/week_17/week 17 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_17/week 17 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_17/week_17_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_17/week_17_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_18/neural_networks.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/html": [ 11 | "
\n", 12 | "\n", 25 | "\n", 26 | " \n", 27 | " \n", 28 | " \n", 29 | " \n", 30 | " \n", 31 | " \n", 32 | " \n", 33 | " \n", 34 | " \n", 35 | " \n", 36 | " \n", 37 | " \n", 38 | " \n", 39 | " \n", 40 | " \n", 41 | " \n", 42 | " \n", 43 | " \n", 44 | " \n", 45 | " \n", 46 | " \n", 47 | " \n", 48 | " \n", 49 | " \n", 50 | " \n", 51 | " \n", 52 | " \n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | "
PregnanciesGlucoseBloodPressureSkinThicknessInsulinBMIDiabetesPedigreeFunctionAgeOutcome
061487235033.60.627501
11856629026.60.351310
28183640023.30.672321
318966239428.10.167210
40137403516843.12.288331
\n", 103 | "
" 104 | ], 105 | "text/plain": [ 106 | " Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n", 107 | "0 6 148 72 35 0 33.6 \n", 108 | "1 1 85 66 29 0 26.6 \n", 109 | "2 8 183 64 0 0 23.3 \n", 110 | "3 1 89 66 23 94 28.1 \n", 111 | "4 0 137 40 35 168 43.1 \n", 112 | "\n", 113 | " DiabetesPedigreeFunction Age Outcome \n", 114 | "0 0.627 50 1 \n", 115 | "1 0.351 31 0 \n", 116 | "2 0.672 32 1 \n", 117 | "3 0.167 21 0 \n", 118 | "4 2.288 33 1 " 119 | ] 120 | }, 121 | "execution_count": 1, 122 | "metadata": {}, 123 | "output_type": "execute_result" 124 | } 125 | ], 126 | "source": [ 127 | "import pandas as pd\n", 128 | "import torch\n", 129 | "\n", 130 | "diabetes_df = pd.read_csv(\"../week_13/diabetes.csv\")\n", 131 | "diabetes_df.head()" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": 4, 137 | "metadata": {}, 138 | "outputs": [ 139 | { 140 | "name": "stdout", 141 | "output_type": "stream", 142 | "text": [ 143 | "[[ 0.93138344 2.0179454 0.78066953 ... 0.43148259 -0.37477883\n", 144 | " 0.63212912]\n", 145 | " [ 0.63260632 -1.14861888 0.46538785 ... -0.1198324 -0.29416766\n", 146 | " 0.71699246]\n", 147 | " [-0.56250219 -0.47692343 -0.2702694 ... -0.20958135 2.74517192\n", 148 | " 0.03808578]\n", 149 | " ...\n", 150 | " [-0.86127931 -0.76479291 0.04501228 ... 0.76483585 -0.78380586\n", 151 | " -0.30136756]\n", 152 | " [ 0.63260632 2.20985838 1.2010451 ... 0.43148259 -0.60466993\n", 153 | " 2.75371249]\n", 154 | " [ 0.03505207 0.73852549 -0.58555107 ... -0.33779414 -0.57779954\n", 155 | " 0.29267578]]\n", 156 | "[1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1\n", 157 | " 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0\n", 158 | " 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 1\n", 159 | " 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1\n", 160 | " 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0\n", 161 | " 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 0 1\n", 162 | " 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 1\n", 163 | " 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0\n", 164 | " 0 1 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0\n", 165 | " 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1\n", 166 | " 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 0 0 0 1\n", 167 | " 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0\n", 168 | " 0 0 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 0\n", 169 | " 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1\n", 170 | " 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 0]\n" 171 | ] 172 | } 173 | ], 174 | "source": [ 175 | "from sklearn.model_selection import train_test_split\n", 176 | "from sklearn.preprocessing import StandardScaler\n", 177 | "\n", 178 | "X = diabetes_df.drop('Outcome', axis=1).values\n", 179 | "y = diabetes_df['Outcome'].values\n", 180 | "\n", 181 | "# Split into training and test set\n", 182 | "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3, random_state=42, stratify=y)\n", 183 | "\n", 184 | "# #Standardize\n", 185 | "sc= StandardScaler()\n", 186 | "X_train=sc.fit_transform(X_train)\n", 187 | "X_test=sc.fit_transform(X_test)\n", 188 | "# print(X_train)\n", 189 | "# print(y_train)" 190 | ] 191 | }, 192 | { 193 | "cell_type": "code", 194 | "execution_count": 6, 195 | "metadata": {}, 196 | "outputs": [ 197 | { 198 | "name": "stdout", 199 | "output_type": "stream", 200 | "text": [ 201 | "tensor([[ 0.9314, 2.0179, 0.7807, ..., 0.4315, -0.3748, 0.6321],\n", 202 | " [ 0.6326, -1.1486, 0.4654, ..., -0.1198, -0.2942, 0.7170],\n", 203 | " [-0.5625, -0.4769, -0.2703, ..., -0.2096, 2.7452, 0.0381],\n", 204 | " ...,\n", 205 | " [-0.8613, -0.7648, 0.0450, ..., 0.7648, -0.7838, -0.3014],\n", 206 | " [ 0.6326, 2.2099, 1.2010, ..., 0.4315, -0.6047, 2.7537],\n", 207 | " [ 0.0351, 0.7385, -0.5856, ..., -0.3378, -0.5778, 0.2927]])\n" 208 | ] 209 | } 210 | ], 211 | "source": [ 212 | "import torch.nn as nn\n", 213 | "import torch.nn.functional as F #where the activation functions are\n", 214 | "\n", 215 | "#create tensors = matrices \n", 216 | "X_train = torch.FloatTensor(X_train) \n", 217 | "X_test = torch.FloatTensor(X_test)\n", 218 | "\n", 219 | "y_train = torch.LongTensor(y_train)\n", 220 | "y_test = torch.LongTensor(y_test)\n", 221 | "\n", 222 | "print(X_train)" 223 | ] 224 | }, 225 | { 226 | "cell_type": "code", 227 | "execution_count": 9, 228 | "metadata": {}, 229 | "outputs": [], 230 | "source": [ 231 | "#artificial neural network\n", 232 | "class ANN_Model(nn.Module):\n", 233 | " def __init__(self, input_features=8,hidden1=20,hidden2=20,out_features=2):\n", 234 | " super().__init__() #super is a computed indirect reference. So, it isolates changes\n", 235 | " # and makes sure that children in the layers of multiple inheritence are calling\n", 236 | " #the right parents\n", 237 | " self.layer_1_connection = nn.Linear(input_features, hidden1)\n", 238 | " self.layer_2_connection = nn.Linear(hidden1, hidden2)\n", 239 | " self.out = nn.Linear(hidden2, out_features)\n", 240 | " \n", 241 | " def forward(self, x):\n", 242 | " #apply activation functions\n", 243 | " x = F.relu(self.layer_1_connection(x))\n", 244 | " x = F.relu(self.layer_2_connection(x))\n", 245 | " x = self.out(x)\n", 246 | " return x" 247 | ] 248 | }, 249 | { 250 | "cell_type": "code", 251 | "execution_count": 10, 252 | "metadata": {}, 253 | "outputs": [], 254 | "source": [ 255 | "torch.manual_seed(42)\n", 256 | "\n", 257 | "#create instance of model\n", 258 | "ann = ANN_Model()" 259 | ] 260 | }, 261 | { 262 | "cell_type": "code", 263 | "execution_count": 13, 264 | "metadata": {}, 265 | "outputs": [], 266 | "source": [ 267 | "#loss function\n", 268 | "loss_function = nn.CrossEntropyLoss()\n", 269 | "\n", 270 | "#optimizer\n", 271 | "optimizer = torch.optim.Adam(ann.parameters(),lr=0.01)" 272 | ] 273 | }, 274 | { 275 | "cell_type": "code", 276 | "execution_count": 14, 277 | "metadata": {}, 278 | "outputs": [ 279 | { 280 | "name": "stdout", 281 | "output_type": "stream", 282 | "text": [ 283 | "Epoch number: 1 with loss: 0.647470235824585\n", 284 | "Epoch number: 11 with loss: 0.5270779132843018\n", 285 | "Epoch number: 21 with loss: 0.4539138376712799\n", 286 | "Epoch number: 31 with loss: 0.4234800934791565\n", 287 | "Epoch number: 41 with loss: 0.39819812774658203\n", 288 | "Epoch number: 51 with loss: 0.37210729718208313\n", 289 | "Epoch number: 61 with loss: 0.3437724709510803\n", 290 | "Epoch number: 71 with loss: 0.31378453969955444\n", 291 | "Epoch number: 81 with loss: 0.28582650423049927\n", 292 | "Epoch number: 91 with loss: 0.25994446873664856\n", 293 | "Epoch number: 101 with loss: 0.23771333694458008\n", 294 | "Epoch number: 111 with loss: 0.21422427892684937\n", 295 | "Epoch number: 121 with loss: 0.19071201980113983\n", 296 | "Epoch number: 131 with loss: 0.17592650651931763\n", 297 | "Epoch number: 141 with loss: 0.1584043949842453\n", 298 | "Epoch number: 151 with loss: 0.1441667675971985\n", 299 | "Epoch number: 161 with loss: 0.1284773349761963\n", 300 | "Epoch number: 171 with loss: 0.11511367559432983\n", 301 | "Epoch number: 181 with loss: 0.10324613749980927\n", 302 | "Epoch number: 191 with loss: 0.09050081670284271\n", 303 | "Epoch number: 201 with loss: 0.07899874448776245\n", 304 | "Epoch number: 211 with loss: 0.06844077259302139\n", 305 | "Epoch number: 221 with loss: 0.06012037396430969\n", 306 | "Epoch number: 231 with loss: 0.05291646346449852\n", 307 | "Epoch number: 241 with loss: 0.046177227050065994\n", 308 | "Epoch number: 251 with loss: 0.04083382710814476\n", 309 | "Epoch number: 261 with loss: 0.035291291773319244\n", 310 | "Epoch number: 271 with loss: 0.029808009043335915\n", 311 | "Epoch number: 281 with loss: 0.02549630217254162\n", 312 | "Epoch number: 291 with loss: 0.022238459438085556\n", 313 | "Epoch number: 301 with loss: 0.01950507052242756\n", 314 | "Epoch number: 311 with loss: 0.017246998846530914\n", 315 | "Epoch number: 321 with loss: 0.015385055914521217\n", 316 | "Epoch number: 331 with loss: 0.013763119466602802\n", 317 | "Epoch number: 341 with loss: 0.01233366783708334\n", 318 | "Epoch number: 351 with loss: 0.011164565570652485\n", 319 | "Epoch number: 361 with loss: 0.010095887817442417\n", 320 | "Epoch number: 371 with loss: 0.009114605374634266\n", 321 | "Epoch number: 381 with loss: 0.008228416554629803\n", 322 | "Epoch number: 391 with loss: 0.007483125198632479\n", 323 | "Epoch number: 401 with loss: 0.006837392225861549\n", 324 | "Epoch number: 411 with loss: 0.006251202430576086\n", 325 | "Epoch number: 421 with loss: 0.005728196352720261\n", 326 | "Epoch number: 431 with loss: 0.005281838588416576\n", 327 | "Epoch number: 441 with loss: 0.004889871459454298\n", 328 | "Epoch number: 451 with loss: 0.004547670483589172\n", 329 | "Epoch number: 461 with loss: 0.004237412940710783\n", 330 | "Epoch number: 471 with loss: 0.003955826163291931\n", 331 | "Epoch number: 481 with loss: 0.00370506988838315\n", 332 | "Epoch number: 491 with loss: 0.0034746623132377863\n" 333 | ] 334 | } 335 | ], 336 | "source": [ 337 | "#run model through multiple epochs/iterations\n", 338 | "final_loss = []\n", 339 | "n_epochs = 500\n", 340 | "for epoch in range(n_epochs):\n", 341 | " y_pred = ann.forward(X_train)\n", 342 | " loss = loss_function(y_pred, y_train)\n", 343 | " final_loss.append(loss)\n", 344 | " \n", 345 | " if epoch % 10 == 1:\n", 346 | " print(f'Epoch number: {epoch} with loss: {loss}')\n", 347 | " \n", 348 | " optimizer.zero_grad() #zero the gradient before running backwards propagation\n", 349 | " loss.backward() \n", 350 | " optimizer.step() #perform one optimization step each epoch" 351 | ] 352 | }, 353 | { 354 | "cell_type": "code", 355 | "execution_count": 24, 356 | "metadata": {}, 357 | "outputs": [], 358 | "source": [ 359 | "#predictions\n", 360 | "y_pred = []\n", 361 | "\n", 362 | "with torch.no_grad(): #decreases memory consumption\n", 363 | " for i, data in enumerate(X_test):\n", 364 | " prediction = ann(data)\n", 365 | " y_pred.append(prediction.argmax()) #returns index with max element in each prediction set" 366 | ] 367 | }, 368 | { 369 | "cell_type": "code", 370 | "execution_count": 25, 371 | "metadata": {}, 372 | "outputs": [ 373 | { 374 | "name": "stdout", 375 | "output_type": "stream", 376 | "text": [ 377 | " precision recall f1-score support\n", 378 | "\n", 379 | " 0 0.75 0.80 0.77 150\n", 380 | " 1 0.57 0.49 0.53 81\n", 381 | "\n", 382 | " accuracy 0.69 231\n", 383 | " macro avg 0.66 0.65 0.65 231\n", 384 | "weighted avg 0.68 0.69 0.69 231\n", 385 | "\n" 386 | ] 387 | } 388 | ], 389 | "source": [ 390 | "from sklearn.metrics import classification_report\n", 391 | "\n", 392 | "print(classification_report(y_test, y_pred))" 393 | ] 394 | }, 395 | { 396 | "cell_type": "code", 397 | "execution_count": null, 398 | "metadata": {}, 399 | "outputs": [], 400 | "source": [] 401 | } 402 | ], 403 | "metadata": { 404 | "kernelspec": { 405 | "display_name": "Python 3", 406 | "language": "python", 407 | "name": "python3" 408 | }, 409 | "language_info": { 410 | "codemirror_mode": { 411 | "name": "ipython", 412 | "version": 3 413 | }, 414 | "file_extension": ".py", 415 | "mimetype": "text/x-python", 416 | "name": "python", 417 | "nbconvert_exporter": "python", 418 | "pygments_lexer": "ipython3", 419 | "version": "3.8.3" 420 | } 421 | }, 422 | "nbformat": 4, 423 | "nbformat_minor": 4 424 | } 425 | -------------------------------------------------------------------------------- /course_material/week_18/neural_networks_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_18/neural_networks_hw.docx -------------------------------------------------------------------------------- /course_material/week_18/week 18 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_18/week 18 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_18/week_18_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_18/week_18_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_19/Data-Science-Assignments - Shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_19/Data-Science-Assignments - Shortcut.lnk -------------------------------------------------------------------------------- /course_material/week_19/USArrests.csv: -------------------------------------------------------------------------------- 1 | State,Murder,Assault,UrbanPop,Rape 2 | Alabama,13.2,236,58,21.2 3 | Alaska,10,263,48,44.5 4 | Arizona,8.1,294,80,31 5 | Arkansas,8.8,190,50,19.5 6 | California,9,276,91,40.6 7 | Colorado,7.9,204,78,38.7 8 | Connecticut,3.3,110,77,11.1 9 | Delaware,5.9,238,72,15.8 10 | Florida,15.4,335,80,31.9 11 | Georgia,17.4,211,60,25.8 12 | Hawaii,5.3,46,83,20.2 13 | Idaho,2.6,120,54,14.2 14 | Illinois,10.4,249,83,24 15 | Indiana,7.2,113,65,21 16 | Iowa,2.2,56,57,11.3 17 | Kansas,6,115,66,18 18 | Kentucky,9.7,109,52,16.3 19 | Louisiana,15.4,249,66,22.2 20 | Maine,2.1,83,51,7.8 21 | Maryland,11.3,300,67,27.8 22 | Massachusetts,4.4,149,85,16.3 23 | Michigan,12.1,255,74,35.1 24 | Minnesota,2.7,72,66,14.9 25 | Mississippi,16.1,259,44,17.1 26 | Missouri,9,178,70,28.2 27 | Montana,6,109,53,16.4 28 | Nebraska,4.3,102,62,16.5 29 | Nevada,12.2,252,81,46 30 | New Hampshire,2.1,57,56,9.5 31 | New Jersey,7.4,159,89,18.8 32 | New Mexico,11.4,285,70,32.1 33 | New York,11.1,254,86,26.1 34 | North Carolina,13,337,45,16.1 35 | North Dakota,0.8,45,44,7.3 36 | Ohio,7.3,120,75,21.4 37 | Oklahoma,6.6,151,68,20 38 | Oregon,4.9,159,67,29.3 39 | Pennsylvania,6.3,106,72,14.9 40 | Rhode Island,3.4,174,87,8.3 41 | South Carolina,14.4,279,48,22.5 42 | South Dakota,3.8,86,45,12.8 43 | Tennessee,13.2,188,59,26.9 44 | Texas,12.7,201,80,25.5 45 | Utah,3.2,120,80,22.9 46 | Vermont,2.2,48,32,11.2 47 | Virginia,8.5,156,63,20.7 48 | Washington,4,145,73,26.2 49 | West Virginia,5.7,81,39,9.3 50 | Wisconsin,2.6,53,66,10.8 51 | Wyoming,6.8,161,60,15.6 52 | -------------------------------------------------------------------------------- /course_material/week_19/unsupervised_learning_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_19/unsupervised_learning_hw.docx -------------------------------------------------------------------------------- /course_material/week_19/week 19 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_19/week 19 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_19/week_19_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_19/week_19_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_20/map_reduce/mapper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | 4 | #stdin = standard input 5 | for line in sys.stdin: 6 | 7 | #strip white spaces at begining and end of line 8 | line = line.strip() 9 | 10 | #split each line up 11 | words = line.split() 12 | 13 | #process each word and assign a value of 1 to each word 14 | for word in words: 15 | print(word + "\t1") 16 | 17 | #mapper - breaking up words into units 18 | 19 | #echo 'a quick brown fox jumps over a lazy dog'|./mapper.py -------------------------------------------------------------------------------- /course_material/week_20/map_reduce/reducer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | 4 | current_word = None 5 | current_count = 0 6 | word = None 7 | #take all the words from the mapper and count them 8 | 9 | #lines passed from the mapper.py program 10 | for line in sys.stdin: 11 | line = line.strip() 12 | 13 | word, count = line.split("\t",1) 14 | 15 | count = int(count) 16 | 17 | #sorted values from command line are passed, and 18 | # if we have multiple of the same word, we increment the count per instance of the word 19 | if current_word == word: 20 | current_count += count 21 | 22 | else: 23 | #if there is a current word and its not None (which was how we instantiated it) 24 | if current_word: 25 | print(current_word + "\t" + str(current_count)) 26 | 27 | current_count = count 28 | current_word = word 29 | 30 | #print("current_word: "+ current_word) 31 | 32 | if current_word == word: 33 | print(current_word + "\t" + str(current_count)) 34 | 35 | #echo 'a quick brown fox jumps over a lazy dog'|./mapper.py|sort|./reducer.py 36 | #cat ../cats_txt.txt|./mapper.py|sort|./reducer.py -------------------------------------------------------------------------------- /course_material/week_20/natural_language_processing_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_20/natural_language_processing_hw.docx -------------------------------------------------------------------------------- /course_material/week_20/week 20 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_20/week 20 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_20/week_20_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_20/week_20_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_21/APIs_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_21/APIs_hw.docx -------------------------------------------------------------------------------- /course_material/week_21/Azure_flask_app_steps.txt: -------------------------------------------------------------------------------- 1 | 1. make sure your flask app works 2 | 2. Go to Azure portal: portal.azure.com 3 | 3. Create a resource group 4 | 4. Create a web app in APp services 5 | 5. Go to deployment center in app services 6 | - add a username and password under user scope 7 | 6. make sure your flask app isnt in another repo (such as the one for this class) 8 | (flask app needs to be in its own repository) 9 | 7.git remote add flask-app 10 | 8. Git commit 11 | 9. git push master 12 | 10. GO to settings>configuration>general settings 13 | - add a startup command: gunicorn --bind=0.0.0.0 --timeout 500 :app 14 | 11. Retart the application 15 | 12. Go to your address, and see your API! 16 | 17 | I suggest using the following instructions if you get stuck. On step 3 here I suggest deploying using local git from the Azure Portal. 18 | https://docs.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cwindows%2Cazure-portal%2Cterminal-bash%2Cvscode-deploy%2Cdeploy-instructions-azportal%2Cdeploy-instructions-zip-azcli -------------------------------------------------------------------------------- /course_material/week_21/flask_demo/flask-app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #pip install flask 4 | from flask import Flask, json, render_template, request 5 | import os 6 | 7 | #create instance of Flask app 8 | app = Flask(__name__) 9 | 10 | #decorator 11 | @app.route("/") 12 | def echo_hello(): 13 | return "Hello World!" 14 | 15 | @app.route("/gdp") 16 | def gdp(): 17 | json_url = os.path.join(app.static_folder,"","us_gdp.json") 18 | data_json = json.load(open(json_url)) 19 | 20 | return render_template('index.html',data=data_json) 21 | 22 | @app.route("/gdp/") 23 | def gdp_year(year): 24 | json_url = os.path.join(app.static_folder,"","us_gdp.json") 25 | data_json = json.load(open(json_url)) 26 | 27 | data = data_json[1] 28 | #print(data) 29 | year = request.view_args['year'] 30 | 31 | output_data = [x for x in data if x['date']==year] 32 | return render_template('index.html',data=output_data) 33 | 34 | if __name__ == "__main__": 35 | app.run(debug=True) -------------------------------------------------------------------------------- /course_material/week_21/flask_demo/static/us_gdp.json: -------------------------------------------------------------------------------- 1 | [{"page":1,"pages":1,"per_page":5000,"total":61,"sourceid":"2","sourcename":"World Development Indicators","lastupdated":"2021-06-30"},[{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2020","value":20936600000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2019","value":21433224697000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2018","value":20611860934000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2017","value":19542979183000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2016","value":18745075687000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2015","value":18238300569000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2014","value":17527163695000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2013","value":16784849196000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2012","value":16197007349000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2011","value":15542581104000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2010","value":14992052727000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2009","value":14448933025000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2008","value":14712844084000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2007","value":14451858656000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2006","value":13814611414000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2005","value":13036640230000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2004","value":12213729147000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2003","value":11458243878000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2002","value":10936419054000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2001","value":10581821399000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2000","value":10252345464000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1999","value":9630664202000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1998","value":9062818202000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1997","value":8577554457000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1996","value":8073122000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1995","value":7639749000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1994","value":7287236000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1993","value":6858559000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1992","value":6520327000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1991","value":6158129000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1990","value":5963144000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1989","value":5641580000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1988","value":5236438000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1987","value":4855215000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1986","value":4579631000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1985","value":4338979000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1984","value":4037613000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1983","value":3634038000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1982","value":3343789000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1981","value":3207042000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1980","value":2857307000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1979","value":2627334000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1978","value":2351599000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1977","value":2081826000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1976","value":1873412000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1975","value":1684904000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1974","value":1545243000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1973","value":1425376000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1972","value":1279110000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1971","value":1164850000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1970","value":1073303000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1969","value":1019900000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1968","value":942500000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1967","value":861700000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1966","value":815000000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1965","value":743700000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1964","value":685800000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1963","value":638600000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1962","value":605100000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1961","value":563300000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1960","value":543300000000,"unit":"","obs_status":"","decimal":0}]] -------------------------------------------------------------------------------- /course_material/week_21/flask_demo/templates/.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | __pycache__/ 3 | .vscode/ -------------------------------------------------------------------------------- /course_material/week_21/flask_demo/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Flask Templates 7 | 8 | 9 | 10 |
11 |
12 | 13 | {{ data }} 14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /course_material/week_21/us_gdp.json: -------------------------------------------------------------------------------- 1 | [{"page":1,"pages":1,"per_page":5000,"total":61,"sourceid":"2","sourcename":"World Development Indicators","lastupdated":"2021-06-30"},[{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2020","value":20936600000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2019","value":21433224697000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2018","value":20611860934000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2017","value":19542979183000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2016","value":18745075687000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2015","value":18238300569000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2014","value":17527163695000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2013","value":16784849196000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2012","value":16197007349000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2011","value":15542581104000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2010","value":14992052727000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2009","value":14448933025000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2008","value":14712844084000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2007","value":14451858656000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2006","value":13814611414000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2005","value":13036640230000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2004","value":12213729147000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2003","value":11458243878000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2002","value":10936419054000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2001","value":10581821399000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"2000","value":10252345464000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1999","value":9630664202000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1998","value":9062818202000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1997","value":8577554457000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1996","value":8073122000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1995","value":7639749000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1994","value":7287236000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1993","value":6858559000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1992","value":6520327000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1991","value":6158129000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1990","value":5963144000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1989","value":5641580000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1988","value":5236438000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1987","value":4855215000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1986","value":4579631000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1985","value":4338979000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1984","value":4037613000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1983","value":3634038000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1982","value":3343789000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1981","value":3207042000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1980","value":2857307000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1979","value":2627334000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1978","value":2351599000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1977","value":2081826000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1976","value":1873412000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1975","value":1684904000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1974","value":1545243000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1973","value":1425376000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1972","value":1279110000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1971","value":1164850000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1970","value":1073303000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1969","value":1019900000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1968","value":942500000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1967","value":861700000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1966","value":815000000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1965","value":743700000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1964","value":685800000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1963","value":638600000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1962","value":605100000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1961","value":563300000000,"unit":"","obs_status":"","decimal":0},{"indicator":{"id":"NY.GDP.MKTP.CD","value":"GDP (current US$)"},"country":{"id":"US","value":"United States"},"countryiso3code":"USA","date":"1960","value":543300000000,"unit":"","obs_status":"","decimal":0}]] -------------------------------------------------------------------------------- /course_material/week_21/week 21 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_21/week 21 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_21/week_21_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_21/week_21_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_22/webscraping_hw.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_22/webscraping_hw.docx -------------------------------------------------------------------------------- /course_material/week_22/week 22 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_22/week 22 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_22/week_22_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_22/week_22_presentation.pptx -------------------------------------------------------------------------------- /course_material/week_23/pymongo.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import pymongo\n", 10 | "import datetime\n", 11 | "\n", 12 | "#connect to mongodb on default port\n", 13 | "conn='mongodb://localhost:27017'\n", 14 | "client=pymongo.MongoClient(conn)\n", 15 | "\n", 16 | "#create a database\n", 17 | "sdb = client.shows_db\n", 18 | "\n", 19 | "#create a collection in that DB\n", 20 | "tv_shows = sdb.tv_shows" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 3, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "data": { 30 | "text/plain": [ 31 | "" 32 | ] 33 | }, 34 | "execution_count": 3, 35 | "metadata": {}, 36 | "output_type": "execute_result" 37 | } 38 | ], 39 | "source": [ 40 | "#CREATE\n", 41 | "post_data = {'name':'My Life is Murder',\n", 42 | " 'seasons':2,\n", 43 | " 'duration':'45 minutes',\n", 44 | " 'year':2019,\n", 45 | " 'date_added':datetime.datetime.utcnow()\n", 46 | " }\n", 47 | "\n", 48 | "tv_shows.insert_one(post_data)" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": 6, 54 | "metadata": {}, 55 | "outputs": [ 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "text": [ 60 | "{'_id': ObjectId('621edc9f5acd7ba04cce9db6'), 'name': 'Ted Lasso', 'seasons': 2, 'duration': '30 mins', 'year': 2020, 'date_added': datetime.datetime(2022, 3, 2, 2, 55, 27, 388000)}\n", 61 | "{'_id': ObjectId('622010150e27fb5ec14453fa'), 'name': 'My Life is Murder', 'seasons': 2, 'duration': '45 minutes', 'year': 2019, 'date_added': datetime.datetime(2022, 3, 3, 0, 47, 17, 954000)}\n" 62 | ] 63 | } 64 | ], 65 | "source": [ 66 | "#READ\n", 67 | "results= tv_shows.find()\n", 68 | "for result in results:\n", 69 | " print(result)" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": 5, 75 | "metadata": {}, 76 | "outputs": [ 77 | { 78 | "data": { 79 | "text/plain": [ 80 | "" 81 | ] 82 | }, 83 | "execution_count": 5, 84 | "metadata": {}, 85 | "output_type": "execute_result" 86 | } 87 | ], 88 | "source": [ 89 | "#DELETE\n", 90 | "tv_shows.delete_one({'name':'Deamon Slayer'})" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [ 99 | "show_name = input(\"what show are you watching?\")" 100 | ] 101 | } 102 | ], 103 | "metadata": { 104 | "kernelspec": { 105 | "display_name": "Python 3", 106 | "language": "python", 107 | "name": "python3" 108 | }, 109 | "language_info": { 110 | "codemirror_mode": { 111 | "name": "ipython", 112 | "version": 3 113 | }, 114 | "file_extension": ".py", 115 | "mimetype": "text/x-python", 116 | "name": "python", 117 | "nbconvert_exporter": "python", 118 | "pygments_lexer": "ipython3", 119 | "version": "3.8.3" 120 | } 121 | }, 122 | "nbformat": 4, 123 | "nbformat_minor": 4 124 | } 125 | -------------------------------------------------------------------------------- /course_material/week_23/pymongo_app/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | from flask_pymongo import PyMongo 3 | 4 | app = Flask(__name__) 5 | 6 | #setup mongo connection with database 7 | app.config['MONGO_URI']="mongodb://localhost:27017/shows_db" 8 | mongo = PyMongo(app) 9 | 10 | #connect to collection 11 | tv_shows = mongo.db.tv_shows 12 | 13 | #READ 14 | @app.route("/") 15 | def index(): 16 | #find all items in db and save to a variable 17 | all_shows = list(tv_shows.find()) 18 | 19 | return render_template('index.html',data=all_shows) 20 | 21 | if __name__ == "__main__": 22 | app.run(debug=True) 23 | -------------------------------------------------------------------------------- /course_material/week_23/pymongo_app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Flask Templates 7 | 8 | 9 | 10 |
11 | {% for item in data %} 12 |
13 |

{{ item.name }}

14 |
Number of Seasons: {{ item.seasons }}
15 |

Show Duration: {{ item.duration }}

16 |

Year: {{ item.year }}

17 |
18 | {% endfor %} 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /course_material/week_23/week 23 group exercise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_23/week 23 group exercise.pdf -------------------------------------------------------------------------------- /course_material/week_23/week_23_presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaunchCoderGirlSTL/Data-Science-Assignments/cb6a48a3bee01b7965b6fc9ab9c4e7ea0974bdf0/course_material/week_23/week_23_presentation.pptx -------------------------------------------------------------------------------- /etl_project/README.md: -------------------------------------------------------------------------------- 1 | # Project 2 2 | 3 | ## Due Wednesday, Jan 12th, 2022. Code reviews will occur on this day 4 | 5 | Extract, Transform, Load (ETL) is a data integration process used to store data in a database so it can be used 6 | by others and create consistent results for analysis. 7 | 8 | ## Requirements 9 | 10 | It is advised you use the same data source you used for your first project, but you are free to choose another API or data source. 11 | 12 | You will need to work in your team of 2-3 people to complete the following: 13 | 14 | 1. Create a data model with at least two tables in lucidchart. 15 | 16 | 2. Create a DDL for each table and execute it programatically. 17 | 18 | 3. Load your data using psycopg2 or another module. 19 | 20 | 4. Make sure your code and the steps you have taken to load your data into the database are clearly outlined. 21 | 22 | ## Deliverables 23 | 24 | You must submit a link to your group github repository with: 25 | 26 | 1. A jupyter notebook with all your ETL code in it. I suggest using psycopg2, but you are free to use any other libraries you find. 27 | 28 | 2. 5-10 SQL queries that highlight how your tables work and what they show. You must use at least three joins. Include a comment for each one indicating what it is doing. 29 | 30 | 3. A data model with the proper cardinality and degrees labeled and explained. 31 | 32 | 4. Be prepared to present on the process you went through. This should not take longer than 8 minutes. Your presentation will be in a code review, 33 | so please do not create a powerpoint. Instead, you will walk through what code things you learned when working on this project. Do NOT simply go through all your code in an exhaustive manner. 34 | 35 | 36 | ### Guidelines for your notebook: 37 | 38 | - Write up a summary of each step you have gone through using `markdown`. 39 | - Code should be neat and well documented 40 | - https://www.dataquest.io/blog/loading-data-into-postgres/ is a great resource to follow 41 | - Use a common repository for your team 42 | -------------------------------------------------------------------------------- /exploratory_data_analysis_project/README.md: -------------------------------------------------------------------------------- 1 | # Project 1 2 | 3 | ## Due Wednesday, November 10th, 2021. Presentations will occur on this day 4 | 5 | Exploratory data analysis is a data analysis approach that involves building an intuitive understanding 6 | of the dataset at hand. That is what you're being asked to do in this project! 7 | 8 | ## Requirements 9 | 10 | Please pick an API you will use for your analysis. Please choose from the following (I know these work and are good): 11 | 12 | 1. IEX stock/financial API- https://iexcloud.io/docs/api/ 13 | 2. Quandl stock/financial API - https://www.quandl.com/tools/api 14 | 3. NASA - https://api.nasa.gov/ 15 | 4. FDA Food Safery - https://open.fda.gov/data/caers/ 16 | 5. AudioDB Music API - https://www.theaudiodb.com/api_guide.php 17 | 6. FBI Crime Data API - https://crime-data-explorer.fr.cloud.gov/api 18 | 7. You are welcome to pick another API not listed here. Please reach out to your instructor to 19 | have that API approved 20 | 21 | You will need to work in your team of 2-3 people to complete the following: 22 | 23 | 1. Come up with at least one hypothesis or question about your data and no more than five. 24 | Example: What is the relationship between airline stocks and covid cases? 25 | 26 | 2. Store your data to check your hypothesis/answer your question(s) in one or more Pandas dataframes. 27 | Be concise and document your code clearly. 28 | 29 | 3. Create 2-3 visuals per hypothesis or question, and use basic statistics to explore your data. There is not only one right answer 30 | for how to explore your data. 31 | 32 | 4. Create a presentation that is 5-8 minutes, which explains your findings. You will be giving this presentation 33 | on the due date. 34 | 35 | ## Deliverables 36 | 37 | You must submit a link to your group github repository with: 38 | 39 | 1. A jupyter notebook with all your analysis and visualizations in it. 40 | 41 | 2. A ppt presentation with at least 4 slides and no more than 15. 42 | 43 | AND you will be presenting your PowerPoint presentation in 5-8 minutes on the due date. Longer presentations are not necessarily better. It **must** stay under 8 minutes. 44 | 45 | 46 | ### Guidelines for your notebook: 47 | 48 | - Write up an executive summary of your findings using `markdown`. 49 | - Use `markdown` throughout your notebook to tell the story of your data. 50 | - All graphs should have Titles, labels and matching color schemes where applicable. 51 | - Code should be neat and well documented. 52 | - Use different types of graphs 53 | -------------------------------------------------------------------------------- /final_project/README.md: -------------------------------------------------------------------------------- 1 | # Final Project 2 | 3 | ## Due Wednesday, March 9th, 2022. Presentations will occur on this day 4 | 5 | You will be highlighting everything you have learned during this course in the final presentation. You can make 6 | this project an extension of your other projects, but you do not have to. You are probably tired of exploring 7 | that same data, so it is advised you choose another data source. However, a new dataset is not required. 8 | 9 | You will be picking your own teammates for this project. You certainly can work with the same person or people you worked 10 | with before, but you may have found others you would like to try working with. 11 | 12 | ## Requirements 13 | 14 | You will need to work in your team of 2-3 people to complete the following: 15 | 16 | 1. Use an api or other data source to present at least two and no more than five advanced data science techniques including supervised, 17 | unsupervised, or reinforced learning techniques we either have or have not discussed in class. These should have high performance (>80% precision and recall, or related performance metric). 18 | If not, you need to enhance your preprocessing, clean your data better, or utilize one of the other techniques we have discussed. You are free to use techniques we have not discussed, 19 | as well. 20 | - you will likely need to create some visuals to understand your data before you dive into creating models. It may or may not make sense to include those visuals in your presentation. 21 | 2. Store the data you are using for your analysis in a database and use ETL to get it there. Create a data model. You are welcome to try using a cloud database to store your data, but you do not have to. 22 | 3. Create a presentation of no more than 30 slides with your findings. 23 | 4. Plan to share your model code in your presentation and make sure your code and explanations are as clean as possible. 24 | - This project is focused on the models themselves, so you dont need to share ETL code in your presentation. In fact, please DO NOT unless there is a good reason to do so. 25 | 5. Be prepared to give a 10-15 minute presentation. Do NOT go over 15 minutes. This is also an exercise in planning! 26 | 27 | 28 | ## Deliverables 29 | 30 | You must submit a link to your group github repository with: 31 | 32 | 1. A jupyter notebook with all your code in it. 33 | 2. A data model of the data stored in your database and a separate notebook or script with the ETL. 34 | 3. A readme.md file in your repo that clearly outlines the techniques used and findings. 35 | 4. A presentation that tells the story of your data and what you are predicting. 36 | 5. Be prepared to give your presentation. This is strictly timeboxed at 15 minutes. 37 | 38 | 39 | ### Guidelines for your notebook: 40 | - Make sure much of your code is stored in functions. Try to transition out of the script mentality and more to reusable code. 41 | - Be careful to clearly show steps for preprocessing, training, validating, and predicting. 42 | - Make sure you are not overfitting or underfitting your model. Specify how you know. 43 | - Write up a summary of each step you have gone through using `markdown`. 44 | - Code should be neat and well documented 45 | - Use a common repository for your team 46 | --------------------------------------------------------------------------------