├── 01_Getting_&_Knowing_Your_Data ├── Chipotle │ ├── Exercise_with_Solutions.ipynb │ ├── Exercises.ipynb │ ├── Solutions.ipynb │ └── chipotle.csv └── Occupation │ ├── Exercise_with_Solution.ipynb │ ├── Exercises.ipynb │ ├── Solutions.ipynb │ └── user.csv ├── 02_Filtering_&_Sorting ├── Chipotle │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ ├── Solutions.ipynb │ └── chipotle.csv ├── Euro12 │ ├── Euro_2012_stats_TEAM.csv │ ├── Exercises.ipynb │ ├── Exercises_with_Solutions.ipynb │ └── Solutions.ipynb └── Fictional Army │ ├── Exercise.ipynb │ ├── Exercise_with_solutions.ipynb │ └── Solutions.ipynb ├── 03_Grouping ├── Alcohol_Consumption │ ├── Exercise.ipynb │ ├── Exercise_with_solutions.ipynb │ ├── Solutions.ipynb │ └── drinks.csv ├── Occupation │ ├── Exercise.ipynb │ ├── Exercises_with_solutions.ipynb │ ├── Solutions.ipynb │ ├── u.user │ └── user.csv └── Regiment │ ├── Exercises.ipynb │ ├── Exercises_solutions.ipynb │ └── Solutions.ipynb ├── 04_Apply ├── Students_Alcohol_Consumption │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ ├── Solutions.ipynb │ └── student-mat.csv └── US_Crime_Rates │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ ├── Solutions.ipynb │ └── US_Crime_Rates_1960_2014.csv ├── 05_Merge ├── Auto_MPG │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ ├── Solutions.ipynb │ ├── cars1.csv │ └── cars2.csv ├── Fictitous Names │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ └── Solutions.ipynb └── Housing Market │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ └── Solutions.ipynb ├── 06_Stats └── US_Baby_Names │ ├── Exercises.ipynb │ ├── Exercises_with_solutions.ipynb │ └── Solutions.ipynb ├── 07_Visualization ├── Chipotle │ ├── Exercise_with_Solutions.ipynb │ ├── Exercises.ipynb │ └── Solutions.ipynb └── Online_Retail │ ├── Exercises.ipynb │ └── Exercises_with_solutions_code.ipynb ├── 08_Creating_Series_and_DataFrames └── Pokemon │ ├── Exercises-with-solutions-and-code.ipynb │ ├── Exercises.ipynb │ └── Solutions.ipynb ├── 09_Time_Series ├── Apple_Stock │ ├── Exercises-with-solutions-code.ipynb │ ├── Exercises.ipynb │ ├── Solutions.ipynb │ └── appl_1980_2014.csv └── Investor_Flow_of_Funds_US │ ├── Exercises.ipynb │ ├── Exercises_with_code_and_solutions.ipynb │ ├── Solutions.ipynb │ └── weekly.csv ├── 10_Deleting ├── Iris │ ├── Exercises.ipynb │ ├── Exercises_with_solutions_and_code.ipynb │ ├── Solutions.ipynb │ └── iris.data └── Wine │ ├── Exercises.ipynb │ ├── Exercises_code_and_solutions.ipynb │ ├── Solutions.ipynb │ └── wine.data ├── 11_Indexing ├── Exercises.ipynb └── chipotle.csv ├── README.md └── dataset ├── Euro_2012_stats_TEAM.csv ├── US_Crime_Rates_1960_2014.csv ├── appl_1980_2014.csv ├── cars1.csv ├── cars2.csv ├── chipotle.csv ├── drinks.csv ├── iris.data ├── student-mat.csv ├── tips.csv ├── train.csv ├── user.csv ├── weekly.csv ├── wind.data └── wine.data /01_Getting_&_Knowing_Your_Data/Chipotle/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex2 - Getting and Knowing your Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "\n", 15 | "### Step 1. Import the necessary libraries" 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": 9, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "### Step 2. Import the dataset : chipotle.csv " 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "metadata": {}, 36 | "outputs": [], 37 | "source": [] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "### Step 3. Assign it to a variable called chipo." 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [] 52 | }, 53 | { 54 | "cell_type": "markdown", 55 | "metadata": {}, 56 | "source": [ 57 | "### Step 4. See the first 10 entries" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": null, 63 | "metadata": { 64 | "scrolled": false 65 | }, 66 | "outputs": [], 67 | "source": [] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "### Step 5. What is the number of observations in the dataset?" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 1, 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "# Solution 1\n", 83 | "\n" 84 | ] 85 | }, 86 | { 87 | "cell_type": "markdown", 88 | "metadata": {}, 89 | "source": [ 90 | "### Step 6. What is the number of columns in the dataset?" 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 | "### Step 7. Print the name of all the columns." 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": null, 110 | "metadata": {}, 111 | "outputs": [], 112 | "source": [] 113 | }, 114 | { 115 | "cell_type": "markdown", 116 | "metadata": {}, 117 | "source": [ 118 | "### Step 8. How is the dataset indexed?" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": null, 124 | "metadata": {}, 125 | "outputs": [], 126 | "source": [] 127 | }, 128 | { 129 | "cell_type": "markdown", 130 | "metadata": {}, 131 | "source": [ 132 | "### Step 9. Which was the most-ordered item? " 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": null, 138 | "metadata": {}, 139 | "outputs": [], 140 | "source": [] 141 | }, 142 | { 143 | "cell_type": "markdown", 144 | "metadata": {}, 145 | "source": [ 146 | "### Step 10. For the most-ordered item, how many items were ordered?" 147 | ] 148 | }, 149 | { 150 | "cell_type": "code", 151 | "execution_count": null, 152 | "metadata": {}, 153 | "outputs": [], 154 | "source": [] 155 | }, 156 | { 157 | "cell_type": "markdown", 158 | "metadata": {}, 159 | "source": [ 160 | "### Step 11. What was the most ordered item in the choice_description column?" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": null, 166 | "metadata": {}, 167 | "outputs": [], 168 | "source": [] 169 | }, 170 | { 171 | "cell_type": "markdown", 172 | "metadata": {}, 173 | "source": [ 174 | "### Step 12. How many items were orderd in total?" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": null, 180 | "metadata": {}, 181 | "outputs": [], 182 | "source": [] 183 | }, 184 | { 185 | "cell_type": "markdown", 186 | "metadata": {}, 187 | "source": [ 188 | "### Step 13. Turn the item price into a float" 189 | ] 190 | }, 191 | { 192 | "cell_type": "markdown", 193 | "metadata": {}, 194 | "source": [ 195 | "#### Step 13.a. Check the item price type" 196 | ] 197 | }, 198 | { 199 | "cell_type": "code", 200 | "execution_count": null, 201 | "metadata": {}, 202 | "outputs": [], 203 | "source": [] 204 | }, 205 | { 206 | "cell_type": "markdown", 207 | "metadata": {}, 208 | "source": [ 209 | "#### Step 13.b. Create a lambda function and change the type of item price" 210 | ] 211 | }, 212 | { 213 | "cell_type": "code", 214 | "execution_count": null, 215 | "metadata": { 216 | "collapsed": true 217 | }, 218 | "outputs": [], 219 | "source": [] 220 | }, 221 | { 222 | "cell_type": "markdown", 223 | "metadata": {}, 224 | "source": [ 225 | "#### Step 13.c. Check the item price type" 226 | ] 227 | }, 228 | { 229 | "cell_type": "code", 230 | "execution_count": null, 231 | "metadata": {}, 232 | "outputs": [], 233 | "source": [] 234 | }, 235 | { 236 | "cell_type": "markdown", 237 | "metadata": {}, 238 | "source": [ 239 | "### Step 14. How much was the revenue for the period in the dataset?" 240 | ] 241 | }, 242 | { 243 | "cell_type": "code", 244 | "execution_count": null, 245 | "metadata": {}, 246 | "outputs": [], 247 | "source": [] 248 | }, 249 | { 250 | "cell_type": "markdown", 251 | "metadata": {}, 252 | "source": [ 253 | "### Step 15. How many orders were made in the period?" 254 | ] 255 | }, 256 | { 257 | "cell_type": "code", 258 | "execution_count": null, 259 | "metadata": {}, 260 | "outputs": [], 261 | "source": [] 262 | }, 263 | { 264 | "cell_type": "markdown", 265 | "metadata": {}, 266 | "source": [ 267 | "### Step 16. What is the average revenue amount per order?" 268 | ] 269 | }, 270 | { 271 | "cell_type": "code", 272 | "execution_count": 3, 273 | "metadata": {}, 274 | "outputs": [], 275 | "source": [ 276 | "# Solution 1\n", 277 | "\n" 278 | ] 279 | }, 280 | { 281 | "cell_type": "markdown", 282 | "metadata": {}, 283 | "source": [ 284 | "### Step 17. How many different items are sold?" 285 | ] 286 | }, 287 | { 288 | "cell_type": "code", 289 | "execution_count": null, 290 | "metadata": {}, 291 | "outputs": [], 292 | "source": [] 293 | } 294 | ], 295 | "metadata": { 296 | "anaconda-cloud": {}, 297 | "kernelspec": { 298 | "display_name": "Python 3", 299 | "language": "python", 300 | "name": "python3" 301 | }, 302 | "language_info": { 303 | "codemirror_mode": { 304 | "name": "ipython", 305 | "version": 3 306 | }, 307 | "file_extension": ".py", 308 | "mimetype": "text/x-python", 309 | "name": "python", 310 | "nbconvert_exporter": "python", 311 | "pygments_lexer": "ipython3", 312 | "version": "3.7.6" 313 | } 314 | }, 315 | "nbformat": 4, 316 | "nbformat_minor": 1 317 | } 318 | -------------------------------------------------------------------------------- /01_Getting_&_Knowing_Your_Data/Occupation/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex3 - Getting and Knowing your Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "\n", 15 | "### Step 1. Import the necessary libraries" 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": null, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "### Step 2. Import the dataset : user.csv" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "metadata": {}, 36 | "outputs": [], 37 | "source": [] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "### Step 3. Assign it to a variable called users and use the 'user_id' as index" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [] 52 | }, 53 | { 54 | "cell_type": "markdown", 55 | "metadata": {}, 56 | "source": [ 57 | "### Step 4. See the first 25 entries" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": null, 63 | "metadata": { 64 | "scrolled": true 65 | }, 66 | "outputs": [], 67 | "source": [] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "### Step 5. See the last 10 entries" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": { 80 | "scrolled": true 81 | }, 82 | "outputs": [], 83 | "source": [] 84 | }, 85 | { 86 | "cell_type": "markdown", 87 | "metadata": {}, 88 | "source": [ 89 | "### Step 6. What is the number of observations in the dataset?" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": null, 95 | "metadata": {}, 96 | "outputs": [], 97 | "source": [] 98 | }, 99 | { 100 | "cell_type": "markdown", 101 | "metadata": {}, 102 | "source": [ 103 | "### Step 7. What is the number of columns in the dataset?" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "execution_count": null, 109 | "metadata": {}, 110 | "outputs": [], 111 | "source": [] 112 | }, 113 | { 114 | "cell_type": "markdown", 115 | "metadata": {}, 116 | "source": [ 117 | "### Step 8. Print the name of all the columns." 118 | ] 119 | }, 120 | { 121 | "cell_type": "code", 122 | "execution_count": null, 123 | "metadata": {}, 124 | "outputs": [], 125 | "source": [] 126 | }, 127 | { 128 | "cell_type": "markdown", 129 | "metadata": {}, 130 | "source": [ 131 | "### Step 9. How is the dataset indexed?" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": null, 137 | "metadata": {}, 138 | "outputs": [], 139 | "source": [] 140 | }, 141 | { 142 | "cell_type": "markdown", 143 | "metadata": {}, 144 | "source": [ 145 | "### Step 10. What is the data type of each column?" 146 | ] 147 | }, 148 | { 149 | "cell_type": "code", 150 | "execution_count": null, 151 | "metadata": {}, 152 | "outputs": [], 153 | "source": [] 154 | }, 155 | { 156 | "cell_type": "markdown", 157 | "metadata": {}, 158 | "source": [ 159 | "### Step 11. Print only the occupation column" 160 | ] 161 | }, 162 | { 163 | "cell_type": "code", 164 | "execution_count": null, 165 | "metadata": {}, 166 | "outputs": [], 167 | "source": [] 168 | }, 169 | { 170 | "cell_type": "markdown", 171 | "metadata": {}, 172 | "source": [ 173 | "### Step 12. How many different occupations are in this dataset?" 174 | ] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "execution_count": null, 179 | "metadata": {}, 180 | "outputs": [], 181 | "source": [] 182 | }, 183 | { 184 | "cell_type": "markdown", 185 | "metadata": {}, 186 | "source": [ 187 | "### Step 13. What is the most frequent occupation?" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": null, 193 | "metadata": {}, 194 | "outputs": [], 195 | "source": [] 196 | }, 197 | { 198 | "cell_type": "markdown", 199 | "metadata": {}, 200 | "source": [ 201 | "### Step 14. Summarize the DataFrame." 202 | ] 203 | }, 204 | { 205 | "cell_type": "code", 206 | "execution_count": null, 207 | "metadata": {}, 208 | "outputs": [], 209 | "source": [] 210 | }, 211 | { 212 | "cell_type": "markdown", 213 | "metadata": {}, 214 | "source": [ 215 | "### Step 15. Summarize all the columns" 216 | ] 217 | }, 218 | { 219 | "cell_type": "code", 220 | "execution_count": null, 221 | "metadata": {}, 222 | "outputs": [], 223 | "source": [] 224 | }, 225 | { 226 | "cell_type": "markdown", 227 | "metadata": {}, 228 | "source": [ 229 | "### Step 16. Summarize only the occupation column" 230 | ] 231 | }, 232 | { 233 | "cell_type": "code", 234 | "execution_count": null, 235 | "metadata": {}, 236 | "outputs": [], 237 | "source": [] 238 | }, 239 | { 240 | "cell_type": "markdown", 241 | "metadata": {}, 242 | "source": [ 243 | "### Step 17. What is the mean age of users?" 244 | ] 245 | }, 246 | { 247 | "cell_type": "code", 248 | "execution_count": null, 249 | "metadata": {}, 250 | "outputs": [], 251 | "source": [] 252 | }, 253 | { 254 | "cell_type": "markdown", 255 | "metadata": {}, 256 | "source": [ 257 | "### Step 18. What is the age with least occurrence?" 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": null, 263 | "metadata": {}, 264 | "outputs": [], 265 | "source": [] 266 | } 267 | ], 268 | "metadata": { 269 | "anaconda-cloud": {}, 270 | "kernelspec": { 271 | "display_name": "Python 3", 272 | "language": "python", 273 | "name": "python3" 274 | }, 275 | "language_info": { 276 | "codemirror_mode": { 277 | "name": "ipython", 278 | "version": 3 279 | }, 280 | "file_extension": ".py", 281 | "mimetype": "text/x-python", 282 | "name": "python", 283 | "nbconvert_exporter": "python", 284 | "pygments_lexer": "ipython3", 285 | "version": "3.7.6" 286 | } 287 | }, 288 | "nbformat": 4, 289 | "nbformat_minor": 1 290 | } 291 | -------------------------------------------------------------------------------- /02_Filtering_&_Sorting/Chipotle/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex1 - Filtering and Sorting Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : chipotle.csv " 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called chipo." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. How many products cost more than $10.00?" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. What is the price of each item? \n", 71 | "###### print a data frame with only two columns item_name and item_price" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": null, 77 | "metadata": {}, 78 | "outputs": [], 79 | "source": [] 80 | }, 81 | { 82 | "cell_type": "markdown", 83 | "metadata": {}, 84 | "source": [ 85 | "### Step 6. Sort by the name of the item" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": null, 91 | "metadata": {}, 92 | "outputs": [], 93 | "source": [] 94 | }, 95 | { 96 | "cell_type": "markdown", 97 | "metadata": {}, 98 | "source": [ 99 | "### Step 7. What was the quantity of the most expensive item ordered?" 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": null, 105 | "metadata": {}, 106 | "outputs": [], 107 | "source": [] 108 | }, 109 | { 110 | "cell_type": "markdown", 111 | "metadata": {}, 112 | "source": [ 113 | "### Step 8. How many times was a Veggie Salad Bowl ordered?" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": null, 119 | "metadata": {}, 120 | "outputs": [], 121 | "source": [] 122 | }, 123 | { 124 | "cell_type": "markdown", 125 | "metadata": {}, 126 | "source": [ 127 | "### Step 9. How many times did someone order more than one Canned Soda?" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": null, 133 | "metadata": {}, 134 | "outputs": [], 135 | "source": [] 136 | } 137 | ], 138 | "metadata": { 139 | "kernelspec": { 140 | "display_name": "Python 3", 141 | "language": "python", 142 | "name": "python3" 143 | }, 144 | "language_info": { 145 | "codemirror_mode": { 146 | "name": "ipython", 147 | "version": 3 148 | }, 149 | "file_extension": ".py", 150 | "mimetype": "text/x-python", 151 | "name": "python", 152 | "nbconvert_exporter": "python", 153 | "pygments_lexer": "ipython3", 154 | "version": "3.7.6" 155 | } 156 | }, 157 | "nbformat": 4, 158 | "nbformat_minor": 1 159 | } 160 | -------------------------------------------------------------------------------- /02_Filtering_&_Sorting/Euro12/Euro_2012_stats_TEAM.csv: -------------------------------------------------------------------------------- 1 | ,Team,Goals,Shots on target,Shots off target,Shooting Accuracy,% Goals-to-shots,Total shots (inc. Blocked),Hit Woodwork,Penalty goals,Penalties not scored,Headed goals,Passes,Passes completed,Passing Accuracy,Touches,Crosses,Dribbles,Corners Taken,Tackles,Clearances,Interceptions,Clearances off line,Clean Sheets,Blocks,Goals conceded,Saves made,Saves-to-shots ratio,Fouls Won,Fouls Conceded,Offsides,Yellow Cards,Red Cards,Subs on,Subs off,Players Used 2 | 0,Croatia,4,13,12,51.9%,16.0%,32,0,0,0,2,1076,828,76.9%,1706,60,42,14,49,83,56,,0,10,3,13,81.3%,41,62,2,9,0,9,9,16 3 | 1,Czech Republic,4,13,18,41.9%,12.9%,39,0,0,0,0,1565,1223,78.1%,2358,46,68,21,62,98,37,2.0,1,10,6,9,60.1%,53,73,8,7,0,11,11,19 4 | 2,Denmark,4,10,10,50.0%,20.0%,27,1,0,0,3,1298,1082,83.3%,1873,43,32,16,40,61,59,0.0,1,10,5,10,66.7%,25,38,8,4,0,7,7,15 5 | 3,England,5,11,18,50.0%,17.2%,40,0,0,0,3,1488,1200,80.6%,2440,58,60,16,86,106,72,1.0,2,29,3,22,88.1%,43,45,6,5,0,11,11,16 6 | 4,France,3,22,24,37.9%,6.5%,65,1,0,0,0,2066,1803,87.2%,2909,55,76,28,71,76,58,0.0,1,7,5,6,54.6%,36,51,5,6,0,11,11,19 7 | 5,Germany,10,32,32,47.8%,15.6%,80,2,1,0,2,2774,2427,87.4%,3761,101,60,35,91,73,69,0.0,1,11,6,10,62.6%,63,49,12,4,0,15,15,17 8 | 6,Greece,5,8,18,30.7%,19.2%,32,1,1,1,0,1187,911,76.7%,2016,52,53,10,65,123,87,0.0,1,23,7,13,65.1%,67,48,12,9,1,12,12,20 9 | 7,Italy,6,34,45,43.0%,7.5%,110,2,0,0,2,3016,2531,83.9%,4363,75,75,30,98,137,136,1.0,2,18,7,20,74.1%,101,89,16,16,0,18,18,19 10 | 8,Netherlands,2,12,36,25.0%,4.1%,60,2,0,0,0,1556,1381,88.7%,2163,50,49,22,34,41,41,0.0,0,9,5,12,70.6%,35,30,3,5,0,7,7,15 11 | 9,Poland,2,15,23,39.4%,5.2%,48,0,0,0,1,1059,852,80.4%,1724,55,39,14,67,87,62,0.0,0,8,3,6,66.7%,48,56,3,7,1,7,7,17 12 | 10,Portugal,6,22,42,34.3%,9.3%,82,6,0,0,2,1891,1461,77.2%,2958,91,64,41,78,92,86,0.0,2,11,4,10,71.5%,73,90,10,12,0,14,14,16 13 | 11,Republic of Ireland,1,7,12,36.8%,5.2%,28,0,0,0,1,851,606,71.2%,1433,43,18,8,45,78,43,1.0,0,23,9,17,65.4%,43,51,11,6,1,10,10,17 14 | 12,Russia,5,9,31,22.5%,12.5%,59,2,0,0,1,1602,1345,83.9%,2278,40,40,21,65,74,58,0.0,0,8,3,10,77.0%,34,43,4,6,0,7,7,16 15 | 13,Spain,12,42,33,55.9%,16.0%,100,0,1,0,2,4317,3820,88.4%,5585,69,106,44,122,102,79,0.0,5,8,1,15,93.8%,102,83,19,11,0,17,17,18 16 | 14,Sweden,5,17,19,47.2%,13.8%,39,3,0,0,1,1192,965,80.9%,1806,44,29,7,56,54,45,0.0,1,12,5,8,61.6%,35,51,7,7,0,9,9,18 17 | 15,Ukraine,2,7,26,21.2%,6.0%,38,0,0,0,2,1276,1043,81.7%,1894,33,26,18,65,97,29,0.0,0,4,4,13,76.5%,48,31,4,5,0,9,9,18 18 | -------------------------------------------------------------------------------- /02_Filtering_&_Sorting/Euro12/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex2 - Filtering and Sorting Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : Euro_2012_stats_TEAM.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called euro12." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. Select only the Goal column." 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. How many team participated in the Euro2012?" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. What is the number of columns in the dataset?" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. View only the columns Team, Yellow Cards and Red Cards and assign them to a dataframe called discipline" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. Sort the teams by Red Cards, then to Yellow Cards" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": { 119 | "scrolled": true 120 | }, 121 | "outputs": [], 122 | "source": [] 123 | }, 124 | { 125 | "cell_type": "markdown", 126 | "metadata": {}, 127 | "source": [ 128 | "### Step 9. Calculate the mean Yellow Cards given per Team" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": null, 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [] 137 | }, 138 | { 139 | "cell_type": "markdown", 140 | "metadata": {}, 141 | "source": [ 142 | "### Step 10. Filter teams that scored more than 6 goals" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": null, 148 | "metadata": {}, 149 | "outputs": [], 150 | "source": [] 151 | }, 152 | { 153 | "cell_type": "markdown", 154 | "metadata": {}, 155 | "source": [ 156 | "### Step 11. Select the teams that start with G" 157 | ] 158 | }, 159 | { 160 | "cell_type": "code", 161 | "execution_count": null, 162 | "metadata": {}, 163 | "outputs": [], 164 | "source": [] 165 | }, 166 | { 167 | "cell_type": "markdown", 168 | "metadata": {}, 169 | "source": [ 170 | "### Step 12. Select the first 7 columns" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": null, 176 | "metadata": {}, 177 | "outputs": [], 178 | "source": [] 179 | }, 180 | { 181 | "cell_type": "markdown", 182 | "metadata": {}, 183 | "source": [ 184 | "### Step 13. Select all columns except the last 3." 185 | ] 186 | }, 187 | { 188 | "cell_type": "code", 189 | "execution_count": null, 190 | "metadata": {}, 191 | "outputs": [], 192 | "source": [] 193 | }, 194 | { 195 | "cell_type": "markdown", 196 | "metadata": {}, 197 | "source": [ 198 | "### Step 14. Present only the Shooting Accuracy from England, Italy and Russia" 199 | ] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": null, 204 | "metadata": {}, 205 | "outputs": [], 206 | "source": [] 207 | } 208 | ], 209 | "metadata": { 210 | "anaconda-cloud": {}, 211 | "kernelspec": { 212 | "display_name": "Python 3", 213 | "language": "python", 214 | "name": "python3" 215 | }, 216 | "language_info": { 217 | "codemirror_mode": { 218 | "name": "ipython", 219 | "version": 3 220 | }, 221 | "file_extension": ".py", 222 | "mimetype": "text/x-python", 223 | "name": "python", 224 | "nbconvert_exporter": "python", 225 | "pygments_lexer": "ipython3", 226 | "version": "3.7.6" 227 | } 228 | }, 229 | "nbformat": 4, 230 | "nbformat_minor": 1 231 | } 232 | -------------------------------------------------------------------------------- /02_Filtering_&_Sorting/Fictional Army/Exercise.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Fictional Army - Filtering and Sorting" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. This is the data given as a dictionary" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 4, 34 | "metadata": { 35 | "collapsed": true 36 | }, 37 | "outputs": [], 38 | "source": [ 39 | "# Create an example dataframe about a fictional army\n", 40 | "raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Dragoons', 'Dragoons', 'Scouts', 'Scouts', 'Scouts', 'Scouts'],\n", 41 | " 'company': ['1st', '1st', '2nd', '2nd', '1st', '1st', '2nd', '2nd','1st', '1st', '2nd', '2nd'],\n", 42 | " 'deaths': [523, 52, 25, 616, 43, 234, 523, 62, 62, 73, 37, 35],\n", 43 | " 'battles': [5, 42, 2, 2, 4, 7, 8, 3, 4, 7, 8, 9],\n", 44 | " 'size': [1045, 957, 1099, 1400, 1592, 1006, 987, 849, 973, 1005, 1099, 1523],\n", 45 | " 'veterans': [1, 5, 62, 26, 73, 37, 949, 48, 48, 435, 63, 345],\n", 46 | " 'readiness': [1, 2, 3, 3, 2, 1, 2, 3, 2, 1, 2, 3],\n", 47 | " 'armored': [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1],\n", 48 | " 'deserters': [4, 24, 31, 2, 3, 4, 24, 31, 2, 3, 2, 3],\n", 49 | " 'origin': ['Arizona', 'California', 'Texas', 'Florida', 'Maine', 'Iowa', 'Alaska', 'Washington', 'Oregon', 'Wyoming', 'Louisana', 'Georgia']}" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 3. Create a dataframe and assign it to a variable called army. \n", 57 | "\n", 58 | "#### Don't forget to include the columns names in the order presented in the dictionary ('regiment', 'company', 'deaths'...) so that the column index order is consistent with the solutions. If omitted, pandas will order the columns alphabetically." 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "### Step 4. Set the 'origin' colum as the index of the dataframe" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Step 5. Print only the column veterans" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": {}, 99 | "source": [ 100 | "### Step 6. Print the columns 'veterans' and 'deaths'" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": null, 106 | "metadata": {}, 107 | "outputs": [], 108 | "source": [] 109 | }, 110 | { 111 | "cell_type": "markdown", 112 | "metadata": {}, 113 | "source": [ 114 | "### Step 7. Print the name of all the columns." 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [] 123 | }, 124 | { 125 | "cell_type": "markdown", 126 | "metadata": {}, 127 | "source": [ 128 | "### Step 8. Select the 'deaths', 'size' and 'deserters' columns from Maine and Alaska" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": null, 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [] 137 | }, 138 | { 139 | "cell_type": "markdown", 140 | "metadata": {}, 141 | "source": [ 142 | "### Step 9. Select the rows 3 to 7 and the columns 3 to 6" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": null, 148 | "metadata": {}, 149 | "outputs": [], 150 | "source": [] 151 | }, 152 | { 153 | "cell_type": "markdown", 154 | "metadata": {}, 155 | "source": [ 156 | "### Step 10. Select every row after the fourth row and all columns" 157 | ] 158 | }, 159 | { 160 | "cell_type": "code", 161 | "execution_count": null, 162 | "metadata": {}, 163 | "outputs": [], 164 | "source": [] 165 | }, 166 | { 167 | "cell_type": "markdown", 168 | "metadata": {}, 169 | "source": [ 170 | "### Step 11. Select every row up to the 4th row and all columns" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": null, 176 | "metadata": {}, 177 | "outputs": [], 178 | "source": [] 179 | }, 180 | { 181 | "cell_type": "markdown", 182 | "metadata": {}, 183 | "source": [ 184 | "### Step 12. Select the 3rd column up to the 7th column" 185 | ] 186 | }, 187 | { 188 | "cell_type": "code", 189 | "execution_count": null, 190 | "metadata": {}, 191 | "outputs": [], 192 | "source": [] 193 | }, 194 | { 195 | "cell_type": "markdown", 196 | "metadata": {}, 197 | "source": [ 198 | "### Step 13. Select rows where df.deaths is greater than 50" 199 | ] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": null, 204 | "metadata": {}, 205 | "outputs": [], 206 | "source": [] 207 | }, 208 | { 209 | "cell_type": "markdown", 210 | "metadata": {}, 211 | "source": [ 212 | "### Step 14. Select rows where df.deaths is greater than 500 or less than 50" 213 | ] 214 | }, 215 | { 216 | "cell_type": "code", 217 | "execution_count": null, 218 | "metadata": {}, 219 | "outputs": [], 220 | "source": [] 221 | }, 222 | { 223 | "cell_type": "markdown", 224 | "metadata": {}, 225 | "source": [ 226 | "### Step 15. Select all the regiments not named \"Dragoons\"" 227 | ] 228 | }, 229 | { 230 | "cell_type": "code", 231 | "execution_count": null, 232 | "metadata": {}, 233 | "outputs": [], 234 | "source": [] 235 | }, 236 | { 237 | "cell_type": "markdown", 238 | "metadata": {}, 239 | "source": [ 240 | "### Step 16. Select the rows called Texas and Arizona" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": null, 246 | "metadata": {}, 247 | "outputs": [], 248 | "source": [] 249 | }, 250 | { 251 | "cell_type": "markdown", 252 | "metadata": {}, 253 | "source": [ 254 | "### Step 17. Select the third cell in the row named Arizona" 255 | ] 256 | }, 257 | { 258 | "cell_type": "code", 259 | "execution_count": null, 260 | "metadata": {}, 261 | "outputs": [], 262 | "source": [] 263 | }, 264 | { 265 | "cell_type": "markdown", 266 | "metadata": {}, 267 | "source": [ 268 | "### Step 18. Select the third cell down in the column named deaths" 269 | ] 270 | }, 271 | { 272 | "cell_type": "code", 273 | "execution_count": null, 274 | "metadata": {}, 275 | "outputs": [], 276 | "source": [] 277 | } 278 | ], 279 | "metadata": { 280 | "kernelspec": { 281 | "display_name": "Python 3", 282 | "language": "python", 283 | "name": "python3" 284 | }, 285 | "language_info": { 286 | "codemirror_mode": { 287 | "name": "ipython", 288 | "version": 3 289 | }, 290 | "file_extension": ".py", 291 | "mimetype": "text/x-python", 292 | "name": "python", 293 | "nbconvert_exporter": "python", 294 | "pygments_lexer": "ipython3", 295 | "version": "3.7.6" 296 | } 297 | }, 298 | "nbformat": 4, 299 | "nbformat_minor": 1 300 | } 301 | -------------------------------------------------------------------------------- /03_Grouping/Alcohol_Consumption/Exercise.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex - GroupBy" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. make dataframe : drinks.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called drinks." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. Which continent drinks more beer on average?" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. For each continent print the statistics for wine consumption." 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. Print the mean alcohol consumption per continent for every column" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. Print the median alcohol consumption per continent for every column" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. Print the mean, min and max values for spirit consumption.\n", 113 | "#### This time output a DataFrame" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": null, 119 | "metadata": {}, 120 | "outputs": [], 121 | "source": [] 122 | } 123 | ], 124 | "metadata": { 125 | "kernelspec": { 126 | "display_name": "Python 3", 127 | "language": "python", 128 | "name": "python3" 129 | }, 130 | "language_info": { 131 | "codemirror_mode": { 132 | "name": "ipython", 133 | "version": 3 134 | }, 135 | "file_extension": ".py", 136 | "mimetype": "text/x-python", 137 | "name": "python", 138 | "nbconvert_exporter": "python", 139 | "pygments_lexer": "ipython3", 140 | "version": "3.7.6" 141 | } 142 | }, 143 | "nbformat": 4, 144 | "nbformat_minor": 1 145 | } 146 | -------------------------------------------------------------------------------- /03_Grouping/Alcohol_Consumption/drinks.csv: -------------------------------------------------------------------------------- 1 | country,beer_servings,spirit_servings,wine_servings,total_litres_of_pure_alcohol,continent 2 | Afghanistan,0,0,0,0.0,AS 3 | Albania,89,132,54,4.9,EU 4 | Algeria,25,0,14,0.7,AF 5 | Andorra,245,138,312,12.4,EU 6 | Angola,217,57,45,5.9,AF 7 | Antigua & Barbuda,102,128,45,4.9, 8 | Argentina,193,25,221,8.3,SA 9 | Armenia,21,179,11,3.8,EU 10 | Australia,261,72,212,10.4,OC 11 | Austria,279,75,191,9.7,EU 12 | Azerbaijan,21,46,5,1.3,EU 13 | Bahamas,122,176,51,6.3, 14 | Bahrain,42,63,7,2.0,AS 15 | Bangladesh,0,0,0,0.0,AS 16 | Barbados,143,173,36,6.3, 17 | Belarus,142,373,42,14.4,EU 18 | Belgium,295,84,212,10.5,EU 19 | Belize,263,114,8,6.8, 20 | Benin,34,4,13,1.1,AF 21 | Bhutan,23,0,0,0.4,AS 22 | Bolivia,167,41,8,3.8,SA 23 | Bosnia-Herzegovina,76,173,8,4.6,EU 24 | Botswana,173,35,35,5.4,AF 25 | Brazil,245,145,16,7.2,SA 26 | Brunei,31,2,1,0.6,AS 27 | Bulgaria,231,252,94,10.3,EU 28 | Burkina Faso,25,7,7,4.3,AF 29 | Burundi,88,0,0,6.3,AF 30 | Cote d'Ivoire,37,1,7,4.0,AF 31 | Cabo Verde,144,56,16,4.0,AF 32 | Cambodia,57,65,1,2.2,AS 33 | Cameroon,147,1,4,5.8,AF 34 | Canada,240,122,100,8.2, 35 | Central African Republic,17,2,1,1.8,AF 36 | Chad,15,1,1,0.4,AF 37 | Chile,130,124,172,7.6,SA 38 | China,79,192,8,5.0,AS 39 | Colombia,159,76,3,4.2,SA 40 | Comoros,1,3,1,0.1,AF 41 | Congo,76,1,9,1.7,AF 42 | Cook Islands,0,254,74,5.9,OC 43 | Costa Rica,149,87,11,4.4, 44 | Croatia,230,87,254,10.2,EU 45 | Cuba,93,137,5,4.2, 46 | Cyprus,192,154,113,8.2,EU 47 | Czech Republic,361,170,134,11.8,EU 48 | North Korea,0,0,0,0.0,AS 49 | DR Congo,32,3,1,2.3,AF 50 | Denmark,224,81,278,10.4,EU 51 | Djibouti,15,44,3,1.1,AF 52 | Dominica,52,286,26,6.6, 53 | Dominican Republic,193,147,9,6.2, 54 | Ecuador,162,74,3,4.2,SA 55 | Egypt,6,4,1,0.2,AF 56 | El Salvador,52,69,2,2.2, 57 | Equatorial Guinea,92,0,233,5.8,AF 58 | Eritrea,18,0,0,0.5,AF 59 | Estonia,224,194,59,9.5,EU 60 | Ethiopia,20,3,0,0.7,AF 61 | Fiji,77,35,1,2.0,OC 62 | Finland,263,133,97,10.0,EU 63 | France,127,151,370,11.8,EU 64 | Gabon,347,98,59,8.9,AF 65 | Gambia,8,0,1,2.4,AF 66 | Georgia,52,100,149,5.4,EU 67 | Germany,346,117,175,11.3,EU 68 | Ghana,31,3,10,1.8,AF 69 | Greece,133,112,218,8.3,EU 70 | Grenada,199,438,28,11.9, 71 | Guatemala,53,69,2,2.2, 72 | Guinea,9,0,2,0.2,AF 73 | Guinea-Bissau,28,31,21,2.5,AF 74 | Guyana,93,302,1,7.1,SA 75 | Haiti,1,326,1,5.9, 76 | Honduras,69,98,2,3.0, 77 | Hungary,234,215,185,11.3,EU 78 | Iceland,233,61,78,6.6,EU 79 | India,9,114,0,2.2,AS 80 | Indonesia,5,1,0,0.1,AS 81 | Iran,0,0,0,0.0,AS 82 | Iraq,9,3,0,0.2,AS 83 | Ireland,313,118,165,11.4,EU 84 | Israel,63,69,9,2.5,AS 85 | Italy,85,42,237,6.5,EU 86 | Jamaica,82,97,9,3.4, 87 | Japan,77,202,16,7.0,AS 88 | Jordan,6,21,1,0.5,AS 89 | Kazakhstan,124,246,12,6.8,AS 90 | Kenya,58,22,2,1.8,AF 91 | Kiribati,21,34,1,1.0,OC 92 | Kuwait,0,0,0,0.0,AS 93 | Kyrgyzstan,31,97,6,2.4,AS 94 | Laos,62,0,123,6.2,AS 95 | Latvia,281,216,62,10.5,EU 96 | Lebanon,20,55,31,1.9,AS 97 | Lesotho,82,29,0,2.8,AF 98 | Liberia,19,152,2,3.1,AF 99 | Libya,0,0,0,0.0,AF 100 | Lithuania,343,244,56,12.9,EU 101 | Luxembourg,236,133,271,11.4,EU 102 | Madagascar,26,15,4,0.8,AF 103 | Malawi,8,11,1,1.5,AF 104 | Malaysia,13,4,0,0.3,AS 105 | Maldives,0,0,0,0.0,AS 106 | Mali,5,1,1,0.6,AF 107 | Malta,149,100,120,6.6,EU 108 | Marshall Islands,0,0,0,0.0,OC 109 | Mauritania,0,0,0,0.0,AF 110 | Mauritius,98,31,18,2.6,AF 111 | Mexico,238,68,5,5.5, 112 | Micronesia,62,50,18,2.3,OC 113 | Monaco,0,0,0,0.0,EU 114 | Mongolia,77,189,8,4.9,AS 115 | Montenegro,31,114,128,4.9,EU 116 | Morocco,12,6,10,0.5,AF 117 | Mozambique,47,18,5,1.3,AF 118 | Myanmar,5,1,0,0.1,AS 119 | Namibia,376,3,1,6.8,AF 120 | Nauru,49,0,8,1.0,OC 121 | Nepal,5,6,0,0.2,AS 122 | Netherlands,251,88,190,9.4,EU 123 | New Zealand,203,79,175,9.3,OC 124 | Nicaragua,78,118,1,3.5, 125 | Niger,3,2,1,0.1,AF 126 | Nigeria,42,5,2,9.1,AF 127 | Niue,188,200,7,7.0,OC 128 | Norway,169,71,129,6.7,EU 129 | Oman,22,16,1,0.7,AS 130 | Pakistan,0,0,0,0.0,AS 131 | Palau,306,63,23,6.9,OC 132 | Panama,285,104,18,7.2, 133 | Papua New Guinea,44,39,1,1.5,OC 134 | Paraguay,213,117,74,7.3,SA 135 | Peru,163,160,21,6.1,SA 136 | Philippines,71,186,1,4.6,AS 137 | Poland,343,215,56,10.9,EU 138 | Portugal,194,67,339,11.0,EU 139 | Qatar,1,42,7,0.9,AS 140 | South Korea,140,16,9,9.8,AS 141 | Moldova,109,226,18,6.3,EU 142 | Romania,297,122,167,10.4,EU 143 | Russian Federation,247,326,73,11.5,AS 144 | Rwanda,43,2,0,6.8,AF 145 | St. Kitts & Nevis,194,205,32,7.7, 146 | St. Lucia,171,315,71,10.1, 147 | St. Vincent & the Grenadines,120,221,11,6.3, 148 | Samoa,105,18,24,2.6,OC 149 | San Marino,0,0,0,0.0,EU 150 | Sao Tome & Principe,56,38,140,4.2,AF 151 | Saudi Arabia,0,5,0,0.1,AS 152 | Senegal,9,1,7,0.3,AF 153 | Serbia,283,131,127,9.6,EU 154 | Seychelles,157,25,51,4.1,AF 155 | Sierra Leone,25,3,2,6.7,AF 156 | Singapore,60,12,11,1.5,AS 157 | Slovakia,196,293,116,11.4,EU 158 | Slovenia,270,51,276,10.6,EU 159 | Solomon Islands,56,11,1,1.2,OC 160 | Somalia,0,0,0,0.0,AF 161 | South Africa,225,76,81,8.2,AF 162 | Spain,284,157,112,10.0,EU 163 | Sri Lanka,16,104,0,2.2,AS 164 | Sudan,8,13,0,1.7,AF 165 | Suriname,128,178,7,5.6,SA 166 | Swaziland,90,2,2,4.7,AF 167 | Sweden,152,60,186,7.2,EU 168 | Switzerland,185,100,280,10.2,EU 169 | Syria,5,35,16,1.0,AS 170 | Tajikistan,2,15,0,0.3,AS 171 | Thailand,99,258,1,6.4,AS 172 | Macedonia,106,27,86,3.9,EU 173 | Timor-Leste,1,1,4,0.1,AS 174 | Togo,36,2,19,1.3,AF 175 | Tonga,36,21,5,1.1,OC 176 | Trinidad & Tobago,197,156,7,6.4, 177 | Tunisia,51,3,20,1.3,AF 178 | Turkey,51,22,7,1.4,AS 179 | Turkmenistan,19,71,32,2.2,AS 180 | Tuvalu,6,41,9,1.0,OC 181 | Uganda,45,9,0,8.3,AF 182 | Ukraine,206,237,45,8.9,EU 183 | United Arab Emirates,16,135,5,2.8,AS 184 | United Kingdom,219,126,195,10.4,EU 185 | Tanzania,36,6,1,5.7,AF 186 | USA,249,158,84,8.7, 187 | Uruguay,115,35,220,6.6,SA 188 | Uzbekistan,25,101,8,2.4,AS 189 | Vanuatu,21,18,11,0.9,OC 190 | Venezuela,333,100,3,7.7,SA 191 | Vietnam,111,2,1,2.0,AS 192 | Yemen,6,0,0,0.1,AS 193 | Zambia,32,19,4,2.5,AF 194 | Zimbabwe,64,18,4,4.7,AF 195 | -------------------------------------------------------------------------------- /03_Grouping/Occupation/Exercise.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Occupation" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : user.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called users." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. Discover what is the mean age per occupation" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. Discover the Male ratio per occupation and sort it from the most to the least" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. For each occupation, calculate the minimum and maximum ages" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. For each combination of occupation and gender, calculate the mean age" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. For each occupation present the percentage of women and men" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [] 121 | } 122 | ], 123 | "metadata": { 124 | "kernelspec": { 125 | "display_name": "Python 3", 126 | "language": "python", 127 | "name": "python3" 128 | }, 129 | "language_info": { 130 | "codemirror_mode": { 131 | "name": "ipython", 132 | "version": 3 133 | }, 134 | "file_extension": ".py", 135 | "mimetype": "text/x-python", 136 | "name": "python", 137 | "nbconvert_exporter": "python", 138 | "pygments_lexer": "ipython3", 139 | "version": "3.7.6" 140 | } 141 | }, 142 | "nbformat": 4, 143 | "nbformat_minor": 1 144 | } 145 | -------------------------------------------------------------------------------- /03_Grouping/Regiment/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Regiment" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Create the DataFrame with the following values:" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 51, 34 | "metadata": { 35 | "collapsed": true 36 | }, 37 | "outputs": [], 38 | "source": [ 39 | "raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Dragoons', 'Dragoons', 'Scouts', 'Scouts', 'Scouts', 'Scouts'], \n", 40 | " 'company': ['1st', '1st', '2nd', '2nd', '1st', '1st', '2nd', '2nd','1st', '1st', '2nd', '2nd'], \n", 41 | " 'name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze', 'Jacon', 'Ryaner', 'Sone', 'Sloan', 'Piger', 'Riani', 'Ali'], \n", 42 | " 'preTestScore': [4, 24, 31, 2, 3, 4, 24, 31, 2, 3, 2, 3],\n", 43 | " 'postTestScore': [25, 94, 57, 62, 70, 25, 94, 57, 62, 70, 62, 70]}" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": {}, 49 | "source": [ 50 | "### Step 3. Assign it to a variable called regiment.\n", 51 | "#### Don't forget to name each column" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": null, 57 | "metadata": {}, 58 | "outputs": [], 59 | "source": [] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "metadata": {}, 64 | "source": [ 65 | "### Step 4. What is the mean preTestScore from the regiment Nighthawks? " 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": null, 71 | "metadata": {}, 72 | "outputs": [], 73 | "source": [] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "### Step 5. Present general statistics by company" 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": null, 85 | "metadata": {}, 86 | "outputs": [], 87 | "source": [] 88 | }, 89 | { 90 | "cell_type": "markdown", 91 | "metadata": {}, 92 | "source": [ 93 | "### Step 6. What is the mean of each company's preTestScore?" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": null, 99 | "metadata": {}, 100 | "outputs": [], 101 | "source": [] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "metadata": {}, 106 | "source": [ 107 | "### Step 7. Present the mean preTestScores grouped by regiment and company" 108 | ] 109 | }, 110 | { 111 | "cell_type": "code", 112 | "execution_count": null, 113 | "metadata": {}, 114 | "outputs": [], 115 | "source": [] 116 | }, 117 | { 118 | "cell_type": "markdown", 119 | "metadata": {}, 120 | "source": [ 121 | "### Step 8. Present the mean preTestScores grouped by regiment and company without heirarchical indexing" 122 | ] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "execution_count": null, 127 | "metadata": {}, 128 | "outputs": [], 129 | "source": [] 130 | }, 131 | { 132 | "cell_type": "markdown", 133 | "metadata": {}, 134 | "source": [ 135 | "### Step 9. Group the entire dataframe by regiment and company" 136 | ] 137 | }, 138 | { 139 | "cell_type": "code", 140 | "execution_count": null, 141 | "metadata": {}, 142 | "outputs": [], 143 | "source": [] 144 | }, 145 | { 146 | "cell_type": "markdown", 147 | "metadata": {}, 148 | "source": [ 149 | "### Step 10. What is the number of observations in each regiment and company" 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 | "### Step 11. Iterate over a group and print the name and the whole data from the regiment" 164 | ] 165 | }, 166 | { 167 | "cell_type": "code", 168 | "execution_count": null, 169 | "metadata": {}, 170 | "outputs": [], 171 | "source": [] 172 | } 173 | ], 174 | "metadata": { 175 | "kernelspec": { 176 | "display_name": "Python 3", 177 | "language": "python", 178 | "name": "python3" 179 | }, 180 | "language_info": { 181 | "codemirror_mode": { 182 | "name": "ipython", 183 | "version": 3 184 | }, 185 | "file_extension": ".py", 186 | "mimetype": "text/x-python", 187 | "name": "python", 188 | "nbconvert_exporter": "python", 189 | "pygments_lexer": "ipython3", 190 | "version": "3.7.6" 191 | } 192 | }, 193 | "nbformat": 4, 194 | "nbformat_minor": 1 195 | } 196 | -------------------------------------------------------------------------------- /04_Apply/Students_Alcohol_Consumption/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Student Alcohol Consumption" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : student-mat.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called df." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. For the purpose of this exercise slice the dataframe from 'school' until the 'guardian' column" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. Create a lambda function that will capitalize strings." 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. Capitalize both Mjob and Fjob" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. Print the last elements of the data set." 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. Did you notice the original dataframe is still lowercase? Why is that? Fix it and capitalize Mjob and Fjob." 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "### Step 9. Create a function called majority that returns a boolean value to a new column called legal_drinker (Consider majority as older than 17 years old)" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": null, 139 | "metadata": {}, 140 | "outputs": [], 141 | "source": [] 142 | }, 143 | { 144 | "cell_type": "markdown", 145 | "metadata": {}, 146 | "source": [ 147 | "### Step 10. Multiply every number of the dataset by 10. \n", 148 | "##### I know this makes no sense, don't forget it is just an exercise" 149 | ] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "execution_count": null, 154 | "metadata": {}, 155 | "outputs": [], 156 | "source": [] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": null, 161 | "metadata": {}, 162 | "outputs": [], 163 | "source": [] 164 | } 165 | ], 166 | "metadata": { 167 | "anaconda-cloud": {}, 168 | "kernelspec": { 169 | "display_name": "Python 3", 170 | "language": "python", 171 | "name": "python3" 172 | }, 173 | "language_info": { 174 | "codemirror_mode": { 175 | "name": "ipython", 176 | "version": 3 177 | }, 178 | "file_extension": ".py", 179 | "mimetype": "text/x-python", 180 | "name": "python", 181 | "nbconvert_exporter": "python", 182 | "pygments_lexer": "ipython3", 183 | "version": "3.7.6" 184 | } 185 | }, 186 | "nbformat": 4, 187 | "nbformat_minor": 1 188 | } 189 | -------------------------------------------------------------------------------- /04_Apply/US_Crime_Rates/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# United States - Crime Rates - 1960 - 2014" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : US_Crime_Rates_1960_2014.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called crime." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. What is the type of the columns?" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "##### Have you noticed that the type of Year is int64. But pandas has a different type to work with Time Series. Let's see it now.\n", 71 | "\n", 72 | "### Step 5. Convert the type of the column Year to datetime64" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Step 6. Set the Year column as the index of the dataframe" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": {}, 99 | "source": [ 100 | "### Step 7. Delete the Total column" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": null, 106 | "metadata": {}, 107 | "outputs": [], 108 | "source": [] 109 | }, 110 | { 111 | "cell_type": "markdown", 112 | "metadata": {}, 113 | "source": [ 114 | "### Step 8. Group the year by decades and sum the values\n", 115 | "\n", 116 | "#### Pay attention to the Population column number, summing this column is a mistake" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": null, 122 | "metadata": { 123 | "scrolled": true 124 | }, 125 | "outputs": [], 126 | "source": [] 127 | }, 128 | { 129 | "cell_type": "markdown", 130 | "metadata": {}, 131 | "source": [ 132 | "### Step 9. What is the most dangerous decade to live in the US?" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": null, 138 | "metadata": {}, 139 | "outputs": [], 140 | "source": [] 141 | } 142 | ], 143 | "metadata": { 144 | "anaconda-cloud": {}, 145 | "kernelspec": { 146 | "display_name": "Python 3", 147 | "language": "python", 148 | "name": "python3" 149 | }, 150 | "language_info": { 151 | "codemirror_mode": { 152 | "name": "ipython", 153 | "version": 3 154 | }, 155 | "file_extension": ".py", 156 | "mimetype": "text/x-python", 157 | "name": "python", 158 | "nbconvert_exporter": "python", 159 | "pygments_lexer": "ipython3", 160 | "version": "3.7.6" 161 | } 162 | }, 163 | "nbformat": 4, 164 | "nbformat_minor": 1 165 | } 166 | -------------------------------------------------------------------------------- /04_Apply/US_Crime_Rates/US_Crime_Rates_1960_2014.csv: -------------------------------------------------------------------------------- 1 | Year,Population,Total,Violent,Property,Murder,Forcible_Rape,Robbery,Aggravated_assault,Burglary,Larceny_Theft,Vehicle_Theft 1960,179323175,3384200,288460,3095700,9110,17190,107840,154320,912100,1855400,328200 1961,182992000,3488000,289390,3198600,8740,17220,106670,156760,949600,1913000,336000 1962,185771000,3752200,301510,3450700,8530,17550,110860,164570,994300,2089600,366800 1963,188483000,4109500,316970,3792500,8640,17650,116470,174210,1086400,2297800,408300 1964,191141000,4564600,364220,4200400,9360,21420,130390,203050,1213200,2514400,472800 1965,193526000,4739400,387390,4352000,9960,23410,138690,215330,1282500,2572600,496900 1966,195576000,5223500,430180,4793300,11040,25820,157990,235330,1410100,2822000,561200 1967,197457000,5903400,499930,5403500,12240,27620,202910,257160,1632100,3111600,659800 1968,199399000,6720200,595010,6125200,13800,31670,262840,286700,1858900,3482700,783600 1969,201385000,7410900,661870,6749000,14760,37170,298850,311090,1981900,3888600,878500 1970,203235298,8098000,738820,7359200,16000,37990,349860,334970,2205000,4225800,928400 1971,206212000,8588200,816500,7771700,17780,42260,387700,368760,2399300,4424200,948200 1972,208230000,8248800,834900,7413900,18670,46850,376290,393090,2375500,4151200,887200 1973,209851000,8718100,875910,7842200,19640,51400,384220,420650,2565500,4347900,928800 1974,211392000,10253400,974720,9278700,20710,55400,442400,456210,3039200,5262500,977100 1975,213124000,11292400,1039710,10252700,20510,56090,470500,492620,3265300,5977700,1009600 1976,214659000,11349700,1004210,10345500,18780,57080,427810,500530,3108700,6270800,966000 1977,216332000,10984500,1029580,9955000,19120,63500,412610,534350,3071500,5905700,977700 1978,218059000,11209000,1085550,10123400,19560,67610,426930,571460,3128300,5991000,1004100 1979,220099000,12249500,1208030,11041500,21460,76390,480700,629480,3327700,6601000,1112800 1980,225349264,13408300,1344520,12063700,23040,82990,565840,672650,3795200,7136900,1131700 1981,229146000,13423800,1361820,12061900,22520,82500,592910,663900,3779700,7194400,1087800 1982,231534000,12974400,1322390,11652000,21010,78770,553130,669480,3447100,7142500,1062400 1983,233981000,12108600,1258090,10850500,19310,78920,506570,653290,3129900,6712800,1007900 1984,236158000,11881800,1273280,10608500,18690,84230,485010,685350,2984400,6591900,1032200 1985,238740000,12431400,1328800,11102600,18980,88670,497870,723250,3073300,6926400,1102900 1986,240132887,13211869,1489169,11722700,20613,91459,542775,834322,3241410,7257153,1224137 1987,242282918,13508700,1483999,12024700,20096,91110,517704,855088,3236184,7499900,1288674 1988,245807000,13923100,1566220,12356900,20680,92490,542970,910090,3218100,7705900,1432900 1989,248239000,14251400,1646040,12605400,21500,94500,578330,951710,3168200,7872400,1564800 1990,248709873,14475600,1820130,12655500,23440,102560,639270,1054860,3073900,7945700,1635900 1991,252177000,14872900,1911770,12961100,24700,106590,687730,1092740,3157200,8142200,1661700 1992,255082000,14438200,1932270,12505900,23760,109060,672480,1126970,2979900,7915200,1610800 1993,257908000,14144800,1926020,12218800,24530,106010,659870,1135610,2834800,7820900,1563100 1994,260341000,13989500,1857670,12131900,23330,102220,618950,1113180,2712800,7879800,1539300 1995,262755000,13862700,1798790,12063900,21610,97470,580510,1099210,2593800,7997700,1472400 1996,265228572,13493863,1688540,11805300,19650,96250,535590,1037050,2506400,7904700,1394200 1997,267637000,13194571,1634770,11558175,18208,96153,498534,1023201,2460526,7743760,1354189 1998,270296000,12475634,1531044,10944590,16914,93103,446625,974402,2329950,7373886,1240754 1999,272690813,11634378,1426044,10208334,15522,89411,409371,911740,2100739,6955520,1152075 2000,281421906,11608072,1425486,10182586,15586,90178,408016,911706,2050992,6971590,1160002 2001,285317559,11876669,1439480,10437480,16037,90863,423557,909023,2116531,7092267,1228391 2002,287973924,11878954,1423677,10455277,16229,95235,420806,891407,2151252,7057370,1246646 2003,290690788,11826538,1383676,10442862,16528,93883,414235,859030,2154834,7026802,1261226 2004,293656842,11679474,1360088,10319386,16148,95089,401470,847381,2144446,6937089,1237851 2005,296507061,11565499,1390745,10174754,16740,94347,417438,862220,2155448,6783447,1235859 2006,299398484,11401511,1418043,9983568,17030,92757,447403,860853,2183746,6607013,1192809 2007,301621157,11251828,1408337,9843481,16929,90427,445125,855856,2176140,6568572,1095769 2008,304374846,11160543,1392628,9767915,16442,90479,443574,842134,2228474,6588046,958629 2009,307006550,10762956,1325896,9337060,15399,89241,408742,812514,2203313,6338095,795652 2010,309330219,10363873,1251248,9112625,14772,85593,369089,781844,2168457,6204601,739565 2011,311587816,10258774,1206031,9052743,14661,84175,354772,752423,2185140,6151095,716508 2012,313873685,10219059,1217067,9001992,14866,85141,355051,762009,2109932,6168874,723186 2013,316497531,9850445,1199684,8650761,14319,82109,345095,726575,1931835,6018632,700294 2014,318857056,9475816,1197987,8277829,14249,84041,325802,741291,1729806,5858496,689527 -------------------------------------------------------------------------------- /05_Merge/Auto_MPG/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# MPG Cars" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the first dataset : cars1.csv, cars2.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | " ### Step 3. Assign each to a variable called cars1 and cars2" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "### Step 4. Oops, it seems our first dataset has some unnamed blank columns, fix cars1" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [] 58 | }, 59 | { 60 | "cell_type": "markdown", 61 | "metadata": {}, 62 | "source": [ 63 | "### Step 5. What is the number of observations in each dataset?" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": null, 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": {}, 76 | "source": [ 77 | "### Step 6. Join cars1 and cars2 into a single DataFrame called cars" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": null, 83 | "metadata": {}, 84 | "outputs": [], 85 | "source": [] 86 | }, 87 | { 88 | "cell_type": "markdown", 89 | "metadata": {}, 90 | "source": [ 91 | "### Step 7. Oops, there is a column missing, called owners. Create a random number Series from 15,000 to 73,000." 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": {}, 98 | "outputs": [], 99 | "source": [] 100 | }, 101 | { 102 | "cell_type": "markdown", 103 | "metadata": {}, 104 | "source": [ 105 | "### Step 8. Add the column owners to cars" 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "metadata": {}, 112 | "outputs": [], 113 | "source": [] 114 | } 115 | ], 116 | "metadata": { 117 | "anaconda-cloud": {}, 118 | "kernelspec": { 119 | "display_name": "Python 3", 120 | "language": "python", 121 | "name": "python3" 122 | }, 123 | "language_info": { 124 | "codemirror_mode": { 125 | "name": "ipython", 126 | "version": 3 127 | }, 128 | "file_extension": ".py", 129 | "mimetype": "text/x-python", 130 | "name": "python", 131 | "nbconvert_exporter": "python", 132 | "pygments_lexer": "ipython3", 133 | "version": "3.7.6" 134 | } 135 | }, 136 | "nbformat": 4, 137 | "nbformat_minor": 1 138 | } 139 | -------------------------------------------------------------------------------- /05_Merge/Auto_MPG/cars1.csv: -------------------------------------------------------------------------------- 1 | mpg,cylinders,displacement,horsepower,weight,acceleration,model,origin,car,,,,, 18.0,8,307,130,3504,12.0,70,1,chevrolet chevelle malibu,,,,, 15.0,8,350,165,3693,11.5,70,1,buick skylark 320,,,,, 18.0,8,318,150,3436,11.0,70,1,plymouth satellite,,,,, 16.0,8,304,150,3433,12.0,70,1,amc rebel sst,,,,, 17.0,8,302,140,3449,10.5,70,1,ford torino,,,,, 15.0,8,429,198,4341,10.0,70,1,ford galaxie 500,,,,, 14.0,8,454,220,4354,9.0,70,1,chevrolet impala,,,,, 14.0,8,440,215,4312,8.5,70,1,plymouth fury iii,,,,, 14.0,8,455,225,4425,10.0,70,1,pontiac catalina,,,,, 15.0,8,390,190,3850,8.5,70,1,amc ambassador dpl,,,,, 15.0,8,383,170,3563,10.0,70,1,dodge challenger se,,,,, 14.0,8,340,160,3609,8.0,70,1,plymouth 'cuda 340,,,,, 15.0,8,400,150,3761,9.5,70,1,chevrolet monte carlo,,,,, 14.0,8,455,225,3086,10.0,70,1,buick estate wagon (sw),,,,, 24.0,4,113,95,2372,15.0,70,3,toyota corona mark ii,,,,, 22.0,6,198,95,2833,15.5,70,1,plymouth duster,,,,, 18.0,6,199,97,2774,15.5,70,1,amc hornet,,,,, 21.0,6,200,85,2587,16.0,70,1,ford maverick,,,,, 27.0,4,97,88,2130,14.5,70,3,datsun pl510,,,,, 26.0,4,97,46,1835,20.5,70,2,volkswagen 1131 deluxe sedan,,,,, 25.0,4,110,87,2672,17.5,70,2,peugeot 504,,,,, 24.0,4,107,90,2430,14.5,70,2,audi 100 ls,,,,, 25.0,4,104,95,2375,17.5,70,2,saab 99e,,,,, 26.0,4,121,113,2234,12.5,70,2,bmw 2002,,,,, 21.0,6,199,90,2648,15.0,70,1,amc gremlin,,,,, 10.0,8,360,215,4615,14.0,70,1,ford f250,,,,, 10.0,8,307,200,4376,15.0,70,1,chevy c20,,,,, 11.0,8,318,210,4382,13.5,70,1,dodge d200,,,,, 9.0,8,304,193,4732,18.5,70,1,hi 1200d,,,,, 27.0,4,97,88,2130,14.5,71,3,datsun pl510,,,,, 28.0,4,140,90,2264,15.5,71,1,chevrolet vega 2300,,,,, 25.0,4,113,95,2228,14.0,71,3,toyota corona,,,,, 25.0,4,98,?,2046,19.0,71,1,ford pinto,,,,, 19.0,6,232,100,2634,13.0,71,1,amc gremlin,,,,, 16.0,6,225,105,3439,15.5,71,1,plymouth satellite custom,,,,, 17.0,6,250,100,3329,15.5,71,1,chevrolet chevelle malibu,,,,, 19.0,6,250,88,3302,15.5,71,1,ford torino 500,,,,, 18.0,6,232,100,3288,15.5,71,1,amc matador,,,,, 14.0,8,350,165,4209,12.0,71,1,chevrolet impala,,,,, 14.0,8,400,175,4464,11.5,71,1,pontiac catalina brougham,,,,, 14.0,8,351,153,4154,13.5,71,1,ford galaxie 500,,,,, 14.0,8,318,150,4096,13.0,71,1,plymouth fury iii,,,,, 12.0,8,383,180,4955,11.5,71,1,dodge monaco (sw),,,,, 13.0,8,400,170,4746,12.0,71,1,ford country squire (sw),,,,, 13.0,8,400,175,5140,12.0,71,1,pontiac safari (sw),,,,, 18.0,6,258,110,2962,13.5,71,1,amc hornet sportabout (sw),,,,, 22.0,4,140,72,2408,19.0,71,1,chevrolet vega (sw),,,,, 19.0,6,250,100,3282,15.0,71,1,pontiac firebird,,,,, 18.0,6,250,88,3139,14.5,71,1,ford mustang,,,,, 23.0,4,122,86,2220,14.0,71,1,mercury capri 2000,,,,, 28.0,4,116,90,2123,14.0,71,2,opel 1900,,,,, 30.0,4,79,70,2074,19.5,71,2,peugeot 304,,,,, 30.0,4,88,76,2065,14.5,71,2,fiat 124b,,,,, 31.0,4,71,65,1773,19.0,71,3,toyota corolla 1200,,,,, 35.0,4,72,69,1613,18.0,71,3,datsun 1200,,,,, 27.0,4,97,60,1834,19.0,71,2,volkswagen model 111,,,,, 26.0,4,91,70,1955,20.5,71,1,plymouth cricket,,,,, 24.0,4,113,95,2278,15.5,72,3,toyota corona hardtop,,,,, 25.0,4,98,80,2126,17.0,72,1,dodge colt hardtop,,,,, 23.0,4,97,54,2254,23.5,72,2,volkswagen type 3,,,,, 20.0,4,140,90,2408,19.5,72,1,chevrolet vega,,,,, 21.0,4,122,86,2226,16.5,72,1,ford pinto runabout,,,,, 13.0,8,350,165,4274,12.0,72,1,chevrolet impala,,,,, 14.0,8,400,175,4385,12.0,72,1,pontiac catalina,,,,, 15.0,8,318,150,4135,13.5,72,1,plymouth fury iii,,,,, 14.0,8,351,153,4129,13.0,72,1,ford galaxie 500,,,,, 17.0,8,304,150,3672,11.5,72,1,amc ambassador sst,,,,, 11.0,8,429,208,4633,11.0,72,1,mercury marquis,,,,, 13.0,8,350,155,4502,13.5,72,1,buick lesabre custom,,,,, 12.0,8,350,160,4456,13.5,72,1,oldsmobile delta 88 royale,,,,, 13.0,8,400,190,4422,12.5,72,1,chrysler newport royal,,,,, 19.0,3,70,97,2330,13.5,72,3,mazda rx2 coupe,,,,, 15.0,8,304,150,3892,12.5,72,1,amc matador (sw),,,,, 13.0,8,307,130,4098,14.0,72,1,chevrolet chevelle concours (sw),,,,, 13.0,8,302,140,4294,16.0,72,1,ford gran torino (sw),,,,, 14.0,8,318,150,4077,14.0,72,1,plymouth satellite custom (sw),,,,, 18.0,4,121,112,2933,14.5,72,2,volvo 145e (sw),,,,, 22.0,4,121,76,2511,18.0,72,2,volkswagen 411 (sw),,,,, 21.0,4,120,87,2979,19.5,72,2,peugeot 504 (sw),,,,, 26.0,4,96,69,2189,18.0,72,2,renault 12 (sw),,,,, 22.0,4,122,86,2395,16.0,72,1,ford pinto (sw),,,,, 28.0,4,97,92,2288,17.0,72,3,datsun 510 (sw),,,,, 23.0,4,120,97,2506,14.5,72,3,toyouta corona mark ii (sw),,,,, 28.0,4,98,80,2164,15.0,72,1,dodge colt (sw),,,,, 27.0,4,97,88,2100,16.5,72,3,toyota corolla 1600 (sw),,,,, 13.0,8,350,175,4100,13.0,73,1,buick century 350,,,,, 14.0,8,304,150,3672,11.5,73,1,amc matador,,,,, 13.0,8,350,145,3988,13.0,73,1,chevrolet malibu,,,,, 14.0,8,302,137,4042,14.5,73,1,ford gran torino,,,,, 15.0,8,318,150,3777,12.5,73,1,dodge coronet custom,,,,, 12.0,8,429,198,4952,11.5,73,1,mercury marquis brougham,,,,, 13.0,8,400,150,4464,12.0,73,1,chevrolet caprice classic,,,,, 13.0,8,351,158,4363,13.0,73,1,ford ltd,,,,, 14.0,8,318,150,4237,14.5,73,1,plymouth fury gran sedan,,,,, 13.0,8,440,215,4735,11.0,73,1,chrysler new yorker brougham,,,,, 12.0,8,455,225,4951,11.0,73,1,buick electra 225 custom,,,,, 13.0,8,360,175,3821,11.0,73,1,amc ambassador brougham,,,,, 18.0,6,225,105,3121,16.5,73,1,plymouth valiant,,,,, 16.0,6,250,100,3278,18.0,73,1,chevrolet nova custom,,,,, 18.0,6,232,100,2945,16.0,73,1,amc hornet,,,,, 18.0,6,250,88,3021,16.5,73,1,ford maverick,,,,, 23.0,6,198,95,2904,16.0,73,1,plymouth duster,,,,, 26.0,4,97,46,1950,21.0,73,2,volkswagen super beetle,,,,, 11.0,8,400,150,4997,14.0,73,1,chevrolet impala,,,,, 12.0,8,400,167,4906,12.5,73,1,ford country,,,,, 13.0,8,360,170,4654,13.0,73,1,plymouth custom suburb,,,,, 12.0,8,350,180,4499,12.5,73,1,oldsmobile vista cruiser,,,,, 18.0,6,232,100,2789,15.0,73,1,amc gremlin,,,,, 20.0,4,97,88,2279,19.0,73,3,toyota carina,,,,, 21.0,4,140,72,2401,19.5,73,1,chevrolet vega,,,,, 22.0,4,108,94,2379,16.5,73,3,datsun 610,,,,, 18.0,3,70,90,2124,13.5,73,3,maxda rx3,,,,, 19.0,4,122,85,2310,18.5,73,1,ford pinto,,,,, 21.0,6,155,107,2472,14.0,73,1,mercury capri v6,,,,, 26.0,4,98,90,2265,15.5,73,2,fiat 124 sport coupe,,,,, 15.0,8,350,145,4082,13.0,73,1,chevrolet monte carlo s,,,,, 16.0,8,400,230,4278,9.5,73,1,pontiac grand prix,,,,, 29.0,4,68,49,1867,19.5,73,2,fiat 128,,,,, 24.0,4,116,75,2158,15.5,73,2,opel manta,,,,, 20.0,4,114,91,2582,14.0,73,2,audi 100ls,,,,, 19.0,4,121,112,2868,15.5,73,2,volvo 144ea,,,,, 15.0,8,318,150,3399,11.0,73,1,dodge dart custom,,,,, 24.0,4,121,110,2660,14.0,73,2,saab 99le,,,,, 20.0,6,156,122,2807,13.5,73,3,toyota mark ii,,,,, 11.0,8,350,180,3664,11.0,73,1,oldsmobile omega,,,,, 20.0,6,198,95,3102,16.5,74,1,plymouth duster,,,,, 21.0,6,200,?,2875,17.0,74,1,ford maverick,,,,, 19.0,6,232,100,2901,16.0,74,1,amc hornet,,,,, 15.0,6,250,100,3336,17.0,74,1,chevrolet nova,,,,, 31.0,4,79,67,1950,19.0,74,3,datsun b210,,,,, 26.0,4,122,80,2451,16.5,74,1,ford pinto,,,,, 32.0,4,71,65,1836,21.0,74,3,toyota corolla 1200,,,,, 25.0,4,140,75,2542,17.0,74,1,chevrolet vega,,,,, 16.0,6,250,100,3781,17.0,74,1,chevrolet chevelle malibu classic,,,,, 16.0,6,258,110,3632,18.0,74,1,amc matador,,,,, 18.0,6,225,105,3613,16.5,74,1,plymouth satellite sebring,,,,, 16.0,8,302,140,4141,14.0,74,1,ford gran torino,,,,, 13.0,8,350,150,4699,14.5,74,1,buick century luxus (sw),,,,, 14.0,8,318,150,4457,13.5,74,1,dodge coronet custom (sw),,,,, 14.0,8,302,140,4638,16.0,74,1,ford gran torino (sw),,,,, 14.0,8,304,150,4257,15.5,74,1,amc matador (sw),,,,, 29.0,4,98,83,2219,16.5,74,2,audi fox,,,,, 26.0,4,79,67,1963,15.5,74,2,volkswagen dasher,,,,, 26.0,4,97,78,2300,14.5,74,2,opel manta,,,,, 31.0,4,76,52,1649,16.5,74,3,toyota corona,,,,, 32.0,4,83,61,2003,19.0,74,3,datsun 710,,,,, 28.0,4,90,75,2125,14.5,74,1,dodge colt,,,,, 24.0,4,90,75,2108,15.5,74,2,fiat 128,,,,, 26.0,4,116,75,2246,14.0,74,2,fiat 124 tc,,,,, 24.0,4,120,97,2489,15.0,74,3,honda civic,,,,, 26.0,4,108,93,2391,15.5,74,3,subaru,,,,, 31.0,4,79,67,2000,16.0,74,2,fiat x1.9,,,,, 19.0,6,225,95,3264,16.0,75,1,plymouth valiant custom,,,,, 18.0,6,250,105,3459,16.0,75,1,chevrolet nova,,,,, 15.0,6,250,72,3432,21.0,75,1,mercury monarch,,,,, 15.0,6,250,72,3158,19.5,75,1,ford maverick,,,,, 16.0,8,400,170,4668,11.5,75,1,pontiac catalina,,,,, 15.0,8,350,145,4440,14.0,75,1,chevrolet bel air,,,,, 16.0,8,318,150,4498,14.5,75,1,plymouth grand fury,,,,, 14.0,8,351,148,4657,13.5,75,1,ford ltd,,,,, 17.0,6,231,110,3907,21.0,75,1,buick century,,,,, 16.0,6,250,105,3897,18.5,75,1,chevroelt chevelle malibu,,,,, 15.0,6,258,110,3730,19.0,75,1,amc matador,,,,, 18.0,6,225,95,3785,19.0,75,1,plymouth fury,,,,, 21.0,6,231,110,3039,15.0,75,1,buick skyhawk,,,,, 20.0,8,262,110,3221,13.5,75,1,chevrolet monza 2+2,,,,, 13.0,8,302,129,3169,12.0,75,1,ford mustang ii,,,,, 29.0,4,97,75,2171,16.0,75,3,toyota corolla,,,,, 23.0,4,140,83,2639,17.0,75,1,ford pinto,,,,, 20.0,6,232,100,2914,16.0,75,1,amc gremlin,,,,, 23.0,4,140,78,2592,18.5,75,1,pontiac astro,,,,, 24.0,4,134,96,2702,13.5,75,3,toyota corona,,,,, 25.0,4,90,71,2223,16.5,75,2,volkswagen dasher,,,,, 24.0,4,119,97,2545,17.0,75,3,datsun 710,,,,, 18.0,6,171,97,2984,14.5,75,1,ford pinto,,,,, 29.0,4,90,70,1937,14.0,75,2,volkswagen rabbit,,,,, 19.0,6,232,90,3211,17.0,75,1,amc pacer,,,,, 23.0,4,115,95,2694,15.0,75,2,audi 100ls,,,,, 23.0,4,120,88,2957,17.0,75,2,peugeot 504,,,,, 22.0,4,121,98,2945,14.5,75,2,volvo 244dl,,,,, 25.0,4,121,115,2671,13.5,75,2,saab 99le,,,,, 33.0,4,91,53,1795,17.5,75,3,honda civic cvcc,,,,, 28.0,4,107,86,2464,15.5,76,2,fiat 131,,,,, 25.0,4,116,81,2220,16.9,76,2,opel 1900,,,,, 25.0,4,140,92,2572,14.9,76,1,capri ii,,,,, 26.0,4,98,79,2255,17.7,76,1,dodge colt,,,,, 27.0,4,101,83,2202,15.3,76,2,renault 12tl,,,,, 17.5,8,305,140,4215,13.0,76,1,chevrolet chevelle malibu classic,,,,, 16.0,8,318,150,4190,13.0,76,1,dodge coronet brougham,,,,, 15.5,8,304,120,3962,13.9,76,1,amc matador,,,,, 14.5,8,351,152,4215,12.8,76,1,ford gran torino,,,,, 22.0,6,225,100,3233,15.4,76,1,plymouth valiant,,,,, 22.0,6,250,105,3353,14.5,76,1,chevrolet nova,,,,, 24.0,6,200,81,3012,17.6,76,1,ford maverick,,,,, 22.5,6,232,90,3085,17.6,76,1,amc hornet,,,,, 29.0,4,85,52,2035,22.2,76,1,chevrolet chevette,,,,, 24.5,4,98,60,2164,22.1,76,1,chevrolet woody,,,,, 29.0,4,90,70,1937,14.2,76,2,vw rabbit,,,,, -------------------------------------------------------------------------------- /05_Merge/Auto_MPG/cars2.csv: -------------------------------------------------------------------------------- 1 | mpg,cylinders,displacement,horsepower,weight,acceleration,model,origin,car 33.0,4,91,53,1795,17.4,76,3,honda civic 20.0,6,225,100,3651,17.7,76,1,dodge aspen se 18.0,6,250,78,3574,21.0,76,1,ford granada ghia 18.5,6,250,110,3645,16.2,76,1,pontiac ventura sj 17.5,6,258,95,3193,17.8,76,1,amc pacer d/l 29.5,4,97,71,1825,12.2,76,2,volkswagen rabbit 32.0,4,85,70,1990,17.0,76,3,datsun b-210 28.0,4,97,75,2155,16.4,76,3,toyota corolla 26.5,4,140,72,2565,13.6,76,1,ford pinto 20.0,4,130,102,3150,15.7,76,2,volvo 245 13.0,8,318,150,3940,13.2,76,1,plymouth volare premier v8 19.0,4,120,88,3270,21.9,76,2,peugeot 504 19.0,6,156,108,2930,15.5,76,3,toyota mark ii 16.5,6,168,120,3820,16.7,76,2,mercedes-benz 280s 16.5,8,350,180,4380,12.1,76,1,cadillac seville 13.0,8,350,145,4055,12.0,76,1,chevy c10 13.0,8,302,130,3870,15.0,76,1,ford f108 13.0,8,318,150,3755,14.0,76,1,dodge d100 31.5,4,98,68,2045,18.5,77,3,honda accord cvcc 30.0,4,111,80,2155,14.8,77,1,buick opel isuzu deluxe 36.0,4,79,58,1825,18.6,77,2,renault 5 gtl 25.5,4,122,96,2300,15.5,77,1,plymouth arrow gs 33.5,4,85,70,1945,16.8,77,3,datsun f-10 hatchback 17.5,8,305,145,3880,12.5,77,1,chevrolet caprice classic 17.0,8,260,110,4060,19.0,77,1,oldsmobile cutlass supreme 15.5,8,318,145,4140,13.7,77,1,dodge monaco brougham 15.0,8,302,130,4295,14.9,77,1,mercury cougar brougham 17.5,6,250,110,3520,16.4,77,1,chevrolet concours 20.5,6,231,105,3425,16.9,77,1,buick skylark 19.0,6,225,100,3630,17.7,77,1,plymouth volare custom 18.5,6,250,98,3525,19.0,77,1,ford granada 16.0,8,400,180,4220,11.1,77,1,pontiac grand prix lj 15.5,8,350,170,4165,11.4,77,1,chevrolet monte carlo landau 15.5,8,400,190,4325,12.2,77,1,chrysler cordoba 16.0,8,351,149,4335,14.5,77,1,ford thunderbird 29.0,4,97,78,1940,14.5,77,2,volkswagen rabbit custom 24.5,4,151,88,2740,16.0,77,1,pontiac sunbird coupe 26.0,4,97,75,2265,18.2,77,3,toyota corolla liftback 25.5,4,140,89,2755,15.8,77,1,ford mustang ii 2+2 30.5,4,98,63,2051,17.0,77,1,chevrolet chevette 33.5,4,98,83,2075,15.9,77,1,dodge colt m/m 30.0,4,97,67,1985,16.4,77,3,subaru dl 30.5,4,97,78,2190,14.1,77,2,volkswagen dasher 22.0,6,146,97,2815,14.5,77,3,datsun 810 21.5,4,121,110,2600,12.8,77,2,bmw 320i 21.5,3,80,110,2720,13.5,77,3,mazda rx-4 43.1,4,90,48,1985,21.5,78,2,volkswagen rabbit custom diesel 36.1,4,98,66,1800,14.4,78,1,ford fiesta 32.8,4,78,52,1985,19.4,78,3,mazda glc deluxe 39.4,4,85,70,2070,18.6,78,3,datsun b210 gx 36.1,4,91,60,1800,16.4,78,3,honda civic cvcc 19.9,8,260,110,3365,15.5,78,1,oldsmobile cutlass salon brougham 19.4,8,318,140,3735,13.2,78,1,dodge diplomat 20.2,8,302,139,3570,12.8,78,1,mercury monarch ghia 19.2,6,231,105,3535,19.2,78,1,pontiac phoenix lj 20.5,6,200,95,3155,18.2,78,1,chevrolet malibu 20.2,6,200,85,2965,15.8,78,1,ford fairmont (auto) 25.1,4,140,88,2720,15.4,78,1,ford fairmont (man) 20.5,6,225,100,3430,17.2,78,1,plymouth volare 19.4,6,232,90,3210,17.2,78,1,amc concord 20.6,6,231,105,3380,15.8,78,1,buick century special 20.8,6,200,85,3070,16.7,78,1,mercury zephyr 18.6,6,225,110,3620,18.7,78,1,dodge aspen 18.1,6,258,120,3410,15.1,78,1,amc concord d/l 19.2,8,305,145,3425,13.2,78,1,chevrolet monte carlo landau 17.7,6,231,165,3445,13.4,78,1,buick regal sport coupe (turbo) 18.1,8,302,139,3205,11.2,78,1,ford futura 17.5,8,318,140,4080,13.7,78,1,dodge magnum xe 30.0,4,98,68,2155,16.5,78,1,chevrolet chevette 27.5,4,134,95,2560,14.2,78,3,toyota corona 27.2,4,119,97,2300,14.7,78,3,datsun 510 30.9,4,105,75,2230,14.5,78,1,dodge omni 21.1,4,134,95,2515,14.8,78,3,toyota celica gt liftback 23.2,4,156,105,2745,16.7,78,1,plymouth sapporo 23.8,4,151,85,2855,17.6,78,1,oldsmobile starfire sx 23.9,4,119,97,2405,14.9,78,3,datsun 200-sx 20.3,5,131,103,2830,15.9,78,2,audi 5000 17.0,6,163,125,3140,13.6,78,2,volvo 264gl 21.6,4,121,115,2795,15.7,78,2,saab 99gle 16.2,6,163,133,3410,15.8,78,2,peugeot 604sl 31.5,4,89,71,1990,14.9,78,2,volkswagen scirocco 29.5,4,98,68,2135,16.6,78,3,honda accord lx 21.5,6,231,115,3245,15.4,79,1,pontiac lemans v6 19.8,6,200,85,2990,18.2,79,1,mercury zephyr 6 22.3,4,140,88,2890,17.3,79,1,ford fairmont 4 20.2,6,232,90,3265,18.2,79,1,amc concord dl 6 20.6,6,225,110,3360,16.6,79,1,dodge aspen 6 17.0,8,305,130,3840,15.4,79,1,chevrolet caprice classic 17.6,8,302,129,3725,13.4,79,1,ford ltd landau 16.5,8,351,138,3955,13.2,79,1,mercury grand marquis 18.2,8,318,135,3830,15.2,79,1,dodge st. regis 16.9,8,350,155,4360,14.9,79,1,buick estate wagon (sw) 15.5,8,351,142,4054,14.3,79,1,ford country squire (sw) 19.2,8,267,125,3605,15.0,79,1,chevrolet malibu classic (sw) 18.5,8,360,150,3940,13.0,79,1,chrysler lebaron town @ country (sw) 31.9,4,89,71,1925,14.0,79,2,vw rabbit custom 34.1,4,86,65,1975,15.2,79,3,maxda glc deluxe 35.7,4,98,80,1915,14.4,79,1,dodge colt hatchback custom 27.4,4,121,80,2670,15.0,79,1,amc spirit dl 25.4,5,183,77,3530,20.1,79,2,mercedes benz 300d 23.0,8,350,125,3900,17.4,79,1,cadillac eldorado 27.2,4,141,71,3190,24.8,79,2,peugeot 504 23.9,8,260,90,3420,22.2,79,1,oldsmobile cutlass salon brougham 34.2,4,105,70,2200,13.2,79,1,plymouth horizon 34.5,4,105,70,2150,14.9,79,1,plymouth horizon tc3 31.8,4,85,65,2020,19.2,79,3,datsun 210 37.3,4,91,69,2130,14.7,79,2,fiat strada custom 28.4,4,151,90,2670,16.0,79,1,buick skylark limited 28.8,6,173,115,2595,11.3,79,1,chevrolet citation 26.8,6,173,115,2700,12.9,79,1,oldsmobile omega brougham 33.5,4,151,90,2556,13.2,79,1,pontiac phoenix 41.5,4,98,76,2144,14.7,80,2,vw rabbit 38.1,4,89,60,1968,18.8,80,3,toyota corolla tercel 32.1,4,98,70,2120,15.5,80,1,chevrolet chevette 37.2,4,86,65,2019,16.4,80,3,datsun 310 28.0,4,151,90,2678,16.5,80,1,chevrolet citation 26.4,4,140,88,2870,18.1,80,1,ford fairmont 24.3,4,151,90,3003,20.1,80,1,amc concord 19.1,6,225,90,3381,18.7,80,1,dodge aspen 34.3,4,97,78,2188,15.8,80,2,audi 4000 29.8,4,134,90,2711,15.5,80,3,toyota corona liftback 31.3,4,120,75,2542,17.5,80,3,mazda 626 37.0,4,119,92,2434,15.0,80,3,datsun 510 hatchback 32.2,4,108,75,2265,15.2,80,3,toyota corolla 46.6,4,86,65,2110,17.9,80,3,mazda glc 27.9,4,156,105,2800,14.4,80,1,dodge colt 40.8,4,85,65,2110,19.2,80,3,datsun 210 44.3,4,90,48,2085,21.7,80,2,vw rabbit c (diesel) 43.4,4,90,48,2335,23.7,80,2,vw dasher (diesel) 36.4,5,121,67,2950,19.9,80,2,audi 5000s (diesel) 30.0,4,146,67,3250,21.8,80,2,mercedes-benz 240d 44.6,4,91,67,1850,13.8,80,3,honda civic 1500 gl 40.9,4,85,?,1835,17.3,80,2,renault lecar deluxe 33.8,4,97,67,2145,18.0,80,3,subaru dl 29.8,4,89,62,1845,15.3,80,2,vokswagen rabbit 32.7,6,168,132,2910,11.4,80,3,datsun 280-zx 23.7,3,70,100,2420,12.5,80,3,mazda rx-7 gs 35.0,4,122,88,2500,15.1,80,2,triumph tr7 coupe 23.6,4,140,?,2905,14.3,80,1,ford mustang cobra 32.4,4,107,72,2290,17.0,80,3,honda accord 27.2,4,135,84,2490,15.7,81,1,plymouth reliant 26.6,4,151,84,2635,16.4,81,1,buick skylark 25.8,4,156,92,2620,14.4,81,1,dodge aries wagon (sw) 23.5,6,173,110,2725,12.6,81,1,chevrolet citation 30.0,4,135,84,2385,12.9,81,1,plymouth reliant 39.1,4,79,58,1755,16.9,81,3,toyota starlet 39.0,4,86,64,1875,16.4,81,1,plymouth champ 35.1,4,81,60,1760,16.1,81,3,honda civic 1300 32.3,4,97,67,2065,17.8,81,3,subaru 37.0,4,85,65,1975,19.4,81,3,datsun 210 mpg 37.7,4,89,62,2050,17.3,81,3,toyota tercel 34.1,4,91,68,1985,16.0,81,3,mazda glc 4 34.7,4,105,63,2215,14.9,81,1,plymouth horizon 4 34.4,4,98,65,2045,16.2,81,1,ford escort 4w 29.9,4,98,65,2380,20.7,81,1,ford escort 2h 33.0,4,105,74,2190,14.2,81,2,volkswagen jetta 34.5,4,100,?,2320,15.8,81,2,renault 18i 33.7,4,107,75,2210,14.4,81,3,honda prelude 32.4,4,108,75,2350,16.8,81,3,toyota corolla 32.9,4,119,100,2615,14.8,81,3,datsun 200sx 31.6,4,120,74,2635,18.3,81,3,mazda 626 28.1,4,141,80,3230,20.4,81,2,peugeot 505s turbo diesel 30.7,6,145,76,3160,19.6,81,2,volvo diesel 25.4,6,168,116,2900,12.6,81,3,toyota cressida 24.2,6,146,120,2930,13.8,81,3,datsun 810 maxima 22.4,6,231,110,3415,15.8,81,1,buick century 26.6,8,350,105,3725,19.0,81,1,oldsmobile cutlass ls 20.2,6,200,88,3060,17.1,81,1,ford granada gl 17.6,6,225,85,3465,16.6,81,1,chrysler lebaron salon 28.0,4,112,88,2605,19.6,82,1,chevrolet cavalier 27.0,4,112,88,2640,18.6,82,1,chevrolet cavalier wagon 34.0,4,112,88,2395,18.0,82,1,chevrolet cavalier 2-door 31.0,4,112,85,2575,16.2,82,1,pontiac j2000 se hatchback 29.0,4,135,84,2525,16.0,82,1,dodge aries se 27.0,4,151,90,2735,18.0,82,1,pontiac phoenix 24.0,4,140,92,2865,16.4,82,1,ford fairmont futura 23.0,4,151,?,3035,20.5,82,1,amc concord dl 36.0,4,105,74,1980,15.3,82,2,volkswagen rabbit l 37.0,4,91,68,2025,18.2,82,3,mazda glc custom l 31.0,4,91,68,1970,17.6,82,3,mazda glc custom 38.0,4,105,63,2125,14.7,82,1,plymouth horizon miser 36.0,4,98,70,2125,17.3,82,1,mercury lynx l 36.0,4,120,88,2160,14.5,82,3,nissan stanza xe 36.0,4,107,75,2205,14.5,82,3,honda accord 34.0,4,108,70,2245,16.9,82,3,toyota corolla 38.0,4,91,67,1965,15.0,82,3,honda civic 32.0,4,91,67,1965,15.7,82,3,honda civic (auto) 38.0,4,91,67,1995,16.2,82,3,datsun 310 gx 25.0,6,181,110,2945,16.4,82,1,buick century limited 38.0,6,262,85,3015,17.0,82,1,oldsmobile cutlass ciera (diesel) 26.0,4,156,92,2585,14.5,82,1,chrysler lebaron medallion 22.0,6,232,112,2835,14.7,82,1,ford granada l 32.0,4,144,96,2665,13.9,82,3,toyota celica gt 36.0,4,135,84,2370,13.0,82,1,dodge charger 2.2 27.0,4,151,90,2950,17.3,82,1,chevrolet camaro 27.0,4,140,86,2790,15.6,82,1,ford mustang gl 44.0,4,97,52,2130,24.6,82,2,vw pickup 32.0,4,135,84,2295,11.6,82,1,dodge rampage 28.0,4,120,79,2625,18.6,82,1,ford ranger 31.0,4,119,82,2720,19.4,82,1,chevy s-10 -------------------------------------------------------------------------------- /05_Merge/Fictitous Names/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Fictitious Names" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Create the 3 DataFrames based on the following raw data" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 1, 34 | "metadata": { 35 | "collapsed": true 36 | }, 37 | "outputs": [], 38 | "source": [ 39 | "raw_data_1 = {\n", 40 | " 'subject_id': ['1', '2', '3', '4', '5'],\n", 41 | " 'first_name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'], \n", 42 | " 'last_name': ['Anderson', 'Ackerman', 'Ali', 'Aoni', 'Atiches']}\n", 43 | "\n", 44 | "raw_data_2 = {\n", 45 | " 'subject_id': ['4', '5', '6', '7', '8'],\n", 46 | " 'first_name': ['Billy', 'Brian', 'Bran', 'Bryce', 'Betty'], \n", 47 | " 'last_name': ['Bonder', 'Black', 'Balwner', 'Brice', 'Btisan']}\n", 48 | "\n", 49 | "raw_data_3 = {\n", 50 | " 'subject_id': ['1', '2', '3', '4', '5', '7', '8', '9', '10', '11'],\n", 51 | " 'test_id': [51, 15, 15, 61, 16, 14, 15, 1, 61, 16]}" 52 | ] 53 | }, 54 | { 55 | "cell_type": "markdown", 56 | "metadata": {}, 57 | "source": [ 58 | "### Step 3. Assign each to a variable called data1, data2, data3" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "### Step 4. Join the two dataframes along rows and assign all_data" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Step 5. Join the two dataframes along columns and assing to all_data_col" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": {}, 99 | "source": [ 100 | "### Step 6. Print data3" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": null, 106 | "metadata": {}, 107 | "outputs": [], 108 | "source": [] 109 | }, 110 | { 111 | "cell_type": "markdown", 112 | "metadata": {}, 113 | "source": [ 114 | "### Step 7. Merge all_data and data3 along the subject_id value" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [] 123 | }, 124 | { 125 | "cell_type": "markdown", 126 | "metadata": {}, 127 | "source": [ 128 | "### Step 8. Merge only the data that has the same 'subject_id' on both data1 and data2" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": null, 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [] 137 | }, 138 | { 139 | "cell_type": "markdown", 140 | "metadata": {}, 141 | "source": [ 142 | "### Step 9. Merge all values in data1 and data2, with matching records from both sides where available." 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": null, 148 | "metadata": {}, 149 | "outputs": [], 150 | "source": [] 151 | } 152 | ], 153 | "metadata": { 154 | "kernelspec": { 155 | "display_name": "Python 3", 156 | "language": "python", 157 | "name": "python3" 158 | }, 159 | "language_info": { 160 | "codemirror_mode": { 161 | "name": "ipython", 162 | "version": 3 163 | }, 164 | "file_extension": ".py", 165 | "mimetype": "text/x-python", 166 | "name": "python", 167 | "nbconvert_exporter": "python", 168 | "pygments_lexer": "ipython3", 169 | "version": "3.7.6" 170 | } 171 | }, 172 | "nbformat": 4, 173 | "nbformat_minor": 1 174 | } 175 | -------------------------------------------------------------------------------- /05_Merge/Housing Market/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Housing Market" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Create 3 differents Series, each of length 100, as follows: \n", 29 | "1. The first a random number from 1 to 4 \n", 30 | "2. The second a random number from 1 to 3\n", 31 | "3. The third a random number from 10,000 to 30,000" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": null, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "metadata": {}, 44 | "source": [ 45 | "### Step 3. Let's create a DataFrame by joinning the Series by column" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": null, 51 | "metadata": {}, 52 | "outputs": [], 53 | "source": [] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [ 59 | "### Step 4. Change the name of the columns to bedrs, bathrs, price_sqr_meter" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": null, 65 | "metadata": {}, 66 | "outputs": [], 67 | "source": [] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "### Step 5. Create a one column DataFrame with the values of the 3 Series and assign it to 'bigcolumn'" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [] 82 | }, 83 | { 84 | "cell_type": "markdown", 85 | "metadata": {}, 86 | "source": [ 87 | "### Step 6. Oops, it seems it is going only until index 99. Is it true?" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": null, 93 | "metadata": {}, 94 | "outputs": [], 95 | "source": [] 96 | }, 97 | { 98 | "cell_type": "markdown", 99 | "metadata": {}, 100 | "source": [ 101 | "### Step 7. Reindex the DataFrame so it goes from 0 to 299" 102 | ] 103 | }, 104 | { 105 | "cell_type": "code", 106 | "execution_count": null, 107 | "metadata": {}, 108 | "outputs": [], 109 | "source": [] 110 | } 111 | ], 112 | "metadata": { 113 | "kernelspec": { 114 | "display_name": "Python 3", 115 | "language": "python", 116 | "name": "python3" 117 | }, 118 | "language_info": { 119 | "codemirror_mode": { 120 | "name": "ipython", 121 | "version": 3 122 | }, 123 | "file_extension": ".py", 124 | "mimetype": "text/x-python", 125 | "name": "python", 126 | "nbconvert_exporter": "python", 127 | "pygments_lexer": "ipython3", 128 | "version": "3.7.6" 129 | } 130 | }, 131 | "nbformat": 4, 132 | "nbformat_minor": 1 133 | } 134 | -------------------------------------------------------------------------------- /06_Stats/US_Baby_Names/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# US - Baby Names" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : US_Baby_Names_right.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 5, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "c.to_csv(\"US_Baby_Names_right.csv\",index=0)" 38 | ] 39 | }, 40 | { 41 | "cell_type": "markdown", 42 | "metadata": {}, 43 | "source": [ 44 | "### Step 3. Assign it to a variable called baby_names." 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": null, 50 | "metadata": {}, 51 | "outputs": [], 52 | "source": [] 53 | }, 54 | { 55 | "cell_type": "markdown", 56 | "metadata": {}, 57 | "source": [ 58 | "### Step 4. See the first 10 entries" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "### Step 5. Delete the column 'Unnamed: 0' and 'Id'" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Step 6. Is there more male or female names in the dataset?" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": {}, 99 | "source": [ 100 | "### Step 7. Group the dataset by name and assign to names" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": null, 106 | "metadata": {}, 107 | "outputs": [], 108 | "source": [] 109 | }, 110 | { 111 | "cell_type": "markdown", 112 | "metadata": {}, 113 | "source": [ 114 | "### Step 8. How many different names exist in the dataset?" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [] 123 | }, 124 | { 125 | "cell_type": "markdown", 126 | "metadata": {}, 127 | "source": [ 128 | "### Step 9. What is the name with most occurrences?" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": null, 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [] 137 | }, 138 | { 139 | "cell_type": "markdown", 140 | "metadata": {}, 141 | "source": [ 142 | "### Step 10. How many different names have the least occurrences?" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": null, 148 | "metadata": {}, 149 | "outputs": [], 150 | "source": [] 151 | }, 152 | { 153 | "cell_type": "markdown", 154 | "metadata": {}, 155 | "source": [ 156 | "### Step 11. What is the median name occurrence?" 157 | ] 158 | }, 159 | { 160 | "cell_type": "code", 161 | "execution_count": null, 162 | "metadata": {}, 163 | "outputs": [], 164 | "source": [] 165 | }, 166 | { 167 | "cell_type": "markdown", 168 | "metadata": {}, 169 | "source": [ 170 | "### Step 12. What is the standard deviation of names?" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": null, 176 | "metadata": {}, 177 | "outputs": [], 178 | "source": [] 179 | }, 180 | { 181 | "cell_type": "markdown", 182 | "metadata": {}, 183 | "source": [ 184 | "### Step 13. Get a summary with the mean, min, max, std and quartiles." 185 | ] 186 | }, 187 | { 188 | "cell_type": "code", 189 | "execution_count": null, 190 | "metadata": {}, 191 | "outputs": [], 192 | "source": [] 193 | } 194 | ], 195 | "metadata": { 196 | "anaconda-cloud": {}, 197 | "kernelspec": { 198 | "display_name": "Python 3", 199 | "language": "python", 200 | "name": "python3" 201 | }, 202 | "language_info": { 203 | "codemirror_mode": { 204 | "name": "ipython", 205 | "version": 3 206 | }, 207 | "file_extension": ".py", 208 | "mimetype": "text/x-python", 209 | "name": "python", 210 | "nbconvert_exporter": "python", 211 | "pygments_lexer": "ipython3", 212 | "version": "3.7.6" 213 | } 214 | }, 215 | "nbformat": 4, 216 | "nbformat_minor": 1 217 | } 218 | -------------------------------------------------------------------------------- /07_Visualization/Chipotle/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Visualizing Chipotle's Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : chipotle.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "### Step 3. Assign it to a variable called chipo." 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "### Step 4. See the first 10 entries" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": { 56 | "scrolled": false 57 | }, 58 | "outputs": [], 59 | "source": [] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "metadata": {}, 64 | "source": [ 65 | "### Step 5. Create a histogram of the top 5 items bought" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": null, 71 | "metadata": {}, 72 | "outputs": [], 73 | "source": [] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "### Step 6. Create a scatterplot with the number of items orderered per order price\n", 80 | "#### Hint: Price should be in the X-axis and Items ordered in the Y-axis" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [] 89 | }, 90 | { 91 | "cell_type": "markdown", 92 | "metadata": {}, 93 | "source": [ 94 | "### Step 7. BONUS: Create a question and a graph to answer your own question." 95 | ] 96 | }, 97 | { 98 | "cell_type": "code", 99 | "execution_count": null, 100 | "metadata": {}, 101 | "outputs": [], 102 | "source": [] 103 | } 104 | ], 105 | "metadata": { 106 | "kernelspec": { 107 | "display_name": "Python 3", 108 | "language": "python", 109 | "name": "python3" 110 | }, 111 | "language_info": { 112 | "codemirror_mode": { 113 | "name": "ipython", 114 | "version": 3 115 | }, 116 | "file_extension": ".py", 117 | "mimetype": "text/x-python", 118 | "name": "python", 119 | "nbconvert_exporter": "python", 120 | "pygments_lexer": "ipython3", 121 | "version": "3.7.6" 122 | } 123 | }, 124 | "nbformat": 4, 125 | "nbformat_minor": 1 126 | } 127 | -------------------------------------------------------------------------------- /07_Visualization/Online_Retail/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Online Retails Purchase" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Introduction:\n", 15 | "\n", 16 | "\n", 17 | "\n", 18 | "### Step 1. Import the necessary libraries" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 1, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [] 27 | }, 28 | { 29 | "cell_type": "markdown", 30 | "metadata": {}, 31 | "source": [ 32 | "### Step 2. Import the dataset : Online_Retail.csv" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": null, 38 | "metadata": {}, 39 | "outputs": [], 40 | "source": [] 41 | }, 42 | { 43 | "cell_type": "markdown", 44 | "metadata": {}, 45 | "source": [ 46 | "### Step 3. Assign it to a variable called online_rt" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": null, 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [] 55 | }, 56 | { 57 | "cell_type": "markdown", 58 | "metadata": {}, 59 | "source": [ 60 | "### Step 4. Create a histogram with the 10 countries that have the most 'Quantity' ordered except UK" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": null, 66 | "metadata": {}, 67 | "outputs": [], 68 | "source": [] 69 | }, 70 | { 71 | "cell_type": "markdown", 72 | "metadata": {}, 73 | "source": [ 74 | "### Step 5. Exclude negative Quantity entries" 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": null, 80 | "metadata": {}, 81 | "outputs": [], 82 | "source": [] 83 | }, 84 | { 85 | "cell_type": "markdown", 86 | "metadata": {}, 87 | "source": [ 88 | "### Step 6. Create a scatterplot with the Quantity per UnitPrice by CustomerID for the top 3 Countries (except UK)" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": null, 94 | "metadata": {}, 95 | "outputs": [], 96 | "source": [] 97 | }, 98 | { 99 | "cell_type": "markdown", 100 | "metadata": {}, 101 | "source": [ 102 | "### Step 7. Investigate why the previous results look so uninformative.\n", 103 | "\n", 104 | "#### Step 7.1 Look at the first line of code in Step 6. And try to figure out if it leads to any kind of problem.\n", 105 | "##### Step 7.1.1 Display the first few rows of that DataFrame." 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "metadata": {}, 112 | "outputs": [], 113 | "source": [] 114 | }, 115 | { 116 | "cell_type": "markdown", 117 | "metadata": {}, 118 | "source": [ 119 | "##### Step 7.1.2 Think about what that piece of code does and display the dtype of `UnitPrice`" 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": null, 125 | "metadata": {}, 126 | "outputs": [], 127 | "source": [] 128 | }, 129 | { 130 | "cell_type": "markdown", 131 | "metadata": {}, 132 | "source": [ 133 | "##### Step 7.1.3 Pull data from `online_rt`for `CustomerID`s 12346.0 and 12347.0." 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": null, 139 | "metadata": {}, 140 | "outputs": [], 141 | "source": [] 142 | }, 143 | { 144 | "cell_type": "markdown", 145 | "metadata": {}, 146 | "source": [ 147 | "#### Step 7.2 Reinterpreting the initial problem.\n", 148 | "\n", 149 | "##### Step 7.2.1 Find out the top 3 countries in terms of sales volume." 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 | "##### Step 7.2.2 \n", 164 | "\n", 165 | "Now that we have the top 3 countries, we can focus on the rest of the problem: \n", 166 | "\"Quantity per UnitPrice by CustomerID\". \n", 167 | "We need to unpack that.\n", 168 | "\n", 169 | "\"by CustomerID\" part is easy. That means we're going to be plotting one dot per CustomerID's on our plot. In other words, we're going to be grouping by CustomerID.\n", 170 | "\n", 171 | "\"Quantity per UnitPrice\" is trickier. Here's what we know: \n", 172 | "*One axis will represent a Quantity assigned to a given customer. This is easy; we can just plot the total Quantity for each customer. \n", 173 | "*The other axis will represent a UnitPrice assigned to a given customer. Remember a single customer can have any number of orders with different prices, so summing up prices isn't quite helpful. Besides it's not quite clear what we mean when we say \"unit price per customer\"; it sounds like price of the customer! A reasonable alternative is that we assign each customer the average amount each has paid per item. So let's settle that question in that manner.\n", 174 | "\n", 175 | "#### Step 7.3 Modify, select and plot data\n", 176 | "##### Step 7.3.1 Add a column to online_rt called `Revenue` calculate the revenue (Quantity * UnitPrice) from each sale.\n", 177 | "We will use this later to figure out an average price per customer." 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 | "##### Step 7.3.2 Group by `CustomerID` and `Country` and find out the average price (`AvgPrice`) each customer spends per unit." 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 | "##### Step 7.3.3 Plot" 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 | "#### Step 7.4 What to do now?\n", 220 | "We aren't much better-off than what we started with. The data are still extremely scattered around and don't seem quite informative.\n", 221 | "\n", 222 | "But we shouldn't despair!\n", 223 | "There are two things to realize:\n", 224 | "1) The data seem to be skewed towaards the axes (e.g. we don't have any values where Quantity = 50000 and AvgPrice = 5). So that might suggest a trend.\n", 225 | "2) We have more data! We've only been looking at the data from 3 different countries and they are plotted on different graphs.\n", 226 | "\n", 227 | "So: we should plot the data regardless of `Country` and hopefully see a less scattered graph.\n", 228 | "\n", 229 | "##### Step 7.4.1 Plot the data for each `CustomerID` on a single graph" 230 | ] 231 | }, 232 | { 233 | "cell_type": "code", 234 | "execution_count": null, 235 | "metadata": {}, 236 | "outputs": [], 237 | "source": [] 238 | }, 239 | { 240 | "cell_type": "markdown", 241 | "metadata": {}, 242 | "source": [ 243 | "##### Step 7.4.2 Zoom in so we can see that curve more clearly" 244 | ] 245 | }, 246 | { 247 | "cell_type": "code", 248 | "execution_count": null, 249 | "metadata": {}, 250 | "outputs": [], 251 | "source": [] 252 | }, 253 | { 254 | "cell_type": "markdown", 255 | "metadata": {}, 256 | "source": [ 257 | "### 8. Plot a line chart showing revenue (y) per UnitPrice (x).\n", 258 | "\n", 259 | "#### 8.1 Group `UnitPrice` by intervals of 1 for prices [0,50), and sum `Quantity` and `Revenue`." 260 | ] 261 | }, 262 | { 263 | "cell_type": "code", 264 | "execution_count": null, 265 | "metadata": {}, 266 | "outputs": [], 267 | "source": [] 268 | }, 269 | { 270 | "cell_type": "markdown", 271 | "metadata": {}, 272 | "source": [ 273 | "#### 8.3 Plot." 274 | ] 275 | }, 276 | { 277 | "cell_type": "code", 278 | "execution_count": null, 279 | "metadata": {}, 280 | "outputs": [], 281 | "source": [] 282 | }, 283 | { 284 | "cell_type": "markdown", 285 | "metadata": {}, 286 | "source": [ 287 | "#### 8.4 Make it look nicer.\n", 288 | "x-axis needs values. \n", 289 | "y-axis isn't that easy to read; show in terms of millions." 290 | ] 291 | }, 292 | { 293 | "cell_type": "code", 294 | "execution_count": null, 295 | "metadata": {}, 296 | "outputs": [], 297 | "source": [] 298 | }, 299 | { 300 | "cell_type": "markdown", 301 | "metadata": {}, 302 | "source": [ 303 | "### BONUS: Create your own question and answer it." 304 | ] 305 | }, 306 | { 307 | "cell_type": "code", 308 | "execution_count": null, 309 | "metadata": {}, 310 | "outputs": [], 311 | "source": [] 312 | } 313 | ], 314 | "metadata": { 315 | "kernelspec": { 316 | "display_name": "Python 3", 317 | "language": "python", 318 | "name": "python3" 319 | }, 320 | "language_info": { 321 | "codemirror_mode": { 322 | "name": "ipython", 323 | "version": 3 324 | }, 325 | "file_extension": ".py", 326 | "mimetype": "text/x-python", 327 | "name": "python", 328 | "nbconvert_exporter": "python", 329 | "pygments_lexer": "ipython3", 330 | "version": "3.7.6" 331 | } 332 | }, 333 | "nbformat": 4, 334 | "nbformat_minor": 1 335 | } 336 | -------------------------------------------------------------------------------- /08_Creating_Series_and_DataFrames/Pokemon/Exercises-with-solutions-and-code.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Pokemon" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Introduction:\n", 15 | "\n", 16 | "This time you will create the data.\n", 17 | "\n", 18 | "\n", 19 | "\n", 20 | "### Step 1. Import the necessary libraries" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "import pandas as pd" 30 | ] 31 | }, 32 | { 33 | "cell_type": "markdown", 34 | "metadata": {}, 35 | "source": [ 36 | "### Step 2. Create a data dictionary" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 3, 42 | "metadata": { 43 | "collapsed": true 44 | }, 45 | "outputs": [], 46 | "source": [ 47 | "raw_data = {\"name\": ['Bulbasaur', 'Charmander','Squirtle','Caterpie'],\n", 48 | " \"evolution\": ['Ivysaur','Charmeleon','Wartortle','Metapod'],\n", 49 | " \"type\": ['grass', 'fire', 'water', 'bug'],\n", 50 | " \"hp\": [45, 39, 44, 45],\n", 51 | " \"pokedex\": ['yes', 'no','yes','no'] \n", 52 | " }" 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [ 59 | "### Step 3. Assign it to a variable called pokemon" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": 5, 65 | "metadata": {}, 66 | "outputs": [ 67 | { 68 | "data": { 69 | "text/html": [ 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 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | "
evolutionhpnamepokedextype
0Ivysaur45Bulbasauryesgrass
1Charmeleon39Charmandernofire
2Wartortle44Squirtleyeswater
3Metapod45Caterpienobug
\n", 117 | "
" 118 | ], 119 | "text/plain": [ 120 | " evolution hp name pokedex type\n", 121 | "0 Ivysaur 45 Bulbasaur yes grass\n", 122 | "1 Charmeleon 39 Charmander no fire\n", 123 | "2 Wartortle 44 Squirtle yes water\n", 124 | "3 Metapod 45 Caterpie no bug" 125 | ] 126 | }, 127 | "execution_count": 5, 128 | "metadata": {}, 129 | "output_type": "execute_result" 130 | } 131 | ], 132 | "source": [ 133 | "pokemon = pd.DataFrame(raw_data)\n", 134 | "pokemon.head()" 135 | ] 136 | }, 137 | { 138 | "cell_type": "markdown", 139 | "metadata": {}, 140 | "source": [ 141 | "### Step 4. Ops...it seems the DataFrame columns are in alphabetical order. Place the order of the columns as name, type, hp, evolution, pokedex" 142 | ] 143 | }, 144 | { 145 | "cell_type": "code", 146 | "execution_count": 8, 147 | "metadata": {}, 148 | "outputs": [ 149 | { 150 | "data": { 151 | "text/html": [ 152 | "
\n", 153 | "\n", 154 | " \n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | " \n", 160 | " \n", 161 | " \n", 162 | " \n", 163 | " \n", 164 | " \n", 165 | " \n", 166 | " \n", 167 | " \n", 168 | " \n", 169 | " \n", 170 | " \n", 171 | " \n", 172 | " \n", 173 | " \n", 174 | " \n", 175 | " \n", 176 | " \n", 177 | " \n", 178 | " \n", 179 | " \n", 180 | " \n", 181 | " \n", 182 | " \n", 183 | " \n", 184 | " \n", 185 | " \n", 186 | " \n", 187 | " \n", 188 | " \n", 189 | " \n", 190 | " \n", 191 | " \n", 192 | " \n", 193 | " \n", 194 | " \n", 195 | " \n", 196 | " \n", 197 | " \n", 198 | "
nametypehpevolutionpokedex
0Bulbasaurgrass45Ivysauryes
1Charmanderfire39Charmeleonno
2Squirtlewater44Wartortleyes
3Caterpiebug45Metapodno
\n", 199 | "
" 200 | ], 201 | "text/plain": [ 202 | " name type hp evolution pokedex\n", 203 | "0 Bulbasaur grass 45 Ivysaur yes\n", 204 | "1 Charmander fire 39 Charmeleon no\n", 205 | "2 Squirtle water 44 Wartortle yes\n", 206 | "3 Caterpie bug 45 Metapod no" 207 | ] 208 | }, 209 | "execution_count": 8, 210 | "metadata": {}, 211 | "output_type": "execute_result" 212 | } 213 | ], 214 | "source": [ 215 | "pokemon = pokemon[['name', 'type', 'hp', 'evolution','pokedex']]\n", 216 | "pokemon" 217 | ] 218 | }, 219 | { 220 | "cell_type": "markdown", 221 | "metadata": {}, 222 | "source": [ 223 | "### Step 5. Add another column called place, and insert what you have in mind." 224 | ] 225 | }, 226 | { 227 | "cell_type": "code", 228 | "execution_count": 13, 229 | "metadata": {}, 230 | "outputs": [ 231 | { 232 | "data": { 233 | "text/html": [ 234 | "
\n", 235 | "\n", 236 | " \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 | " \n", 267 | " \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 | "
nametypehpevolutionpokedexplace
0Bulbasaurgrass45Ivysauryespark
1Charmanderfire39Charmeleonnostreet
2Squirtlewater44Wartortleyeslake
3Caterpiebug45Metapodnoforest
\n", 286 | "
" 287 | ], 288 | "text/plain": [ 289 | " name type hp evolution pokedex place\n", 290 | "0 Bulbasaur grass 45 Ivysaur yes park\n", 291 | "1 Charmander fire 39 Charmeleon no street\n", 292 | "2 Squirtle water 44 Wartortle yes lake\n", 293 | "3 Caterpie bug 45 Metapod no forest" 294 | ] 295 | }, 296 | "execution_count": 13, 297 | "metadata": {}, 298 | "output_type": "execute_result" 299 | } 300 | ], 301 | "source": [ 302 | "pokemon['place'] = ['park','street','lake','forest']\n", 303 | "pokemon" 304 | ] 305 | }, 306 | { 307 | "cell_type": "markdown", 308 | "metadata": {}, 309 | "source": [ 310 | "### Step 6. Present the type of each column" 311 | ] 312 | }, 313 | { 314 | "cell_type": "code", 315 | "execution_count": 9, 316 | "metadata": {}, 317 | "outputs": [ 318 | { 319 | "data": { 320 | "text/plain": [ 321 | "name object\n", 322 | "type object\n", 323 | "hp int64\n", 324 | "evolution object\n", 325 | "pokedex object\n", 326 | "dtype: object" 327 | ] 328 | }, 329 | "execution_count": 9, 330 | "metadata": {}, 331 | "output_type": "execute_result" 332 | } 333 | ], 334 | "source": [ 335 | "pokemon.dtypes" 336 | ] 337 | }, 338 | { 339 | "cell_type": "markdown", 340 | "metadata": {}, 341 | "source": [ 342 | "### BONUS: Create your own question and answer it." 343 | ] 344 | }, 345 | { 346 | "cell_type": "code", 347 | "execution_count": null, 348 | "metadata": { 349 | "collapsed": true 350 | }, 351 | "outputs": [], 352 | "source": [] 353 | } 354 | ], 355 | "metadata": { 356 | "kernelspec": { 357 | "display_name": "Python 3", 358 | "language": "python", 359 | "name": "python3" 360 | }, 361 | "language_info": { 362 | "codemirror_mode": { 363 | "name": "ipython", 364 | "version": 3 365 | }, 366 | "file_extension": ".py", 367 | "mimetype": "text/x-python", 368 | "name": "python", 369 | "nbconvert_exporter": "python", 370 | "pygments_lexer": "ipython3", 371 | "version": "3.7.6" 372 | } 373 | }, 374 | "nbformat": 4, 375 | "nbformat_minor": 1 376 | } 377 | -------------------------------------------------------------------------------- /08_Creating_Series_and_DataFrames/Pokemon/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Pokemon" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Create a data dictionary that looks like the DataFrame below" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 3, 34 | "metadata": { 35 | "collapsed": true 36 | }, 37 | "outputs": [], 38 | "source": [] 39 | }, 40 | { 41 | "cell_type": "markdown", 42 | "metadata": {}, 43 | "source": [ 44 | "### Step 3. Assign it to a variable called pokemon" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 5, 50 | "metadata": {}, 51 | "outputs": [ 52 | { 53 | "data": { 54 | "text/html": [ 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 | "
evolutionhpnamepokedextype
0Ivysaur45Bulbasauryesgrass
1Charmeleon39Charmandernofire
2Wartortle44Squirtleyeswater
3Metapod45Caterpienobug
\n", 102 | "
" 103 | ], 104 | "text/plain": [ 105 | " evolution hp name pokedex type\n", 106 | "0 Ivysaur 45 Bulbasaur yes grass\n", 107 | "1 Charmeleon 39 Charmander no fire\n", 108 | "2 Wartortle 44 Squirtle yes water\n", 109 | "3 Metapod 45 Caterpie no bug" 110 | ] 111 | }, 112 | "execution_count": 5, 113 | "metadata": {}, 114 | "output_type": "execute_result" 115 | } 116 | ], 117 | "source": [] 118 | }, 119 | { 120 | "cell_type": "markdown", 121 | "metadata": {}, 122 | "source": [ 123 | "### Step 4. Ops...it seems the DataFrame columns are in alphabetical order. Place the order of the columns as name, type, hp, evolution, pokedex" 124 | ] 125 | }, 126 | { 127 | "cell_type": "code", 128 | "execution_count": null, 129 | "metadata": {}, 130 | "outputs": [], 131 | "source": [] 132 | }, 133 | { 134 | "cell_type": "markdown", 135 | "metadata": {}, 136 | "source": [ 137 | "### Step 5. Add another column called place, and insert what you have in mind." 138 | ] 139 | }, 140 | { 141 | "cell_type": "code", 142 | "execution_count": null, 143 | "metadata": {}, 144 | "outputs": [], 145 | "source": [] 146 | }, 147 | { 148 | "cell_type": "markdown", 149 | "metadata": {}, 150 | "source": [ 151 | "### Step 6. Present the type of each column" 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "execution_count": null, 157 | "metadata": {}, 158 | "outputs": [], 159 | "source": [] 160 | }, 161 | { 162 | "cell_type": "markdown", 163 | "metadata": {}, 164 | "source": [ 165 | "### BONUS: Create your own question and answer it." 166 | ] 167 | }, 168 | { 169 | "cell_type": "code", 170 | "execution_count": null, 171 | "metadata": { 172 | "collapsed": true 173 | }, 174 | "outputs": [], 175 | "source": [] 176 | } 177 | ], 178 | "metadata": { 179 | "kernelspec": { 180 | "display_name": "Python 3", 181 | "language": "python", 182 | "name": "python3" 183 | }, 184 | "language_info": { 185 | "codemirror_mode": { 186 | "name": "ipython", 187 | "version": 3 188 | }, 189 | "file_extension": ".py", 190 | "mimetype": "text/x-python", 191 | "name": "python", 192 | "nbconvert_exporter": "python", 193 | "pygments_lexer": "ipython3", 194 | "version": "3.7.6" 195 | } 196 | }, 197 | "nbformat": 4, 198 | "nbformat_minor": 1 199 | } 200 | -------------------------------------------------------------------------------- /08_Creating_Series_and_DataFrames/Pokemon/Solutions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Pokemon" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Introduction:\n", 15 | "\n", 16 | "This time you will create the data.\n", 17 | "\n", 18 | "\n", 19 | "\n", 20 | "### Step 1. Import the necessary libraries" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": { 27 | "collapsed": false 28 | }, 29 | "outputs": [], 30 | "source": [] 31 | }, 32 | { 33 | "cell_type": "markdown", 34 | "metadata": {}, 35 | "source": [ 36 | "### Step 2. Create a data dictionary" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 3, 42 | "metadata": { 43 | "collapsed": true 44 | }, 45 | "outputs": [], 46 | "source": [] 47 | }, 48 | { 49 | "cell_type": "markdown", 50 | "metadata": {}, 51 | "source": [ 52 | "### Step 3. Assign it to a variable called pokemon" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": 5, 58 | "metadata": { 59 | "collapsed": false 60 | }, 61 | "outputs": [ 62 | { 63 | "data": { 64 | "text/html": [ 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 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | "
evolutionhpnamepokedextype
0Ivysaur45Bulbasauryesgrass
1Charmeleon39Charmandernofire
2Wartortle44Squirtleyeswater
3Metapod45Caterpienobug
\n", 112 | "
" 113 | ], 114 | "text/plain": [ 115 | " evolution hp name pokedex type\n", 116 | "0 Ivysaur 45 Bulbasaur yes grass\n", 117 | "1 Charmeleon 39 Charmander no fire\n", 118 | "2 Wartortle 44 Squirtle yes water\n", 119 | "3 Metapod 45 Caterpie no bug" 120 | ] 121 | }, 122 | "execution_count": 5, 123 | "metadata": {}, 124 | "output_type": "execute_result" 125 | } 126 | ], 127 | "source": [] 128 | }, 129 | { 130 | "cell_type": "markdown", 131 | "metadata": {}, 132 | "source": [ 133 | "### Step 4. Ops...it seems the DataFrame columns are in alphabetical order. Place the order of the columns as name, type, hp, evolution, pokedex" 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": 8, 139 | "metadata": { 140 | "collapsed": false 141 | }, 142 | "outputs": [ 143 | { 144 | "data": { 145 | "text/html": [ 146 | "
\n", 147 | "\n", 148 | " \n", 149 | " \n", 150 | " \n", 151 | " \n", 152 | " \n", 153 | " \n", 154 | " \n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | " \n", 160 | " \n", 161 | " \n", 162 | " \n", 163 | " \n", 164 | " \n", 165 | " \n", 166 | " \n", 167 | " \n", 168 | " \n", 169 | " \n", 170 | " \n", 171 | " \n", 172 | " \n", 173 | " \n", 174 | " \n", 175 | " \n", 176 | " \n", 177 | " \n", 178 | " \n", 179 | " \n", 180 | " \n", 181 | " \n", 182 | " \n", 183 | " \n", 184 | " \n", 185 | " \n", 186 | " \n", 187 | " \n", 188 | " \n", 189 | " \n", 190 | " \n", 191 | " \n", 192 | "
nametypehpevolutionpokedex
0Bulbasaurgrass45Ivysauryes
1Charmanderfire39Charmeleonno
2Squirtlewater44Wartortleyes
3Caterpiebug45Metapodno
\n", 193 | "
" 194 | ], 195 | "text/plain": [ 196 | " name type hp evolution pokedex\n", 197 | "0 Bulbasaur grass 45 Ivysaur yes\n", 198 | "1 Charmander fire 39 Charmeleon no\n", 199 | "2 Squirtle water 44 Wartortle yes\n", 200 | "3 Caterpie bug 45 Metapod no" 201 | ] 202 | }, 203 | "execution_count": 8, 204 | "metadata": {}, 205 | "output_type": "execute_result" 206 | } 207 | ], 208 | "source": [] 209 | }, 210 | { 211 | "cell_type": "markdown", 212 | "metadata": {}, 213 | "source": [ 214 | "### Step 5. Add another column called place, and insert what you have in mind." 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 13, 220 | "metadata": { 221 | "collapsed": false 222 | }, 223 | "outputs": [ 224 | { 225 | "data": { 226 | "text/html": [ 227 | "
\n", 228 | "\n", 229 | " \n", 230 | " \n", 231 | " \n", 232 | " \n", 233 | " \n", 234 | " \n", 235 | " \n", 236 | " \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 | " \n", 267 | " \n", 268 | " \n", 269 | " \n", 270 | " \n", 271 | " \n", 272 | " \n", 273 | " \n", 274 | " \n", 275 | " \n", 276 | " \n", 277 | " \n", 278 | "
nametypehpevolutionpokedexplace
0Bulbasaurgrass45Ivysauryespark
1Charmanderfire39Charmeleonnostreet
2Squirtlewater44Wartortleyeslake
3Caterpiebug45Metapodnoforest
\n", 279 | "
" 280 | ], 281 | "text/plain": [ 282 | " name type hp evolution pokedex place\n", 283 | "0 Bulbasaur grass 45 Ivysaur yes park\n", 284 | "1 Charmander fire 39 Charmeleon no street\n", 285 | "2 Squirtle water 44 Wartortle yes lake\n", 286 | "3 Caterpie bug 45 Metapod no forest" 287 | ] 288 | }, 289 | "execution_count": 13, 290 | "metadata": {}, 291 | "output_type": "execute_result" 292 | } 293 | ], 294 | "source": [] 295 | }, 296 | { 297 | "cell_type": "markdown", 298 | "metadata": {}, 299 | "source": [ 300 | "### Step 6. Present the type of each column" 301 | ] 302 | }, 303 | { 304 | "cell_type": "code", 305 | "execution_count": 9, 306 | "metadata": { 307 | "collapsed": false 308 | }, 309 | "outputs": [ 310 | { 311 | "data": { 312 | "text/plain": [ 313 | "name object\n", 314 | "type object\n", 315 | "hp int64\n", 316 | "evolution object\n", 317 | "pokedex object\n", 318 | "dtype: object" 319 | ] 320 | }, 321 | "execution_count": 9, 322 | "metadata": {}, 323 | "output_type": "execute_result" 324 | } 325 | ], 326 | "source": [] 327 | }, 328 | { 329 | "cell_type": "markdown", 330 | "metadata": {}, 331 | "source": [ 332 | "### BONUS: Create your own question and answer it." 333 | ] 334 | }, 335 | { 336 | "cell_type": "code", 337 | "execution_count": null, 338 | "metadata": { 339 | "collapsed": true 340 | }, 341 | "outputs": [], 342 | "source": [] 343 | } 344 | ], 345 | "metadata": { 346 | "kernelspec": { 347 | "display_name": "Python 2", 348 | "language": "python", 349 | "name": "python2" 350 | }, 351 | "language_info": { 352 | "codemirror_mode": { 353 | "name": "ipython", 354 | "version": 2 355 | }, 356 | "file_extension": ".py", 357 | "mimetype": "text/x-python", 358 | "name": "python", 359 | "nbconvert_exporter": "python", 360 | "pygments_lexer": "ipython2", 361 | "version": "2.7.11" 362 | } 363 | }, 364 | "nbformat": 4, 365 | "nbformat_minor": 0 366 | } 367 | -------------------------------------------------------------------------------- /09_Time_Series/Apple_Stock/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Apple Stock" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : appl_1980_2014.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable apple" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. Check out the type of the columns" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. Transform the Date column as a datetime type" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. Set the date as the index" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. Is there any duplicate dates?" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. Ops...it seems the index is from the most recent date. Make the first entry the oldest date." 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "### Step 9. Get the last business day of each month" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | }, 136 | { 137 | "cell_type": "markdown", 138 | "metadata": {}, 139 | "source": [ 140 | "### Step 10. What is the difference in days between the first day and the oldest" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [] 149 | }, 150 | { 151 | "cell_type": "markdown", 152 | "metadata": {}, 153 | "source": [ 154 | "### Step 11. How many months in the data we have?" 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": null, 160 | "metadata": {}, 161 | "outputs": [], 162 | "source": [] 163 | }, 164 | { 165 | "cell_type": "markdown", 166 | "metadata": {}, 167 | "source": [ 168 | "### Step 12. Plot the 'Adj Close' value. Set the size of the figure to 13.5 x 9 inches" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": null, 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [] 177 | }, 178 | { 179 | "cell_type": "markdown", 180 | "metadata": {}, 181 | "source": [ 182 | "### BONUS: Create your own question and answer it." 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": null, 188 | "metadata": { 189 | "collapsed": true 190 | }, 191 | "outputs": [], 192 | "source": [] 193 | } 194 | ], 195 | "metadata": { 196 | "anaconda-cloud": {}, 197 | "kernelspec": { 198 | "display_name": "Python 3", 199 | "language": "python", 200 | "name": "python3" 201 | }, 202 | "language_info": { 203 | "codemirror_mode": { 204 | "name": "ipython", 205 | "version": 3 206 | }, 207 | "file_extension": ".py", 208 | "mimetype": "text/x-python", 209 | "name": "python", 210 | "nbconvert_exporter": "python", 211 | "pygments_lexer": "ipython3", 212 | "version": "3.7.6" 213 | } 214 | }, 215 | "nbformat": 4, 216 | "nbformat_minor": 1 217 | } 218 | -------------------------------------------------------------------------------- /09_Time_Series/Investor_Flow_of_Funds_US/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Investor - Flow of Funds - US" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : weekly.csv" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 2, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "### Step 3. Assign it to a variable called " 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Step 4. What is the frequency of the dataset?" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### Step 5. Set the column Date as the index." 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "### Step 6. What is the type of the index?" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 7. Set the index to a DatetimeIndex type" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 8. Change the frequency to monthly, sum the values and assign it to monthly." 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "### Step 9. You will notice that it filled the dataFrame with months that don't have any data with NaN. Let's drop these rows." 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | }, 136 | { 137 | "cell_type": "markdown", 138 | "metadata": {}, 139 | "source": [ 140 | "### Step 10. Good, now we have the monthly data. Now change the frequency to year." 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [] 149 | }, 150 | { 151 | "cell_type": "markdown", 152 | "metadata": {}, 153 | "source": [ 154 | "### BONUS: Create your own question and answer it." 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": null, 160 | "metadata": { 161 | "collapsed": true 162 | }, 163 | "outputs": [], 164 | "source": [] 165 | } 166 | ], 167 | "metadata": { 168 | "kernelspec": { 169 | "display_name": "Python 3", 170 | "language": "python", 171 | "name": "python3" 172 | }, 173 | "language_info": { 174 | "codemirror_mode": { 175 | "name": "ipython", 176 | "version": 3 177 | }, 178 | "file_extension": ".py", 179 | "mimetype": "text/x-python", 180 | "name": "python", 181 | "nbconvert_exporter": "python", 182 | "pygments_lexer": "ipython3", 183 | "version": "3.7.6" 184 | } 185 | }, 186 | "nbformat": 4, 187 | "nbformat_minor": 1 188 | } 189 | -------------------------------------------------------------------------------- /09_Time_Series/Investor_Flow_of_Funds_US/weekly.csv: -------------------------------------------------------------------------------- 1 | Date,Total Equity,Domestic Equity,World Equity,Hybrid,Total Bond,Taxable Bond,Municipal Bond,Total 2 | 2012-12-05,-7426,-6060,-1367,-74,5317,4210,1107,-2183 3 | 2012-12-12,-8783,-7520,-1263,123,1818,1598,219,-6842 4 | 2012-12-19,-5496,-5470,-26,-73,103,3472,-3369,-5466 5 | 2012-12-26,-4451,-4076,-375,550,2610,3333,-722,-1291 6 | 2013-01-02,-11156,-9622,-1533,-158,2383,2103,280,-8931 7 | 2013-01-09,14817,7995,6821,2888,9766,7311,2455,27471 8 | 2014-04-02,3155,938,2217,265,3379,3129,250,6799 9 | 2014-04-09,5761,2080,3681,1482,1609,1448,161,8852 10 | 2014-04-16,2286,634,1652,1186,633,604,29,4105 11 | 2014-04-23,3530,1392,2138,1239,1984,1453,531,6753 12 | 2014-04-30,-3890,-3996,106,759,888,559,329,-2242 13 | 2014-05-07,632,-2006,2639,-340,5493,4417,1076,5785 14 | 2014-05-14,-1079,-2321,1242,1188,4037,3141,897,4146 15 | 2014-05-21,697,-1790,2487,1216,2196,1398,798,4109 16 | 2014-05-28,-2453,-2603,150,1108,2041,1236,805,696 17 | 2014-06-04,2098,-1148,3246,1123,188,-470,658,3409 18 | 2014-06-11,1236,-1840,3075,1159,2112,1587,524,4506 19 | 2014-06-18,-922,-2204,1282,1060,4159,3740,419,4297 20 | 2014-06-25,-93,-1354,1262,1246,3256,2694,562,4409 21 | 2014-07-02,-7835,-8887,1052,636,2979,2704,276,-4220 22 | 2014-07-09,666,-1070,1736,1006,2721,3203,-482,4393 23 | 2014-07-30,118,-1171,1290,1024,1806,1119,687,2949 24 | 2014-08-06,-471,-3073,2602,-375,-8193,-8658,465,-9040 25 | 2014-08-13,320,-974,1294,496,1436,539,897,2252 26 | 2014-08-20,2671,738,1933,821,4999,4185,814,8490 27 | 2014-08-27,-577,-2199,1623,943,3655,2921,734,4021 28 | 2014-09-03,-4024,-5305,1281,544,2430,1768,661,-1050 29 | 2014-09-10,1257,-1291,2548,1055,1554,711,843,3866 30 | 2014-11-05,-32,-1634,1602,-176,5813,5284,529,5604 31 | 2014-11-12,1464,61,1403,963,3596,2703,893,6023 32 | 2014-11-19,-3010,-3622,611,99,2529,1758,771,-383 33 | 2014-11-25,-1175,-2044,869,-157,2590,1821,769,1258 34 | 2015-01-07,-3913,-5438,1525,-1057,-3403,-4729,1326,-8373 35 | 2015-01-14,1774,-37,1811,248,3549,2582,967,5572 36 | 2015-01-21,1267,856,411,790,1258,220,1038,3315 37 | 2015-01-28,4343,3455,888,1748,5964,4689,1275,12055 38 | 2015-02-04,4240,3536,703,793,3237,2274,963,8270 39 | 2015-02-11,1268,-27,1296,959,5862,5169,693,8089 40 | 2015-03-04,999,-1933,2932,528,4984,4309,675,6511 41 | 2015-03-11,3911,-7,3918,851,1298,999,298,6059 42 | 2015-03-18,1948,-1758,3706,912,452,258,194,3312 43 | 2015-03-25,-1167,-4478,3311,538,2404,1701,703,1775 44 | 2015-04-01,-1527,-3307,1780,720,-1296,-1392,96,-2103 45 | 2015-04-08,1906,-1321,3227,250,1719,1906,-187,3875 46 | -------------------------------------------------------------------------------- /10_Deleting/Iris/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Iris" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Step 1. Import the necessary libraries" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Step 2. Import the dataset : iris.data" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "### Step 3. Assign it to a variable called iris" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "### Step 4. Create columns for the dataset" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 57, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [ 58 | "# 1. sepal_length (in cm)\n", 59 | "# 2. sepal_width (in cm)\n", 60 | "# 3. petal_length (in cm)\n", 61 | "# 4. petal_width (in cm)\n", 62 | "# 5. class" 63 | ] 64 | }, 65 | { 66 | "cell_type": "markdown", 67 | "metadata": {}, 68 | "source": [ 69 | "### Step 5. Is there any missing value in the dataframe?" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": null, 75 | "metadata": {}, 76 | "outputs": [], 77 | "source": [] 78 | }, 79 | { 80 | "cell_type": "markdown", 81 | "metadata": {}, 82 | "source": [ 83 | "### Step 6. Lets set the values of the rows 10 to 29 of the column 'petal_length' to NaN" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": null, 89 | "metadata": {}, 90 | "outputs": [], 91 | "source": [] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [ 97 | "### Step 7. Good, now lets substitute the NaN values to 1.0" 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "execution_count": null, 103 | "metadata": {}, 104 | "outputs": [], 105 | "source": [] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "metadata": {}, 110 | "source": [ 111 | "### Step 8. Now let's delete the column class" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": null, 117 | "metadata": {}, 118 | "outputs": [], 119 | "source": [] 120 | }, 121 | { 122 | "cell_type": "markdown", 123 | "metadata": {}, 124 | "source": [ 125 | "### Step 9. Set the first 3 rows as NaN" 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": null, 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [] 134 | }, 135 | { 136 | "cell_type": "markdown", 137 | "metadata": {}, 138 | "source": [ 139 | "### Step 10. Delete the rows that have NaN" 140 | ] 141 | }, 142 | { 143 | "cell_type": "code", 144 | "execution_count": null, 145 | "metadata": {}, 146 | "outputs": [], 147 | "source": [] 148 | }, 149 | { 150 | "cell_type": "markdown", 151 | "metadata": {}, 152 | "source": [ 153 | "### Step 11. Reset the index so it begins with 0 again" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": null, 159 | "metadata": {}, 160 | "outputs": [], 161 | "source": [] 162 | }, 163 | { 164 | "cell_type": "markdown", 165 | "metadata": {}, 166 | "source": [ 167 | "### BONUS: Create your own question and answer it." 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": null, 173 | "metadata": { 174 | "collapsed": true 175 | }, 176 | "outputs": [], 177 | "source": [] 178 | } 179 | ], 180 | "metadata": { 181 | "kernelspec": { 182 | "display_name": "Python 3", 183 | "language": "python", 184 | "name": "python3" 185 | }, 186 | "language_info": { 187 | "codemirror_mode": { 188 | "name": "ipython", 189 | "version": 3 190 | }, 191 | "file_extension": ".py", 192 | "mimetype": "text/x-python", 193 | "name": "python", 194 | "nbconvert_exporter": "python", 195 | "pygments_lexer": "ipython3", 196 | "version": "3.7.6" 197 | } 198 | }, 199 | "nbformat": 4, 200 | "nbformat_minor": 1 201 | } 202 | -------------------------------------------------------------------------------- /10_Deleting/Iris/iris.data: -------------------------------------------------------------------------------- 1 | 5.1,3.5,1.4,0.2,Iris-setosa 2 | 4.9,3.0,1.4,0.2,Iris-setosa 3 | 4.7,3.2,1.3,0.2,Iris-setosa 4 | 4.6,3.1,1.5,0.2,Iris-setosa 5 | 5.0,3.6,1.4,0.2,Iris-setosa 6 | 5.4,3.9,1.7,0.4,Iris-setosa 7 | 4.6,3.4,1.4,0.3,Iris-setosa 8 | 5.0,3.4,1.5,0.2,Iris-setosa 9 | 4.4,2.9,1.4,0.2,Iris-setosa 10 | 4.9,3.1,1.5,0.1,Iris-setosa 11 | 5.4,3.7,1.5,0.2,Iris-setosa 12 | 4.8,3.4,1.6,0.2,Iris-setosa 13 | 4.8,3.0,1.4,0.1,Iris-setosa 14 | 4.3,3.0,1.1,0.1,Iris-setosa 15 | 5.8,4.0,1.2,0.2,Iris-setosa 16 | 5.7,4.4,1.5,0.4,Iris-setosa 17 | 5.4,3.9,1.3,0.4,Iris-setosa 18 | 5.1,3.5,1.4,0.3,Iris-setosa 19 | 5.7,3.8,1.7,0.3,Iris-setosa 20 | 5.1,3.8,1.5,0.3,Iris-setosa 21 | 5.4,3.4,1.7,0.2,Iris-setosa 22 | 5.1,3.7,1.5,0.4,Iris-setosa 23 | 4.6,3.6,1.0,0.2,Iris-setosa 24 | 5.1,3.3,1.7,0.5,Iris-setosa 25 | 4.8,3.4,1.9,0.2,Iris-setosa 26 | 5.0,3.0,1.6,0.2,Iris-setosa 27 | 5.0,3.4,1.6,0.4,Iris-setosa 28 | 5.2,3.5,1.5,0.2,Iris-setosa 29 | 5.2,3.4,1.4,0.2,Iris-setosa 30 | 4.7,3.2,1.6,0.2,Iris-setosa 31 | 4.8,3.1,1.6,0.2,Iris-setosa 32 | 5.4,3.4,1.5,0.4,Iris-setosa 33 | 5.2,4.1,1.5,0.1,Iris-setosa 34 | 5.5,4.2,1.4,0.2,Iris-setosa 35 | 4.9,3.1,1.5,0.1,Iris-setosa 36 | 5.0,3.2,1.2,0.2,Iris-setosa 37 | 5.5,3.5,1.3,0.2,Iris-setosa 38 | 4.9,3.1,1.5,0.1,Iris-setosa 39 | 4.4,3.0,1.3,0.2,Iris-setosa 40 | 5.1,3.4,1.5,0.2,Iris-setosa 41 | 5.0,3.5,1.3,0.3,Iris-setosa 42 | 4.5,2.3,1.3,0.3,Iris-setosa 43 | 4.4,3.2,1.3,0.2,Iris-setosa 44 | 5.0,3.5,1.6,0.6,Iris-setosa 45 | 5.1,3.8,1.9,0.4,Iris-setosa 46 | 4.8,3.0,1.4,0.3,Iris-setosa 47 | 5.1,3.8,1.6,0.2,Iris-setosa 48 | 4.6,3.2,1.4,0.2,Iris-setosa 49 | 5.3,3.7,1.5,0.2,Iris-setosa 50 | 5.0,3.3,1.4,0.2,Iris-setosa 51 | 7.0,3.2,4.7,1.4,Iris-versicolor 52 | 6.4,3.2,4.5,1.5,Iris-versicolor 53 | 6.9,3.1,4.9,1.5,Iris-versicolor 54 | 5.5,2.3,4.0,1.3,Iris-versicolor 55 | 6.5,2.8,4.6,1.5,Iris-versicolor 56 | 5.7,2.8,4.5,1.3,Iris-versicolor 57 | 6.3,3.3,4.7,1.6,Iris-versicolor 58 | 4.9,2.4,3.3,1.0,Iris-versicolor 59 | 6.6,2.9,4.6,1.3,Iris-versicolor 60 | 5.2,2.7,3.9,1.4,Iris-versicolor 61 | 5.0,2.0,3.5,1.0,Iris-versicolor 62 | 5.9,3.0,4.2,1.5,Iris-versicolor 63 | 6.0,2.2,4.0,1.0,Iris-versicolor 64 | 6.1,2.9,4.7,1.4,Iris-versicolor 65 | 5.6,2.9,3.6,1.3,Iris-versicolor 66 | 6.7,3.1,4.4,1.4,Iris-versicolor 67 | 5.6,3.0,4.5,1.5,Iris-versicolor 68 | 5.8,2.7,4.1,1.0,Iris-versicolor 69 | 6.2,2.2,4.5,1.5,Iris-versicolor 70 | 5.6,2.5,3.9,1.1,Iris-versicolor 71 | 5.9,3.2,4.8,1.8,Iris-versicolor 72 | 6.1,2.8,4.0,1.3,Iris-versicolor 73 | 6.3,2.5,4.9,1.5,Iris-versicolor 74 | 6.1,2.8,4.7,1.2,Iris-versicolor 75 | 6.4,2.9,4.3,1.3,Iris-versicolor 76 | 6.6,3.0,4.4,1.4,Iris-versicolor 77 | 6.8,2.8,4.8,1.4,Iris-versicolor 78 | 6.7,3.0,5.0,1.7,Iris-versicolor 79 | 6.0,2.9,4.5,1.5,Iris-versicolor 80 | 5.7,2.6,3.5,1.0,Iris-versicolor 81 | 5.5,2.4,3.8,1.1,Iris-versicolor 82 | 5.5,2.4,3.7,1.0,Iris-versicolor 83 | 5.8,2.7,3.9,1.2,Iris-versicolor 84 | 6.0,2.7,5.1,1.6,Iris-versicolor 85 | 5.4,3.0,4.5,1.5,Iris-versicolor 86 | 6.0,3.4,4.5,1.6,Iris-versicolor 87 | 6.7,3.1,4.7,1.5,Iris-versicolor 88 | 6.3,2.3,4.4,1.3,Iris-versicolor 89 | 5.6,3.0,4.1,1.3,Iris-versicolor 90 | 5.5,2.5,4.0,1.3,Iris-versicolor 91 | 5.5,2.6,4.4,1.2,Iris-versicolor 92 | 6.1,3.0,4.6,1.4,Iris-versicolor 93 | 5.8,2.6,4.0,1.2,Iris-versicolor 94 | 5.0,2.3,3.3,1.0,Iris-versicolor 95 | 5.6,2.7,4.2,1.3,Iris-versicolor 96 | 5.7,3.0,4.2,1.2,Iris-versicolor 97 | 5.7,2.9,4.2,1.3,Iris-versicolor 98 | 6.2,2.9,4.3,1.3,Iris-versicolor 99 | 5.1,2.5,3.0,1.1,Iris-versicolor 100 | 5.7,2.8,4.1,1.3,Iris-versicolor 101 | 6.3,3.3,6.0,2.5,Iris-virginica 102 | 5.8,2.7,5.1,1.9,Iris-virginica 103 | 7.1,3.0,5.9,2.1,Iris-virginica 104 | 6.3,2.9,5.6,1.8,Iris-virginica 105 | 6.5,3.0,5.8,2.2,Iris-virginica 106 | 7.6,3.0,6.6,2.1,Iris-virginica 107 | 4.9,2.5,4.5,1.7,Iris-virginica 108 | 7.3,2.9,6.3,1.8,Iris-virginica 109 | 6.7,2.5,5.8,1.8,Iris-virginica 110 | 7.2,3.6,6.1,2.5,Iris-virginica 111 | 6.5,3.2,5.1,2.0,Iris-virginica 112 | 6.4,2.7,5.3,1.9,Iris-virginica 113 | 6.8,3.0,5.5,2.1,Iris-virginica 114 | 5.7,2.5,5.0,2.0,Iris-virginica 115 | 5.8,2.8,5.1,2.4,Iris-virginica 116 | 6.4,3.2,5.3,2.3,Iris-virginica 117 | 6.5,3.0,5.5,1.8,Iris-virginica 118 | 7.7,3.8,6.7,2.2,Iris-virginica 119 | 7.7,2.6,6.9,2.3,Iris-virginica 120 | 6.0,2.2,5.0,1.5,Iris-virginica 121 | 6.9,3.2,5.7,2.3,Iris-virginica 122 | 5.6,2.8,4.9,2.0,Iris-virginica 123 | 7.7,2.8,6.7,2.0,Iris-virginica 124 | 6.3,2.7,4.9,1.8,Iris-virginica 125 | 6.7,3.3,5.7,2.1,Iris-virginica 126 | 7.2,3.2,6.0,1.8,Iris-virginica 127 | 6.2,2.8,4.8,1.8,Iris-virginica 128 | 6.1,3.0,4.9,1.8,Iris-virginica 129 | 6.4,2.8,5.6,2.1,Iris-virginica 130 | 7.2,3.0,5.8,1.6,Iris-virginica 131 | 7.4,2.8,6.1,1.9,Iris-virginica 132 | 7.9,3.8,6.4,2.0,Iris-virginica 133 | 6.4,2.8,5.6,2.2,Iris-virginica 134 | 6.3,2.8,5.1,1.5,Iris-virginica 135 | 6.1,2.6,5.6,1.4,Iris-virginica 136 | 7.7,3.0,6.1,2.3,Iris-virginica 137 | 6.3,3.4,5.6,2.4,Iris-virginica 138 | 6.4,3.1,5.5,1.8,Iris-virginica 139 | 6.0,3.0,4.8,1.8,Iris-virginica 140 | 6.9,3.1,5.4,2.1,Iris-virginica 141 | 6.7,3.1,5.6,2.4,Iris-virginica 142 | 6.9,3.1,5.1,2.3,Iris-virginica 143 | 5.8,2.7,5.1,1.9,Iris-virginica 144 | 6.8,3.2,5.9,2.3,Iris-virginica 145 | 6.7,3.3,5.7,2.5,Iris-virginica 146 | 6.7,3.0,5.2,2.3,Iris-virginica 147 | 6.3,2.5,5.0,1.9,Iris-virginica 148 | 6.5,3.0,5.2,2.0,Iris-virginica 149 | 6.2,3.4,5.4,2.3,Iris-virginica 150 | 5.9,3.0,5.1,1.8,Iris-virginica 151 | 152 | -------------------------------------------------------------------------------- /10_Deleting/Wine/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Wine" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Introduction:\n", 15 | "\n", 16 | "This exercise is a adaptation from the UCI Wine dataset.\n", 17 | "The only pupose is to practice deleting data with pandas.\n", 18 | "\n", 19 | "### Step 1. Import the necessary libraries" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": null, 25 | "metadata": {}, 26 | "outputs": [], 27 | "source": [] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Step 2. Import the dataset : wine.data" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "metadata": {}, 46 | "source": [ 47 | "### Step 3. Assign it to a variable called wine" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [] 56 | }, 57 | { 58 | "cell_type": "markdown", 59 | "metadata": {}, 60 | "source": [ 61 | "### Step 4. Delete the first, fourth, seventh, nineth, eleventh, thirteenth and fourteenth columns" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": null, 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [] 70 | }, 71 | { 72 | "cell_type": "markdown", 73 | "metadata": {}, 74 | "source": [ 75 | "### Step 5. Assign the columns as below:\n", 76 | "\n", 77 | "The attributes are (donated by Riccardo Leardi, riclea '@' anchem.unige.it): \n", 78 | "1) alcohol \n", 79 | "2) malic_acid \n", 80 | "3) alcalinity_of_ash \n", 81 | "4) magnesium \n", 82 | "5) flavanoids \n", 83 | "6) proanthocyanins \n", 84 | "7) hue " 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "### Step 6. Set the values of the first 3 rows from alcohol as NaN" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "### Step 7. Now set the value of the rows 3 and 4 of magnesium as NaN" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "### Step 8. Fill the value of NaN with the number 10 in alcohol and 100 in magnesium" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | }, 136 | { 137 | "cell_type": "markdown", 138 | "metadata": {}, 139 | "source": [ 140 | "### Step 9. Count the number of missing values" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [] 149 | }, 150 | { 151 | "cell_type": "markdown", 152 | "metadata": {}, 153 | "source": [ 154 | "### Step 10. Create an array of 10 random numbers up until 10" 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": null, 160 | "metadata": {}, 161 | "outputs": [], 162 | "source": [] 163 | }, 164 | { 165 | "cell_type": "markdown", 166 | "metadata": {}, 167 | "source": [ 168 | "### Step 11. Use random numbers you generated as an index and assign NaN value to each of cell." 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": null, 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [] 177 | }, 178 | { 179 | "cell_type": "markdown", 180 | "metadata": {}, 181 | "source": [ 182 | "### Step 12. How many missing values do we have?" 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": null, 188 | "metadata": {}, 189 | "outputs": [], 190 | "source": [] 191 | }, 192 | { 193 | "cell_type": "markdown", 194 | "metadata": {}, 195 | "source": [ 196 | "### Step 13. Delete the rows that contain missing values" 197 | ] 198 | }, 199 | { 200 | "cell_type": "code", 201 | "execution_count": null, 202 | "metadata": {}, 203 | "outputs": [], 204 | "source": [] 205 | }, 206 | { 207 | "cell_type": "markdown", 208 | "metadata": {}, 209 | "source": [ 210 | "### Step 14. Print only the non-null values in alcohol" 211 | ] 212 | }, 213 | { 214 | "cell_type": "code", 215 | "execution_count": null, 216 | "metadata": {}, 217 | "outputs": [], 218 | "source": [] 219 | }, 220 | { 221 | "cell_type": "code", 222 | "execution_count": null, 223 | "metadata": { 224 | "collapsed": true 225 | }, 226 | "outputs": [], 227 | "source": [] 228 | }, 229 | { 230 | "cell_type": "markdown", 231 | "metadata": {}, 232 | "source": [ 233 | "### Step 15. Reset the index, so it starts with 0 again" 234 | ] 235 | }, 236 | { 237 | "cell_type": "code", 238 | "execution_count": null, 239 | "metadata": {}, 240 | "outputs": [], 241 | "source": [] 242 | }, 243 | { 244 | "cell_type": "markdown", 245 | "metadata": {}, 246 | "source": [ 247 | "### BONUS: Create your own question and answer it." 248 | ] 249 | }, 250 | { 251 | "cell_type": "code", 252 | "execution_count": null, 253 | "metadata": { 254 | "collapsed": true 255 | }, 256 | "outputs": [], 257 | "source": [] 258 | } 259 | ], 260 | "metadata": { 261 | "kernelspec": { 262 | "display_name": "Python 3", 263 | "language": "python", 264 | "name": "python3" 265 | }, 266 | "language_info": { 267 | "codemirror_mode": { 268 | "name": "ipython", 269 | "version": 3 270 | }, 271 | "file_extension": ".py", 272 | "mimetype": "text/x-python", 273 | "name": "python", 274 | "nbconvert_exporter": "python", 275 | "pygments_lexer": "ipython3", 276 | "version": "3.7.6" 277 | } 278 | }, 279 | "nbformat": 4, 280 | "nbformat_minor": 1 281 | } 282 | -------------------------------------------------------------------------------- /11_Indexing/Exercises.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ex - " 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Introduction:\n", 15 | "\n", 16 | "\n", 17 | "### Step 1. Import the necessary libraries" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 2, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "import pandas as pd" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Step 2. Import the dataset " 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": 3, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "df = pd.read_csv(\"chipotle.csv\")" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "### Step 3. Assign it to a variable called " 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [] 58 | }, 59 | { 60 | "cell_type": "markdown", 61 | "metadata": {}, 62 | "source": [ 63 | "### Step 4. " 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": null, 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": {}, 76 | "source": [ 77 | "### Step 5. " 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": null, 83 | "metadata": {}, 84 | "outputs": [], 85 | "source": [] 86 | }, 87 | { 88 | "cell_type": "markdown", 89 | "metadata": {}, 90 | "source": [ 91 | "### Step 6. " 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": { 98 | "collapsed": true 99 | }, 100 | "outputs": [], 101 | "source": [] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "metadata": {}, 106 | "source": [ 107 | "### Step 7. " 108 | ] 109 | }, 110 | { 111 | "cell_type": "code", 112 | "execution_count": null, 113 | "metadata": {}, 114 | "outputs": [], 115 | "source": [] 116 | }, 117 | { 118 | "cell_type": "markdown", 119 | "metadata": {}, 120 | "source": [ 121 | "### Step 8. " 122 | ] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "execution_count": null, 127 | "metadata": {}, 128 | "outputs": [], 129 | "source": [] 130 | }, 131 | { 132 | "cell_type": "markdown", 133 | "metadata": {}, 134 | "source": [ 135 | "### Step 9. " 136 | ] 137 | }, 138 | { 139 | "cell_type": "code", 140 | "execution_count": null, 141 | "metadata": {}, 142 | "outputs": [], 143 | "source": [] 144 | }, 145 | { 146 | "cell_type": "markdown", 147 | "metadata": {}, 148 | "source": [ 149 | "### Step 10. " 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 | "### Step 11. " 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 | "### Step 12. " 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 | "### Step 13. " 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 | "### Step 14. " 206 | ] 207 | }, 208 | { 209 | "cell_type": "code", 210 | "execution_count": null, 211 | "metadata": { 212 | "collapsed": true 213 | }, 214 | "outputs": [], 215 | "source": [] 216 | }, 217 | { 218 | "cell_type": "markdown", 219 | "metadata": {}, 220 | "source": [ 221 | "### Step 15. " 222 | ] 223 | }, 224 | { 225 | "cell_type": "code", 226 | "execution_count": null, 227 | "metadata": { 228 | "collapsed": true 229 | }, 230 | "outputs": [], 231 | "source": [] 232 | }, 233 | { 234 | "cell_type": "markdown", 235 | "metadata": {}, 236 | "source": [ 237 | "### Step 16. " 238 | ] 239 | }, 240 | { 241 | "cell_type": "code", 242 | "execution_count": null, 243 | "metadata": { 244 | "collapsed": true 245 | }, 246 | "outputs": [], 247 | "source": [] 248 | }, 249 | { 250 | "cell_type": "markdown", 251 | "metadata": {}, 252 | "source": [ 253 | "### BONUS: Create your own question and answer it." 254 | ] 255 | }, 256 | { 257 | "cell_type": "code", 258 | "execution_count": null, 259 | "metadata": { 260 | "collapsed": true 261 | }, 262 | "outputs": [], 263 | "source": [] 264 | } 265 | ], 266 | "metadata": { 267 | "anaconda-cloud": {}, 268 | "kernelspec": { 269 | "display_name": "Python 3", 270 | "language": "python", 271 | "name": "python3" 272 | }, 273 | "language_info": { 274 | "codemirror_mode": { 275 | "name": "ipython", 276 | "version": 3 277 | }, 278 | "file_extension": ".py", 279 | "mimetype": "text/x-python", 280 | "name": "python", 281 | "nbconvert_exporter": "python", 282 | "pygments_lexer": "ipython3", 283 | "version": "3.7.6" 284 | } 285 | }, 286 | "nbformat": 4, 287 | "nbformat_minor": 1 288 | } 289 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pandas_Exercise (In progress) 2 | The purpose of this repository to show various Excel tasks that can be executed using Pandas library in python 3 | 4 | Note: Few datasets still need to add 5 | -------------------------------------------------------------------------------- /dataset/Euro_2012_stats_TEAM.csv: -------------------------------------------------------------------------------- 1 | ,Team,Goals,Shots on target,Shots off target,Shooting Accuracy,% Goals-to-shots,Total shots (inc. Blocked),Hit Woodwork,Penalty goals,Penalties not scored,Headed goals,Passes,Passes completed,Passing Accuracy,Touches,Crosses,Dribbles,Corners Taken,Tackles,Clearances,Interceptions,Clearances off line,Clean Sheets,Blocks,Goals conceded,Saves made,Saves-to-shots ratio,Fouls Won,Fouls Conceded,Offsides,Yellow Cards,Red Cards,Subs on,Subs off,Players Used 2 | 0,Croatia,4,13,12,51.9%,16.0%,32,0,0,0,2,1076,828,76.9%,1706,60,42,14,49,83,56,,0,10,3,13,81.3%,41,62,2,9,0,9,9,16 3 | 1,Czech Republic,4,13,18,41.9%,12.9%,39,0,0,0,0,1565,1223,78.1%,2358,46,68,21,62,98,37,2.0,1,10,6,9,60.1%,53,73,8,7,0,11,11,19 4 | 2,Denmark,4,10,10,50.0%,20.0%,27,1,0,0,3,1298,1082,83.3%,1873,43,32,16,40,61,59,0.0,1,10,5,10,66.7%,25,38,8,4,0,7,7,15 5 | 3,England,5,11,18,50.0%,17.2%,40,0,0,0,3,1488,1200,80.6%,2440,58,60,16,86,106,72,1.0,2,29,3,22,88.1%,43,45,6,5,0,11,11,16 6 | 4,France,3,22,24,37.9%,6.5%,65,1,0,0,0,2066,1803,87.2%,2909,55,76,28,71,76,58,0.0,1,7,5,6,54.6%,36,51,5,6,0,11,11,19 7 | 5,Germany,10,32,32,47.8%,15.6%,80,2,1,0,2,2774,2427,87.4%,3761,101,60,35,91,73,69,0.0,1,11,6,10,62.6%,63,49,12,4,0,15,15,17 8 | 6,Greece,5,8,18,30.7%,19.2%,32,1,1,1,0,1187,911,76.7%,2016,52,53,10,65,123,87,0.0,1,23,7,13,65.1%,67,48,12,9,1,12,12,20 9 | 7,Italy,6,34,45,43.0%,7.5%,110,2,0,0,2,3016,2531,83.9%,4363,75,75,30,98,137,136,1.0,2,18,7,20,74.1%,101,89,16,16,0,18,18,19 10 | 8,Netherlands,2,12,36,25.0%,4.1%,60,2,0,0,0,1556,1381,88.7%,2163,50,49,22,34,41,41,0.0,0,9,5,12,70.6%,35,30,3,5,0,7,7,15 11 | 9,Poland,2,15,23,39.4%,5.2%,48,0,0,0,1,1059,852,80.4%,1724,55,39,14,67,87,62,0.0,0,8,3,6,66.7%,48,56,3,7,1,7,7,17 12 | 10,Portugal,6,22,42,34.3%,9.3%,82,6,0,0,2,1891,1461,77.2%,2958,91,64,41,78,92,86,0.0,2,11,4,10,71.5%,73,90,10,12,0,14,14,16 13 | 11,Republic of Ireland,1,7,12,36.8%,5.2%,28,0,0,0,1,851,606,71.2%,1433,43,18,8,45,78,43,1.0,0,23,9,17,65.4%,43,51,11,6,1,10,10,17 14 | 12,Russia,5,9,31,22.5%,12.5%,59,2,0,0,1,1602,1345,83.9%,2278,40,40,21,65,74,58,0.0,0,8,3,10,77.0%,34,43,4,6,0,7,7,16 15 | 13,Spain,12,42,33,55.9%,16.0%,100,0,1,0,2,4317,3820,88.4%,5585,69,106,44,122,102,79,0.0,5,8,1,15,93.8%,102,83,19,11,0,17,17,18 16 | 14,Sweden,5,17,19,47.2%,13.8%,39,3,0,0,1,1192,965,80.9%,1806,44,29,7,56,54,45,0.0,1,12,5,8,61.6%,35,51,7,7,0,9,9,18 17 | 15,Ukraine,2,7,26,21.2%,6.0%,38,0,0,0,2,1276,1043,81.7%,1894,33,26,18,65,97,29,0.0,0,4,4,13,76.5%,48,31,4,5,0,9,9,18 18 | -------------------------------------------------------------------------------- /dataset/US_Crime_Rates_1960_2014.csv: -------------------------------------------------------------------------------- 1 | Year,Population,Total,Violent,Property,Murder,Forcible_Rape,Robbery,Aggravated_assault,Burglary,Larceny_Theft,Vehicle_Theft 1960,179323175,3384200,288460,3095700,9110,17190,107840,154320,912100,1855400,328200 1961,182992000,3488000,289390,3198600,8740,17220,106670,156760,949600,1913000,336000 1962,185771000,3752200,301510,3450700,8530,17550,110860,164570,994300,2089600,366800 1963,188483000,4109500,316970,3792500,8640,17650,116470,174210,1086400,2297800,408300 1964,191141000,4564600,364220,4200400,9360,21420,130390,203050,1213200,2514400,472800 1965,193526000,4739400,387390,4352000,9960,23410,138690,215330,1282500,2572600,496900 1966,195576000,5223500,430180,4793300,11040,25820,157990,235330,1410100,2822000,561200 1967,197457000,5903400,499930,5403500,12240,27620,202910,257160,1632100,3111600,659800 1968,199399000,6720200,595010,6125200,13800,31670,262840,286700,1858900,3482700,783600 1969,201385000,7410900,661870,6749000,14760,37170,298850,311090,1981900,3888600,878500 1970,203235298,8098000,738820,7359200,16000,37990,349860,334970,2205000,4225800,928400 1971,206212000,8588200,816500,7771700,17780,42260,387700,368760,2399300,4424200,948200 1972,208230000,8248800,834900,7413900,18670,46850,376290,393090,2375500,4151200,887200 1973,209851000,8718100,875910,7842200,19640,51400,384220,420650,2565500,4347900,928800 1974,211392000,10253400,974720,9278700,20710,55400,442400,456210,3039200,5262500,977100 1975,213124000,11292400,1039710,10252700,20510,56090,470500,492620,3265300,5977700,1009600 1976,214659000,11349700,1004210,10345500,18780,57080,427810,500530,3108700,6270800,966000 1977,216332000,10984500,1029580,9955000,19120,63500,412610,534350,3071500,5905700,977700 1978,218059000,11209000,1085550,10123400,19560,67610,426930,571460,3128300,5991000,1004100 1979,220099000,12249500,1208030,11041500,21460,76390,480700,629480,3327700,6601000,1112800 1980,225349264,13408300,1344520,12063700,23040,82990,565840,672650,3795200,7136900,1131700 1981,229146000,13423800,1361820,12061900,22520,82500,592910,663900,3779700,7194400,1087800 1982,231534000,12974400,1322390,11652000,21010,78770,553130,669480,3447100,7142500,1062400 1983,233981000,12108600,1258090,10850500,19310,78920,506570,653290,3129900,6712800,1007900 1984,236158000,11881800,1273280,10608500,18690,84230,485010,685350,2984400,6591900,1032200 1985,238740000,12431400,1328800,11102600,18980,88670,497870,723250,3073300,6926400,1102900 1986,240132887,13211869,1489169,11722700,20613,91459,542775,834322,3241410,7257153,1224137 1987,242282918,13508700,1483999,12024700,20096,91110,517704,855088,3236184,7499900,1288674 1988,245807000,13923100,1566220,12356900,20680,92490,542970,910090,3218100,7705900,1432900 1989,248239000,14251400,1646040,12605400,21500,94500,578330,951710,3168200,7872400,1564800 1990,248709873,14475600,1820130,12655500,23440,102560,639270,1054860,3073900,7945700,1635900 1991,252177000,14872900,1911770,12961100,24700,106590,687730,1092740,3157200,8142200,1661700 1992,255082000,14438200,1932270,12505900,23760,109060,672480,1126970,2979900,7915200,1610800 1993,257908000,14144800,1926020,12218800,24530,106010,659870,1135610,2834800,7820900,1563100 1994,260341000,13989500,1857670,12131900,23330,102220,618950,1113180,2712800,7879800,1539300 1995,262755000,13862700,1798790,12063900,21610,97470,580510,1099210,2593800,7997700,1472400 1996,265228572,13493863,1688540,11805300,19650,96250,535590,1037050,2506400,7904700,1394200 1997,267637000,13194571,1634770,11558175,18208,96153,498534,1023201,2460526,7743760,1354189 1998,270296000,12475634,1531044,10944590,16914,93103,446625,974402,2329950,7373886,1240754 1999,272690813,11634378,1426044,10208334,15522,89411,409371,911740,2100739,6955520,1152075 2000,281421906,11608072,1425486,10182586,15586,90178,408016,911706,2050992,6971590,1160002 2001,285317559,11876669,1439480,10437480,16037,90863,423557,909023,2116531,7092267,1228391 2002,287973924,11878954,1423677,10455277,16229,95235,420806,891407,2151252,7057370,1246646 2003,290690788,11826538,1383676,10442862,16528,93883,414235,859030,2154834,7026802,1261226 2004,293656842,11679474,1360088,10319386,16148,95089,401470,847381,2144446,6937089,1237851 2005,296507061,11565499,1390745,10174754,16740,94347,417438,862220,2155448,6783447,1235859 2006,299398484,11401511,1418043,9983568,17030,92757,447403,860853,2183746,6607013,1192809 2007,301621157,11251828,1408337,9843481,16929,90427,445125,855856,2176140,6568572,1095769 2008,304374846,11160543,1392628,9767915,16442,90479,443574,842134,2228474,6588046,958629 2009,307006550,10762956,1325896,9337060,15399,89241,408742,812514,2203313,6338095,795652 2010,309330219,10363873,1251248,9112625,14772,85593,369089,781844,2168457,6204601,739565 2011,311587816,10258774,1206031,9052743,14661,84175,354772,752423,2185140,6151095,716508 2012,313873685,10219059,1217067,9001992,14866,85141,355051,762009,2109932,6168874,723186 2013,316497531,9850445,1199684,8650761,14319,82109,345095,726575,1931835,6018632,700294 2014,318857056,9475816,1197987,8277829,14249,84041,325802,741291,1729806,5858496,689527 -------------------------------------------------------------------------------- /dataset/cars1.csv: -------------------------------------------------------------------------------- 1 | mpg,cylinders,displacement,horsepower,weight,acceleration,model,origin,car,,,,, 18.0,8,307,130,3504,12.0,70,1,chevrolet chevelle malibu,,,,, 15.0,8,350,165,3693,11.5,70,1,buick skylark 320,,,,, 18.0,8,318,150,3436,11.0,70,1,plymouth satellite,,,,, 16.0,8,304,150,3433,12.0,70,1,amc rebel sst,,,,, 17.0,8,302,140,3449,10.5,70,1,ford torino,,,,, 15.0,8,429,198,4341,10.0,70,1,ford galaxie 500,,,,, 14.0,8,454,220,4354,9.0,70,1,chevrolet impala,,,,, 14.0,8,440,215,4312,8.5,70,1,plymouth fury iii,,,,, 14.0,8,455,225,4425,10.0,70,1,pontiac catalina,,,,, 15.0,8,390,190,3850,8.5,70,1,amc ambassador dpl,,,,, 15.0,8,383,170,3563,10.0,70,1,dodge challenger se,,,,, 14.0,8,340,160,3609,8.0,70,1,plymouth 'cuda 340,,,,, 15.0,8,400,150,3761,9.5,70,1,chevrolet monte carlo,,,,, 14.0,8,455,225,3086,10.0,70,1,buick estate wagon (sw),,,,, 24.0,4,113,95,2372,15.0,70,3,toyota corona mark ii,,,,, 22.0,6,198,95,2833,15.5,70,1,plymouth duster,,,,, 18.0,6,199,97,2774,15.5,70,1,amc hornet,,,,, 21.0,6,200,85,2587,16.0,70,1,ford maverick,,,,, 27.0,4,97,88,2130,14.5,70,3,datsun pl510,,,,, 26.0,4,97,46,1835,20.5,70,2,volkswagen 1131 deluxe sedan,,,,, 25.0,4,110,87,2672,17.5,70,2,peugeot 504,,,,, 24.0,4,107,90,2430,14.5,70,2,audi 100 ls,,,,, 25.0,4,104,95,2375,17.5,70,2,saab 99e,,,,, 26.0,4,121,113,2234,12.5,70,2,bmw 2002,,,,, 21.0,6,199,90,2648,15.0,70,1,amc gremlin,,,,, 10.0,8,360,215,4615,14.0,70,1,ford f250,,,,, 10.0,8,307,200,4376,15.0,70,1,chevy c20,,,,, 11.0,8,318,210,4382,13.5,70,1,dodge d200,,,,, 9.0,8,304,193,4732,18.5,70,1,hi 1200d,,,,, 27.0,4,97,88,2130,14.5,71,3,datsun pl510,,,,, 28.0,4,140,90,2264,15.5,71,1,chevrolet vega 2300,,,,, 25.0,4,113,95,2228,14.0,71,3,toyota corona,,,,, 25.0,4,98,?,2046,19.0,71,1,ford pinto,,,,, 19.0,6,232,100,2634,13.0,71,1,amc gremlin,,,,, 16.0,6,225,105,3439,15.5,71,1,plymouth satellite custom,,,,, 17.0,6,250,100,3329,15.5,71,1,chevrolet chevelle malibu,,,,, 19.0,6,250,88,3302,15.5,71,1,ford torino 500,,,,, 18.0,6,232,100,3288,15.5,71,1,amc matador,,,,, 14.0,8,350,165,4209,12.0,71,1,chevrolet impala,,,,, 14.0,8,400,175,4464,11.5,71,1,pontiac catalina brougham,,,,, 14.0,8,351,153,4154,13.5,71,1,ford galaxie 500,,,,, 14.0,8,318,150,4096,13.0,71,1,plymouth fury iii,,,,, 12.0,8,383,180,4955,11.5,71,1,dodge monaco (sw),,,,, 13.0,8,400,170,4746,12.0,71,1,ford country squire (sw),,,,, 13.0,8,400,175,5140,12.0,71,1,pontiac safari (sw),,,,, 18.0,6,258,110,2962,13.5,71,1,amc hornet sportabout (sw),,,,, 22.0,4,140,72,2408,19.0,71,1,chevrolet vega (sw),,,,, 19.0,6,250,100,3282,15.0,71,1,pontiac firebird,,,,, 18.0,6,250,88,3139,14.5,71,1,ford mustang,,,,, 23.0,4,122,86,2220,14.0,71,1,mercury capri 2000,,,,, 28.0,4,116,90,2123,14.0,71,2,opel 1900,,,,, 30.0,4,79,70,2074,19.5,71,2,peugeot 304,,,,, 30.0,4,88,76,2065,14.5,71,2,fiat 124b,,,,, 31.0,4,71,65,1773,19.0,71,3,toyota corolla 1200,,,,, 35.0,4,72,69,1613,18.0,71,3,datsun 1200,,,,, 27.0,4,97,60,1834,19.0,71,2,volkswagen model 111,,,,, 26.0,4,91,70,1955,20.5,71,1,plymouth cricket,,,,, 24.0,4,113,95,2278,15.5,72,3,toyota corona hardtop,,,,, 25.0,4,98,80,2126,17.0,72,1,dodge colt hardtop,,,,, 23.0,4,97,54,2254,23.5,72,2,volkswagen type 3,,,,, 20.0,4,140,90,2408,19.5,72,1,chevrolet vega,,,,, 21.0,4,122,86,2226,16.5,72,1,ford pinto runabout,,,,, 13.0,8,350,165,4274,12.0,72,1,chevrolet impala,,,,, 14.0,8,400,175,4385,12.0,72,1,pontiac catalina,,,,, 15.0,8,318,150,4135,13.5,72,1,plymouth fury iii,,,,, 14.0,8,351,153,4129,13.0,72,1,ford galaxie 500,,,,, 17.0,8,304,150,3672,11.5,72,1,amc ambassador sst,,,,, 11.0,8,429,208,4633,11.0,72,1,mercury marquis,,,,, 13.0,8,350,155,4502,13.5,72,1,buick lesabre custom,,,,, 12.0,8,350,160,4456,13.5,72,1,oldsmobile delta 88 royale,,,,, 13.0,8,400,190,4422,12.5,72,1,chrysler newport royal,,,,, 19.0,3,70,97,2330,13.5,72,3,mazda rx2 coupe,,,,, 15.0,8,304,150,3892,12.5,72,1,amc matador (sw),,,,, 13.0,8,307,130,4098,14.0,72,1,chevrolet chevelle concours (sw),,,,, 13.0,8,302,140,4294,16.0,72,1,ford gran torino (sw),,,,, 14.0,8,318,150,4077,14.0,72,1,plymouth satellite custom (sw),,,,, 18.0,4,121,112,2933,14.5,72,2,volvo 145e (sw),,,,, 22.0,4,121,76,2511,18.0,72,2,volkswagen 411 (sw),,,,, 21.0,4,120,87,2979,19.5,72,2,peugeot 504 (sw),,,,, 26.0,4,96,69,2189,18.0,72,2,renault 12 (sw),,,,, 22.0,4,122,86,2395,16.0,72,1,ford pinto (sw),,,,, 28.0,4,97,92,2288,17.0,72,3,datsun 510 (sw),,,,, 23.0,4,120,97,2506,14.5,72,3,toyouta corona mark ii (sw),,,,, 28.0,4,98,80,2164,15.0,72,1,dodge colt (sw),,,,, 27.0,4,97,88,2100,16.5,72,3,toyota corolla 1600 (sw),,,,, 13.0,8,350,175,4100,13.0,73,1,buick century 350,,,,, 14.0,8,304,150,3672,11.5,73,1,amc matador,,,,, 13.0,8,350,145,3988,13.0,73,1,chevrolet malibu,,,,, 14.0,8,302,137,4042,14.5,73,1,ford gran torino,,,,, 15.0,8,318,150,3777,12.5,73,1,dodge coronet custom,,,,, 12.0,8,429,198,4952,11.5,73,1,mercury marquis brougham,,,,, 13.0,8,400,150,4464,12.0,73,1,chevrolet caprice classic,,,,, 13.0,8,351,158,4363,13.0,73,1,ford ltd,,,,, 14.0,8,318,150,4237,14.5,73,1,plymouth fury gran sedan,,,,, 13.0,8,440,215,4735,11.0,73,1,chrysler new yorker brougham,,,,, 12.0,8,455,225,4951,11.0,73,1,buick electra 225 custom,,,,, 13.0,8,360,175,3821,11.0,73,1,amc ambassador brougham,,,,, 18.0,6,225,105,3121,16.5,73,1,plymouth valiant,,,,, 16.0,6,250,100,3278,18.0,73,1,chevrolet nova custom,,,,, 18.0,6,232,100,2945,16.0,73,1,amc hornet,,,,, 18.0,6,250,88,3021,16.5,73,1,ford maverick,,,,, 23.0,6,198,95,2904,16.0,73,1,plymouth duster,,,,, 26.0,4,97,46,1950,21.0,73,2,volkswagen super beetle,,,,, 11.0,8,400,150,4997,14.0,73,1,chevrolet impala,,,,, 12.0,8,400,167,4906,12.5,73,1,ford country,,,,, 13.0,8,360,170,4654,13.0,73,1,plymouth custom suburb,,,,, 12.0,8,350,180,4499,12.5,73,1,oldsmobile vista cruiser,,,,, 18.0,6,232,100,2789,15.0,73,1,amc gremlin,,,,, 20.0,4,97,88,2279,19.0,73,3,toyota carina,,,,, 21.0,4,140,72,2401,19.5,73,1,chevrolet vega,,,,, 22.0,4,108,94,2379,16.5,73,3,datsun 610,,,,, 18.0,3,70,90,2124,13.5,73,3,maxda rx3,,,,, 19.0,4,122,85,2310,18.5,73,1,ford pinto,,,,, 21.0,6,155,107,2472,14.0,73,1,mercury capri v6,,,,, 26.0,4,98,90,2265,15.5,73,2,fiat 124 sport coupe,,,,, 15.0,8,350,145,4082,13.0,73,1,chevrolet monte carlo s,,,,, 16.0,8,400,230,4278,9.5,73,1,pontiac grand prix,,,,, 29.0,4,68,49,1867,19.5,73,2,fiat 128,,,,, 24.0,4,116,75,2158,15.5,73,2,opel manta,,,,, 20.0,4,114,91,2582,14.0,73,2,audi 100ls,,,,, 19.0,4,121,112,2868,15.5,73,2,volvo 144ea,,,,, 15.0,8,318,150,3399,11.0,73,1,dodge dart custom,,,,, 24.0,4,121,110,2660,14.0,73,2,saab 99le,,,,, 20.0,6,156,122,2807,13.5,73,3,toyota mark ii,,,,, 11.0,8,350,180,3664,11.0,73,1,oldsmobile omega,,,,, 20.0,6,198,95,3102,16.5,74,1,plymouth duster,,,,, 21.0,6,200,?,2875,17.0,74,1,ford maverick,,,,, 19.0,6,232,100,2901,16.0,74,1,amc hornet,,,,, 15.0,6,250,100,3336,17.0,74,1,chevrolet nova,,,,, 31.0,4,79,67,1950,19.0,74,3,datsun b210,,,,, 26.0,4,122,80,2451,16.5,74,1,ford pinto,,,,, 32.0,4,71,65,1836,21.0,74,3,toyota corolla 1200,,,,, 25.0,4,140,75,2542,17.0,74,1,chevrolet vega,,,,, 16.0,6,250,100,3781,17.0,74,1,chevrolet chevelle malibu classic,,,,, 16.0,6,258,110,3632,18.0,74,1,amc matador,,,,, 18.0,6,225,105,3613,16.5,74,1,plymouth satellite sebring,,,,, 16.0,8,302,140,4141,14.0,74,1,ford gran torino,,,,, 13.0,8,350,150,4699,14.5,74,1,buick century luxus (sw),,,,, 14.0,8,318,150,4457,13.5,74,1,dodge coronet custom (sw),,,,, 14.0,8,302,140,4638,16.0,74,1,ford gran torino (sw),,,,, 14.0,8,304,150,4257,15.5,74,1,amc matador (sw),,,,, 29.0,4,98,83,2219,16.5,74,2,audi fox,,,,, 26.0,4,79,67,1963,15.5,74,2,volkswagen dasher,,,,, 26.0,4,97,78,2300,14.5,74,2,opel manta,,,,, 31.0,4,76,52,1649,16.5,74,3,toyota corona,,,,, 32.0,4,83,61,2003,19.0,74,3,datsun 710,,,,, 28.0,4,90,75,2125,14.5,74,1,dodge colt,,,,, 24.0,4,90,75,2108,15.5,74,2,fiat 128,,,,, 26.0,4,116,75,2246,14.0,74,2,fiat 124 tc,,,,, 24.0,4,120,97,2489,15.0,74,3,honda civic,,,,, 26.0,4,108,93,2391,15.5,74,3,subaru,,,,, 31.0,4,79,67,2000,16.0,74,2,fiat x1.9,,,,, 19.0,6,225,95,3264,16.0,75,1,plymouth valiant custom,,,,, 18.0,6,250,105,3459,16.0,75,1,chevrolet nova,,,,, 15.0,6,250,72,3432,21.0,75,1,mercury monarch,,,,, 15.0,6,250,72,3158,19.5,75,1,ford maverick,,,,, 16.0,8,400,170,4668,11.5,75,1,pontiac catalina,,,,, 15.0,8,350,145,4440,14.0,75,1,chevrolet bel air,,,,, 16.0,8,318,150,4498,14.5,75,1,plymouth grand fury,,,,, 14.0,8,351,148,4657,13.5,75,1,ford ltd,,,,, 17.0,6,231,110,3907,21.0,75,1,buick century,,,,, 16.0,6,250,105,3897,18.5,75,1,chevroelt chevelle malibu,,,,, 15.0,6,258,110,3730,19.0,75,1,amc matador,,,,, 18.0,6,225,95,3785,19.0,75,1,plymouth fury,,,,, 21.0,6,231,110,3039,15.0,75,1,buick skyhawk,,,,, 20.0,8,262,110,3221,13.5,75,1,chevrolet monza 2+2,,,,, 13.0,8,302,129,3169,12.0,75,1,ford mustang ii,,,,, 29.0,4,97,75,2171,16.0,75,3,toyota corolla,,,,, 23.0,4,140,83,2639,17.0,75,1,ford pinto,,,,, 20.0,6,232,100,2914,16.0,75,1,amc gremlin,,,,, 23.0,4,140,78,2592,18.5,75,1,pontiac astro,,,,, 24.0,4,134,96,2702,13.5,75,3,toyota corona,,,,, 25.0,4,90,71,2223,16.5,75,2,volkswagen dasher,,,,, 24.0,4,119,97,2545,17.0,75,3,datsun 710,,,,, 18.0,6,171,97,2984,14.5,75,1,ford pinto,,,,, 29.0,4,90,70,1937,14.0,75,2,volkswagen rabbit,,,,, 19.0,6,232,90,3211,17.0,75,1,amc pacer,,,,, 23.0,4,115,95,2694,15.0,75,2,audi 100ls,,,,, 23.0,4,120,88,2957,17.0,75,2,peugeot 504,,,,, 22.0,4,121,98,2945,14.5,75,2,volvo 244dl,,,,, 25.0,4,121,115,2671,13.5,75,2,saab 99le,,,,, 33.0,4,91,53,1795,17.5,75,3,honda civic cvcc,,,,, 28.0,4,107,86,2464,15.5,76,2,fiat 131,,,,, 25.0,4,116,81,2220,16.9,76,2,opel 1900,,,,, 25.0,4,140,92,2572,14.9,76,1,capri ii,,,,, 26.0,4,98,79,2255,17.7,76,1,dodge colt,,,,, 27.0,4,101,83,2202,15.3,76,2,renault 12tl,,,,, 17.5,8,305,140,4215,13.0,76,1,chevrolet chevelle malibu classic,,,,, 16.0,8,318,150,4190,13.0,76,1,dodge coronet brougham,,,,, 15.5,8,304,120,3962,13.9,76,1,amc matador,,,,, 14.5,8,351,152,4215,12.8,76,1,ford gran torino,,,,, 22.0,6,225,100,3233,15.4,76,1,plymouth valiant,,,,, 22.0,6,250,105,3353,14.5,76,1,chevrolet nova,,,,, 24.0,6,200,81,3012,17.6,76,1,ford maverick,,,,, 22.5,6,232,90,3085,17.6,76,1,amc hornet,,,,, 29.0,4,85,52,2035,22.2,76,1,chevrolet chevette,,,,, 24.5,4,98,60,2164,22.1,76,1,chevrolet woody,,,,, 29.0,4,90,70,1937,14.2,76,2,vw rabbit,,,,, -------------------------------------------------------------------------------- /dataset/cars2.csv: -------------------------------------------------------------------------------- 1 | mpg,cylinders,displacement,horsepower,weight,acceleration,model,origin,car 33.0,4,91,53,1795,17.4,76,3,honda civic 20.0,6,225,100,3651,17.7,76,1,dodge aspen se 18.0,6,250,78,3574,21.0,76,1,ford granada ghia 18.5,6,250,110,3645,16.2,76,1,pontiac ventura sj 17.5,6,258,95,3193,17.8,76,1,amc pacer d/l 29.5,4,97,71,1825,12.2,76,2,volkswagen rabbit 32.0,4,85,70,1990,17.0,76,3,datsun b-210 28.0,4,97,75,2155,16.4,76,3,toyota corolla 26.5,4,140,72,2565,13.6,76,1,ford pinto 20.0,4,130,102,3150,15.7,76,2,volvo 245 13.0,8,318,150,3940,13.2,76,1,plymouth volare premier v8 19.0,4,120,88,3270,21.9,76,2,peugeot 504 19.0,6,156,108,2930,15.5,76,3,toyota mark ii 16.5,6,168,120,3820,16.7,76,2,mercedes-benz 280s 16.5,8,350,180,4380,12.1,76,1,cadillac seville 13.0,8,350,145,4055,12.0,76,1,chevy c10 13.0,8,302,130,3870,15.0,76,1,ford f108 13.0,8,318,150,3755,14.0,76,1,dodge d100 31.5,4,98,68,2045,18.5,77,3,honda accord cvcc 30.0,4,111,80,2155,14.8,77,1,buick opel isuzu deluxe 36.0,4,79,58,1825,18.6,77,2,renault 5 gtl 25.5,4,122,96,2300,15.5,77,1,plymouth arrow gs 33.5,4,85,70,1945,16.8,77,3,datsun f-10 hatchback 17.5,8,305,145,3880,12.5,77,1,chevrolet caprice classic 17.0,8,260,110,4060,19.0,77,1,oldsmobile cutlass supreme 15.5,8,318,145,4140,13.7,77,1,dodge monaco brougham 15.0,8,302,130,4295,14.9,77,1,mercury cougar brougham 17.5,6,250,110,3520,16.4,77,1,chevrolet concours 20.5,6,231,105,3425,16.9,77,1,buick skylark 19.0,6,225,100,3630,17.7,77,1,plymouth volare custom 18.5,6,250,98,3525,19.0,77,1,ford granada 16.0,8,400,180,4220,11.1,77,1,pontiac grand prix lj 15.5,8,350,170,4165,11.4,77,1,chevrolet monte carlo landau 15.5,8,400,190,4325,12.2,77,1,chrysler cordoba 16.0,8,351,149,4335,14.5,77,1,ford thunderbird 29.0,4,97,78,1940,14.5,77,2,volkswagen rabbit custom 24.5,4,151,88,2740,16.0,77,1,pontiac sunbird coupe 26.0,4,97,75,2265,18.2,77,3,toyota corolla liftback 25.5,4,140,89,2755,15.8,77,1,ford mustang ii 2+2 30.5,4,98,63,2051,17.0,77,1,chevrolet chevette 33.5,4,98,83,2075,15.9,77,1,dodge colt m/m 30.0,4,97,67,1985,16.4,77,3,subaru dl 30.5,4,97,78,2190,14.1,77,2,volkswagen dasher 22.0,6,146,97,2815,14.5,77,3,datsun 810 21.5,4,121,110,2600,12.8,77,2,bmw 320i 21.5,3,80,110,2720,13.5,77,3,mazda rx-4 43.1,4,90,48,1985,21.5,78,2,volkswagen rabbit custom diesel 36.1,4,98,66,1800,14.4,78,1,ford fiesta 32.8,4,78,52,1985,19.4,78,3,mazda glc deluxe 39.4,4,85,70,2070,18.6,78,3,datsun b210 gx 36.1,4,91,60,1800,16.4,78,3,honda civic cvcc 19.9,8,260,110,3365,15.5,78,1,oldsmobile cutlass salon brougham 19.4,8,318,140,3735,13.2,78,1,dodge diplomat 20.2,8,302,139,3570,12.8,78,1,mercury monarch ghia 19.2,6,231,105,3535,19.2,78,1,pontiac phoenix lj 20.5,6,200,95,3155,18.2,78,1,chevrolet malibu 20.2,6,200,85,2965,15.8,78,1,ford fairmont (auto) 25.1,4,140,88,2720,15.4,78,1,ford fairmont (man) 20.5,6,225,100,3430,17.2,78,1,plymouth volare 19.4,6,232,90,3210,17.2,78,1,amc concord 20.6,6,231,105,3380,15.8,78,1,buick century special 20.8,6,200,85,3070,16.7,78,1,mercury zephyr 18.6,6,225,110,3620,18.7,78,1,dodge aspen 18.1,6,258,120,3410,15.1,78,1,amc concord d/l 19.2,8,305,145,3425,13.2,78,1,chevrolet monte carlo landau 17.7,6,231,165,3445,13.4,78,1,buick regal sport coupe (turbo) 18.1,8,302,139,3205,11.2,78,1,ford futura 17.5,8,318,140,4080,13.7,78,1,dodge magnum xe 30.0,4,98,68,2155,16.5,78,1,chevrolet chevette 27.5,4,134,95,2560,14.2,78,3,toyota corona 27.2,4,119,97,2300,14.7,78,3,datsun 510 30.9,4,105,75,2230,14.5,78,1,dodge omni 21.1,4,134,95,2515,14.8,78,3,toyota celica gt liftback 23.2,4,156,105,2745,16.7,78,1,plymouth sapporo 23.8,4,151,85,2855,17.6,78,1,oldsmobile starfire sx 23.9,4,119,97,2405,14.9,78,3,datsun 200-sx 20.3,5,131,103,2830,15.9,78,2,audi 5000 17.0,6,163,125,3140,13.6,78,2,volvo 264gl 21.6,4,121,115,2795,15.7,78,2,saab 99gle 16.2,6,163,133,3410,15.8,78,2,peugeot 604sl 31.5,4,89,71,1990,14.9,78,2,volkswagen scirocco 29.5,4,98,68,2135,16.6,78,3,honda accord lx 21.5,6,231,115,3245,15.4,79,1,pontiac lemans v6 19.8,6,200,85,2990,18.2,79,1,mercury zephyr 6 22.3,4,140,88,2890,17.3,79,1,ford fairmont 4 20.2,6,232,90,3265,18.2,79,1,amc concord dl 6 20.6,6,225,110,3360,16.6,79,1,dodge aspen 6 17.0,8,305,130,3840,15.4,79,1,chevrolet caprice classic 17.6,8,302,129,3725,13.4,79,1,ford ltd landau 16.5,8,351,138,3955,13.2,79,1,mercury grand marquis 18.2,8,318,135,3830,15.2,79,1,dodge st. regis 16.9,8,350,155,4360,14.9,79,1,buick estate wagon (sw) 15.5,8,351,142,4054,14.3,79,1,ford country squire (sw) 19.2,8,267,125,3605,15.0,79,1,chevrolet malibu classic (sw) 18.5,8,360,150,3940,13.0,79,1,chrysler lebaron town @ country (sw) 31.9,4,89,71,1925,14.0,79,2,vw rabbit custom 34.1,4,86,65,1975,15.2,79,3,maxda glc deluxe 35.7,4,98,80,1915,14.4,79,1,dodge colt hatchback custom 27.4,4,121,80,2670,15.0,79,1,amc spirit dl 25.4,5,183,77,3530,20.1,79,2,mercedes benz 300d 23.0,8,350,125,3900,17.4,79,1,cadillac eldorado 27.2,4,141,71,3190,24.8,79,2,peugeot 504 23.9,8,260,90,3420,22.2,79,1,oldsmobile cutlass salon brougham 34.2,4,105,70,2200,13.2,79,1,plymouth horizon 34.5,4,105,70,2150,14.9,79,1,plymouth horizon tc3 31.8,4,85,65,2020,19.2,79,3,datsun 210 37.3,4,91,69,2130,14.7,79,2,fiat strada custom 28.4,4,151,90,2670,16.0,79,1,buick skylark limited 28.8,6,173,115,2595,11.3,79,1,chevrolet citation 26.8,6,173,115,2700,12.9,79,1,oldsmobile omega brougham 33.5,4,151,90,2556,13.2,79,1,pontiac phoenix 41.5,4,98,76,2144,14.7,80,2,vw rabbit 38.1,4,89,60,1968,18.8,80,3,toyota corolla tercel 32.1,4,98,70,2120,15.5,80,1,chevrolet chevette 37.2,4,86,65,2019,16.4,80,3,datsun 310 28.0,4,151,90,2678,16.5,80,1,chevrolet citation 26.4,4,140,88,2870,18.1,80,1,ford fairmont 24.3,4,151,90,3003,20.1,80,1,amc concord 19.1,6,225,90,3381,18.7,80,1,dodge aspen 34.3,4,97,78,2188,15.8,80,2,audi 4000 29.8,4,134,90,2711,15.5,80,3,toyota corona liftback 31.3,4,120,75,2542,17.5,80,3,mazda 626 37.0,4,119,92,2434,15.0,80,3,datsun 510 hatchback 32.2,4,108,75,2265,15.2,80,3,toyota corolla 46.6,4,86,65,2110,17.9,80,3,mazda glc 27.9,4,156,105,2800,14.4,80,1,dodge colt 40.8,4,85,65,2110,19.2,80,3,datsun 210 44.3,4,90,48,2085,21.7,80,2,vw rabbit c (diesel) 43.4,4,90,48,2335,23.7,80,2,vw dasher (diesel) 36.4,5,121,67,2950,19.9,80,2,audi 5000s (diesel) 30.0,4,146,67,3250,21.8,80,2,mercedes-benz 240d 44.6,4,91,67,1850,13.8,80,3,honda civic 1500 gl 40.9,4,85,?,1835,17.3,80,2,renault lecar deluxe 33.8,4,97,67,2145,18.0,80,3,subaru dl 29.8,4,89,62,1845,15.3,80,2,vokswagen rabbit 32.7,6,168,132,2910,11.4,80,3,datsun 280-zx 23.7,3,70,100,2420,12.5,80,3,mazda rx-7 gs 35.0,4,122,88,2500,15.1,80,2,triumph tr7 coupe 23.6,4,140,?,2905,14.3,80,1,ford mustang cobra 32.4,4,107,72,2290,17.0,80,3,honda accord 27.2,4,135,84,2490,15.7,81,1,plymouth reliant 26.6,4,151,84,2635,16.4,81,1,buick skylark 25.8,4,156,92,2620,14.4,81,1,dodge aries wagon (sw) 23.5,6,173,110,2725,12.6,81,1,chevrolet citation 30.0,4,135,84,2385,12.9,81,1,plymouth reliant 39.1,4,79,58,1755,16.9,81,3,toyota starlet 39.0,4,86,64,1875,16.4,81,1,plymouth champ 35.1,4,81,60,1760,16.1,81,3,honda civic 1300 32.3,4,97,67,2065,17.8,81,3,subaru 37.0,4,85,65,1975,19.4,81,3,datsun 210 mpg 37.7,4,89,62,2050,17.3,81,3,toyota tercel 34.1,4,91,68,1985,16.0,81,3,mazda glc 4 34.7,4,105,63,2215,14.9,81,1,plymouth horizon 4 34.4,4,98,65,2045,16.2,81,1,ford escort 4w 29.9,4,98,65,2380,20.7,81,1,ford escort 2h 33.0,4,105,74,2190,14.2,81,2,volkswagen jetta 34.5,4,100,?,2320,15.8,81,2,renault 18i 33.7,4,107,75,2210,14.4,81,3,honda prelude 32.4,4,108,75,2350,16.8,81,3,toyota corolla 32.9,4,119,100,2615,14.8,81,3,datsun 200sx 31.6,4,120,74,2635,18.3,81,3,mazda 626 28.1,4,141,80,3230,20.4,81,2,peugeot 505s turbo diesel 30.7,6,145,76,3160,19.6,81,2,volvo diesel 25.4,6,168,116,2900,12.6,81,3,toyota cressida 24.2,6,146,120,2930,13.8,81,3,datsun 810 maxima 22.4,6,231,110,3415,15.8,81,1,buick century 26.6,8,350,105,3725,19.0,81,1,oldsmobile cutlass ls 20.2,6,200,88,3060,17.1,81,1,ford granada gl 17.6,6,225,85,3465,16.6,81,1,chrysler lebaron salon 28.0,4,112,88,2605,19.6,82,1,chevrolet cavalier 27.0,4,112,88,2640,18.6,82,1,chevrolet cavalier wagon 34.0,4,112,88,2395,18.0,82,1,chevrolet cavalier 2-door 31.0,4,112,85,2575,16.2,82,1,pontiac j2000 se hatchback 29.0,4,135,84,2525,16.0,82,1,dodge aries se 27.0,4,151,90,2735,18.0,82,1,pontiac phoenix 24.0,4,140,92,2865,16.4,82,1,ford fairmont futura 23.0,4,151,?,3035,20.5,82,1,amc concord dl 36.0,4,105,74,1980,15.3,82,2,volkswagen rabbit l 37.0,4,91,68,2025,18.2,82,3,mazda glc custom l 31.0,4,91,68,1970,17.6,82,3,mazda glc custom 38.0,4,105,63,2125,14.7,82,1,plymouth horizon miser 36.0,4,98,70,2125,17.3,82,1,mercury lynx l 36.0,4,120,88,2160,14.5,82,3,nissan stanza xe 36.0,4,107,75,2205,14.5,82,3,honda accord 34.0,4,108,70,2245,16.9,82,3,toyota corolla 38.0,4,91,67,1965,15.0,82,3,honda civic 32.0,4,91,67,1965,15.7,82,3,honda civic (auto) 38.0,4,91,67,1995,16.2,82,3,datsun 310 gx 25.0,6,181,110,2945,16.4,82,1,buick century limited 38.0,6,262,85,3015,17.0,82,1,oldsmobile cutlass ciera (diesel) 26.0,4,156,92,2585,14.5,82,1,chrysler lebaron medallion 22.0,6,232,112,2835,14.7,82,1,ford granada l 32.0,4,144,96,2665,13.9,82,3,toyota celica gt 36.0,4,135,84,2370,13.0,82,1,dodge charger 2.2 27.0,4,151,90,2950,17.3,82,1,chevrolet camaro 27.0,4,140,86,2790,15.6,82,1,ford mustang gl 44.0,4,97,52,2130,24.6,82,2,vw pickup 32.0,4,135,84,2295,11.6,82,1,dodge rampage 28.0,4,120,79,2625,18.6,82,1,ford ranger 31.0,4,119,82,2720,19.4,82,1,chevy s-10 -------------------------------------------------------------------------------- /dataset/drinks.csv: -------------------------------------------------------------------------------- 1 | country,beer_servings,spirit_servings,wine_servings,total_litres_of_pure_alcohol,continent 2 | Afghanistan,0,0,0,0.0,AS 3 | Albania,89,132,54,4.9,EU 4 | Algeria,25,0,14,0.7,AF 5 | Andorra,245,138,312,12.4,EU 6 | Angola,217,57,45,5.9,AF 7 | Antigua & Barbuda,102,128,45,4.9, 8 | Argentina,193,25,221,8.3,SA 9 | Armenia,21,179,11,3.8,EU 10 | Australia,261,72,212,10.4,OC 11 | Austria,279,75,191,9.7,EU 12 | Azerbaijan,21,46,5,1.3,EU 13 | Bahamas,122,176,51,6.3, 14 | Bahrain,42,63,7,2.0,AS 15 | Bangladesh,0,0,0,0.0,AS 16 | Barbados,143,173,36,6.3, 17 | Belarus,142,373,42,14.4,EU 18 | Belgium,295,84,212,10.5,EU 19 | Belize,263,114,8,6.8, 20 | Benin,34,4,13,1.1,AF 21 | Bhutan,23,0,0,0.4,AS 22 | Bolivia,167,41,8,3.8,SA 23 | Bosnia-Herzegovina,76,173,8,4.6,EU 24 | Botswana,173,35,35,5.4,AF 25 | Brazil,245,145,16,7.2,SA 26 | Brunei,31,2,1,0.6,AS 27 | Bulgaria,231,252,94,10.3,EU 28 | Burkina Faso,25,7,7,4.3,AF 29 | Burundi,88,0,0,6.3,AF 30 | Cote d'Ivoire,37,1,7,4.0,AF 31 | Cabo Verde,144,56,16,4.0,AF 32 | Cambodia,57,65,1,2.2,AS 33 | Cameroon,147,1,4,5.8,AF 34 | Canada,240,122,100,8.2, 35 | Central African Republic,17,2,1,1.8,AF 36 | Chad,15,1,1,0.4,AF 37 | Chile,130,124,172,7.6,SA 38 | China,79,192,8,5.0,AS 39 | Colombia,159,76,3,4.2,SA 40 | Comoros,1,3,1,0.1,AF 41 | Congo,76,1,9,1.7,AF 42 | Cook Islands,0,254,74,5.9,OC 43 | Costa Rica,149,87,11,4.4, 44 | Croatia,230,87,254,10.2,EU 45 | Cuba,93,137,5,4.2, 46 | Cyprus,192,154,113,8.2,EU 47 | Czech Republic,361,170,134,11.8,EU 48 | North Korea,0,0,0,0.0,AS 49 | DR Congo,32,3,1,2.3,AF 50 | Denmark,224,81,278,10.4,EU 51 | Djibouti,15,44,3,1.1,AF 52 | Dominica,52,286,26,6.6, 53 | Dominican Republic,193,147,9,6.2, 54 | Ecuador,162,74,3,4.2,SA 55 | Egypt,6,4,1,0.2,AF 56 | El Salvador,52,69,2,2.2, 57 | Equatorial Guinea,92,0,233,5.8,AF 58 | Eritrea,18,0,0,0.5,AF 59 | Estonia,224,194,59,9.5,EU 60 | Ethiopia,20,3,0,0.7,AF 61 | Fiji,77,35,1,2.0,OC 62 | Finland,263,133,97,10.0,EU 63 | France,127,151,370,11.8,EU 64 | Gabon,347,98,59,8.9,AF 65 | Gambia,8,0,1,2.4,AF 66 | Georgia,52,100,149,5.4,EU 67 | Germany,346,117,175,11.3,EU 68 | Ghana,31,3,10,1.8,AF 69 | Greece,133,112,218,8.3,EU 70 | Grenada,199,438,28,11.9, 71 | Guatemala,53,69,2,2.2, 72 | Guinea,9,0,2,0.2,AF 73 | Guinea-Bissau,28,31,21,2.5,AF 74 | Guyana,93,302,1,7.1,SA 75 | Haiti,1,326,1,5.9, 76 | Honduras,69,98,2,3.0, 77 | Hungary,234,215,185,11.3,EU 78 | Iceland,233,61,78,6.6,EU 79 | India,9,114,0,2.2,AS 80 | Indonesia,5,1,0,0.1,AS 81 | Iran,0,0,0,0.0,AS 82 | Iraq,9,3,0,0.2,AS 83 | Ireland,313,118,165,11.4,EU 84 | Israel,63,69,9,2.5,AS 85 | Italy,85,42,237,6.5,EU 86 | Jamaica,82,97,9,3.4, 87 | Japan,77,202,16,7.0,AS 88 | Jordan,6,21,1,0.5,AS 89 | Kazakhstan,124,246,12,6.8,AS 90 | Kenya,58,22,2,1.8,AF 91 | Kiribati,21,34,1,1.0,OC 92 | Kuwait,0,0,0,0.0,AS 93 | Kyrgyzstan,31,97,6,2.4,AS 94 | Laos,62,0,123,6.2,AS 95 | Latvia,281,216,62,10.5,EU 96 | Lebanon,20,55,31,1.9,AS 97 | Lesotho,82,29,0,2.8,AF 98 | Liberia,19,152,2,3.1,AF 99 | Libya,0,0,0,0.0,AF 100 | Lithuania,343,244,56,12.9,EU 101 | Luxembourg,236,133,271,11.4,EU 102 | Madagascar,26,15,4,0.8,AF 103 | Malawi,8,11,1,1.5,AF 104 | Malaysia,13,4,0,0.3,AS 105 | Maldives,0,0,0,0.0,AS 106 | Mali,5,1,1,0.6,AF 107 | Malta,149,100,120,6.6,EU 108 | Marshall Islands,0,0,0,0.0,OC 109 | Mauritania,0,0,0,0.0,AF 110 | Mauritius,98,31,18,2.6,AF 111 | Mexico,238,68,5,5.5, 112 | Micronesia,62,50,18,2.3,OC 113 | Monaco,0,0,0,0.0,EU 114 | Mongolia,77,189,8,4.9,AS 115 | Montenegro,31,114,128,4.9,EU 116 | Morocco,12,6,10,0.5,AF 117 | Mozambique,47,18,5,1.3,AF 118 | Myanmar,5,1,0,0.1,AS 119 | Namibia,376,3,1,6.8,AF 120 | Nauru,49,0,8,1.0,OC 121 | Nepal,5,6,0,0.2,AS 122 | Netherlands,251,88,190,9.4,EU 123 | New Zealand,203,79,175,9.3,OC 124 | Nicaragua,78,118,1,3.5, 125 | Niger,3,2,1,0.1,AF 126 | Nigeria,42,5,2,9.1,AF 127 | Niue,188,200,7,7.0,OC 128 | Norway,169,71,129,6.7,EU 129 | Oman,22,16,1,0.7,AS 130 | Pakistan,0,0,0,0.0,AS 131 | Palau,306,63,23,6.9,OC 132 | Panama,285,104,18,7.2, 133 | Papua New Guinea,44,39,1,1.5,OC 134 | Paraguay,213,117,74,7.3,SA 135 | Peru,163,160,21,6.1,SA 136 | Philippines,71,186,1,4.6,AS 137 | Poland,343,215,56,10.9,EU 138 | Portugal,194,67,339,11.0,EU 139 | Qatar,1,42,7,0.9,AS 140 | South Korea,140,16,9,9.8,AS 141 | Moldova,109,226,18,6.3,EU 142 | Romania,297,122,167,10.4,EU 143 | Russian Federation,247,326,73,11.5,AS 144 | Rwanda,43,2,0,6.8,AF 145 | St. Kitts & Nevis,194,205,32,7.7, 146 | St. Lucia,171,315,71,10.1, 147 | St. Vincent & the Grenadines,120,221,11,6.3, 148 | Samoa,105,18,24,2.6,OC 149 | San Marino,0,0,0,0.0,EU 150 | Sao Tome & Principe,56,38,140,4.2,AF 151 | Saudi Arabia,0,5,0,0.1,AS 152 | Senegal,9,1,7,0.3,AF 153 | Serbia,283,131,127,9.6,EU 154 | Seychelles,157,25,51,4.1,AF 155 | Sierra Leone,25,3,2,6.7,AF 156 | Singapore,60,12,11,1.5,AS 157 | Slovakia,196,293,116,11.4,EU 158 | Slovenia,270,51,276,10.6,EU 159 | Solomon Islands,56,11,1,1.2,OC 160 | Somalia,0,0,0,0.0,AF 161 | South Africa,225,76,81,8.2,AF 162 | Spain,284,157,112,10.0,EU 163 | Sri Lanka,16,104,0,2.2,AS 164 | Sudan,8,13,0,1.7,AF 165 | Suriname,128,178,7,5.6,SA 166 | Swaziland,90,2,2,4.7,AF 167 | Sweden,152,60,186,7.2,EU 168 | Switzerland,185,100,280,10.2,EU 169 | Syria,5,35,16,1.0,AS 170 | Tajikistan,2,15,0,0.3,AS 171 | Thailand,99,258,1,6.4,AS 172 | Macedonia,106,27,86,3.9,EU 173 | Timor-Leste,1,1,4,0.1,AS 174 | Togo,36,2,19,1.3,AF 175 | Tonga,36,21,5,1.1,OC 176 | Trinidad & Tobago,197,156,7,6.4, 177 | Tunisia,51,3,20,1.3,AF 178 | Turkey,51,22,7,1.4,AS 179 | Turkmenistan,19,71,32,2.2,AS 180 | Tuvalu,6,41,9,1.0,OC 181 | Uganda,45,9,0,8.3,AF 182 | Ukraine,206,237,45,8.9,EU 183 | United Arab Emirates,16,135,5,2.8,AS 184 | United Kingdom,219,126,195,10.4,EU 185 | Tanzania,36,6,1,5.7,AF 186 | USA,249,158,84,8.7, 187 | Uruguay,115,35,220,6.6,SA 188 | Uzbekistan,25,101,8,2.4,AS 189 | Vanuatu,21,18,11,0.9,OC 190 | Venezuela,333,100,3,7.7,SA 191 | Vietnam,111,2,1,2.0,AS 192 | Yemen,6,0,0,0.1,AS 193 | Zambia,32,19,4,2.5,AF 194 | Zimbabwe,64,18,4,4.7,AF 195 | -------------------------------------------------------------------------------- /dataset/iris.data: -------------------------------------------------------------------------------- 1 | 5.1,3.5,1.4,0.2,Iris-setosa 2 | 4.9,3.0,1.4,0.2,Iris-setosa 3 | 4.7,3.2,1.3,0.2,Iris-setosa 4 | 4.6,3.1,1.5,0.2,Iris-setosa 5 | 5.0,3.6,1.4,0.2,Iris-setosa 6 | 5.4,3.9,1.7,0.4,Iris-setosa 7 | 4.6,3.4,1.4,0.3,Iris-setosa 8 | 5.0,3.4,1.5,0.2,Iris-setosa 9 | 4.4,2.9,1.4,0.2,Iris-setosa 10 | 4.9,3.1,1.5,0.1,Iris-setosa 11 | 5.4,3.7,1.5,0.2,Iris-setosa 12 | 4.8,3.4,1.6,0.2,Iris-setosa 13 | 4.8,3.0,1.4,0.1,Iris-setosa 14 | 4.3,3.0,1.1,0.1,Iris-setosa 15 | 5.8,4.0,1.2,0.2,Iris-setosa 16 | 5.7,4.4,1.5,0.4,Iris-setosa 17 | 5.4,3.9,1.3,0.4,Iris-setosa 18 | 5.1,3.5,1.4,0.3,Iris-setosa 19 | 5.7,3.8,1.7,0.3,Iris-setosa 20 | 5.1,3.8,1.5,0.3,Iris-setosa 21 | 5.4,3.4,1.7,0.2,Iris-setosa 22 | 5.1,3.7,1.5,0.4,Iris-setosa 23 | 4.6,3.6,1.0,0.2,Iris-setosa 24 | 5.1,3.3,1.7,0.5,Iris-setosa 25 | 4.8,3.4,1.9,0.2,Iris-setosa 26 | 5.0,3.0,1.6,0.2,Iris-setosa 27 | 5.0,3.4,1.6,0.4,Iris-setosa 28 | 5.2,3.5,1.5,0.2,Iris-setosa 29 | 5.2,3.4,1.4,0.2,Iris-setosa 30 | 4.7,3.2,1.6,0.2,Iris-setosa 31 | 4.8,3.1,1.6,0.2,Iris-setosa 32 | 5.4,3.4,1.5,0.4,Iris-setosa 33 | 5.2,4.1,1.5,0.1,Iris-setosa 34 | 5.5,4.2,1.4,0.2,Iris-setosa 35 | 4.9,3.1,1.5,0.1,Iris-setosa 36 | 5.0,3.2,1.2,0.2,Iris-setosa 37 | 5.5,3.5,1.3,0.2,Iris-setosa 38 | 4.9,3.1,1.5,0.1,Iris-setosa 39 | 4.4,3.0,1.3,0.2,Iris-setosa 40 | 5.1,3.4,1.5,0.2,Iris-setosa 41 | 5.0,3.5,1.3,0.3,Iris-setosa 42 | 4.5,2.3,1.3,0.3,Iris-setosa 43 | 4.4,3.2,1.3,0.2,Iris-setosa 44 | 5.0,3.5,1.6,0.6,Iris-setosa 45 | 5.1,3.8,1.9,0.4,Iris-setosa 46 | 4.8,3.0,1.4,0.3,Iris-setosa 47 | 5.1,3.8,1.6,0.2,Iris-setosa 48 | 4.6,3.2,1.4,0.2,Iris-setosa 49 | 5.3,3.7,1.5,0.2,Iris-setosa 50 | 5.0,3.3,1.4,0.2,Iris-setosa 51 | 7.0,3.2,4.7,1.4,Iris-versicolor 52 | 6.4,3.2,4.5,1.5,Iris-versicolor 53 | 6.9,3.1,4.9,1.5,Iris-versicolor 54 | 5.5,2.3,4.0,1.3,Iris-versicolor 55 | 6.5,2.8,4.6,1.5,Iris-versicolor 56 | 5.7,2.8,4.5,1.3,Iris-versicolor 57 | 6.3,3.3,4.7,1.6,Iris-versicolor 58 | 4.9,2.4,3.3,1.0,Iris-versicolor 59 | 6.6,2.9,4.6,1.3,Iris-versicolor 60 | 5.2,2.7,3.9,1.4,Iris-versicolor 61 | 5.0,2.0,3.5,1.0,Iris-versicolor 62 | 5.9,3.0,4.2,1.5,Iris-versicolor 63 | 6.0,2.2,4.0,1.0,Iris-versicolor 64 | 6.1,2.9,4.7,1.4,Iris-versicolor 65 | 5.6,2.9,3.6,1.3,Iris-versicolor 66 | 6.7,3.1,4.4,1.4,Iris-versicolor 67 | 5.6,3.0,4.5,1.5,Iris-versicolor 68 | 5.8,2.7,4.1,1.0,Iris-versicolor 69 | 6.2,2.2,4.5,1.5,Iris-versicolor 70 | 5.6,2.5,3.9,1.1,Iris-versicolor 71 | 5.9,3.2,4.8,1.8,Iris-versicolor 72 | 6.1,2.8,4.0,1.3,Iris-versicolor 73 | 6.3,2.5,4.9,1.5,Iris-versicolor 74 | 6.1,2.8,4.7,1.2,Iris-versicolor 75 | 6.4,2.9,4.3,1.3,Iris-versicolor 76 | 6.6,3.0,4.4,1.4,Iris-versicolor 77 | 6.8,2.8,4.8,1.4,Iris-versicolor 78 | 6.7,3.0,5.0,1.7,Iris-versicolor 79 | 6.0,2.9,4.5,1.5,Iris-versicolor 80 | 5.7,2.6,3.5,1.0,Iris-versicolor 81 | 5.5,2.4,3.8,1.1,Iris-versicolor 82 | 5.5,2.4,3.7,1.0,Iris-versicolor 83 | 5.8,2.7,3.9,1.2,Iris-versicolor 84 | 6.0,2.7,5.1,1.6,Iris-versicolor 85 | 5.4,3.0,4.5,1.5,Iris-versicolor 86 | 6.0,3.4,4.5,1.6,Iris-versicolor 87 | 6.7,3.1,4.7,1.5,Iris-versicolor 88 | 6.3,2.3,4.4,1.3,Iris-versicolor 89 | 5.6,3.0,4.1,1.3,Iris-versicolor 90 | 5.5,2.5,4.0,1.3,Iris-versicolor 91 | 5.5,2.6,4.4,1.2,Iris-versicolor 92 | 6.1,3.0,4.6,1.4,Iris-versicolor 93 | 5.8,2.6,4.0,1.2,Iris-versicolor 94 | 5.0,2.3,3.3,1.0,Iris-versicolor 95 | 5.6,2.7,4.2,1.3,Iris-versicolor 96 | 5.7,3.0,4.2,1.2,Iris-versicolor 97 | 5.7,2.9,4.2,1.3,Iris-versicolor 98 | 6.2,2.9,4.3,1.3,Iris-versicolor 99 | 5.1,2.5,3.0,1.1,Iris-versicolor 100 | 5.7,2.8,4.1,1.3,Iris-versicolor 101 | 6.3,3.3,6.0,2.5,Iris-virginica 102 | 5.8,2.7,5.1,1.9,Iris-virginica 103 | 7.1,3.0,5.9,2.1,Iris-virginica 104 | 6.3,2.9,5.6,1.8,Iris-virginica 105 | 6.5,3.0,5.8,2.2,Iris-virginica 106 | 7.6,3.0,6.6,2.1,Iris-virginica 107 | 4.9,2.5,4.5,1.7,Iris-virginica 108 | 7.3,2.9,6.3,1.8,Iris-virginica 109 | 6.7,2.5,5.8,1.8,Iris-virginica 110 | 7.2,3.6,6.1,2.5,Iris-virginica 111 | 6.5,3.2,5.1,2.0,Iris-virginica 112 | 6.4,2.7,5.3,1.9,Iris-virginica 113 | 6.8,3.0,5.5,2.1,Iris-virginica 114 | 5.7,2.5,5.0,2.0,Iris-virginica 115 | 5.8,2.8,5.1,2.4,Iris-virginica 116 | 6.4,3.2,5.3,2.3,Iris-virginica 117 | 6.5,3.0,5.5,1.8,Iris-virginica 118 | 7.7,3.8,6.7,2.2,Iris-virginica 119 | 7.7,2.6,6.9,2.3,Iris-virginica 120 | 6.0,2.2,5.0,1.5,Iris-virginica 121 | 6.9,3.2,5.7,2.3,Iris-virginica 122 | 5.6,2.8,4.9,2.0,Iris-virginica 123 | 7.7,2.8,6.7,2.0,Iris-virginica 124 | 6.3,2.7,4.9,1.8,Iris-virginica 125 | 6.7,3.3,5.7,2.1,Iris-virginica 126 | 7.2,3.2,6.0,1.8,Iris-virginica 127 | 6.2,2.8,4.8,1.8,Iris-virginica 128 | 6.1,3.0,4.9,1.8,Iris-virginica 129 | 6.4,2.8,5.6,2.1,Iris-virginica 130 | 7.2,3.0,5.8,1.6,Iris-virginica 131 | 7.4,2.8,6.1,1.9,Iris-virginica 132 | 7.9,3.8,6.4,2.0,Iris-virginica 133 | 6.4,2.8,5.6,2.2,Iris-virginica 134 | 6.3,2.8,5.1,1.5,Iris-virginica 135 | 6.1,2.6,5.6,1.4,Iris-virginica 136 | 7.7,3.0,6.1,2.3,Iris-virginica 137 | 6.3,3.4,5.6,2.4,Iris-virginica 138 | 6.4,3.1,5.5,1.8,Iris-virginica 139 | 6.0,3.0,4.8,1.8,Iris-virginica 140 | 6.9,3.1,5.4,2.1,Iris-virginica 141 | 6.7,3.1,5.6,2.4,Iris-virginica 142 | 6.9,3.1,5.1,2.3,Iris-virginica 143 | 5.8,2.7,5.1,1.9,Iris-virginica 144 | 6.8,3.2,5.9,2.3,Iris-virginica 145 | 6.7,3.3,5.7,2.5,Iris-virginica 146 | 6.7,3.0,5.2,2.3,Iris-virginica 147 | 6.3,2.5,5.0,1.9,Iris-virginica 148 | 6.5,3.0,5.2,2.0,Iris-virginica 149 | 6.2,3.4,5.4,2.3,Iris-virginica 150 | 5.9,3.0,5.1,1.8,Iris-virginica 151 | 152 | -------------------------------------------------------------------------------- /dataset/tips.csv: -------------------------------------------------------------------------------- 1 | ,total_bill,tip,sex,smoker,day,time,size 2 | 0,16.99,1.01,Female,No,Sun,Dinner,2 3 | 1,10.34,1.66,Male,No,Sun,Dinner,3 4 | 2,21.01,3.5,Male,No,Sun,Dinner,3 5 | 3,23.68,3.31,Male,No,Sun,Dinner,2 6 | 4,24.59,3.61,Female,No,Sun,Dinner,4 7 | 5,25.29,4.71,Male,No,Sun,Dinner,4 8 | 6,8.77,2.0,Male,No,Sun,Dinner,2 9 | 7,26.88,3.12,Male,No,Sun,Dinner,4 10 | 8,15.04,1.96,Male,No,Sun,Dinner,2 11 | 9,14.78,3.23,Male,No,Sun,Dinner,2 12 | 10,10.27,1.71,Male,No,Sun,Dinner,2 13 | 11,35.26,5.0,Female,No,Sun,Dinner,4 14 | 12,15.42,1.57,Male,No,Sun,Dinner,2 15 | 13,18.43,3.0,Male,No,Sun,Dinner,4 16 | 14,14.83,3.02,Female,No,Sun,Dinner,2 17 | 15,21.58,3.92,Male,No,Sun,Dinner,2 18 | 16,10.33,1.67,Female,No,Sun,Dinner,3 19 | 17,16.29,3.71,Male,No,Sun,Dinner,3 20 | 18,16.97,3.5,Female,No,Sun,Dinner,3 21 | 19,20.65,3.35,Male,No,Sat,Dinner,3 22 | 20,17.92,4.08,Male,No,Sat,Dinner,2 23 | 21,20.29,2.75,Female,No,Sat,Dinner,2 24 | 22,15.77,2.23,Female,No,Sat,Dinner,2 25 | 23,39.42,7.58,Male,No,Sat,Dinner,4 26 | 24,19.82,3.18,Male,No,Sat,Dinner,2 27 | 25,17.81,2.34,Male,No,Sat,Dinner,4 28 | 26,13.37,2.0,Male,No,Sat,Dinner,2 29 | 27,12.69,2.0,Male,No,Sat,Dinner,2 30 | 28,21.7,4.3,Male,No,Sat,Dinner,2 31 | 29,19.65,3.0,Female,No,Sat,Dinner,2 32 | 30,9.55,1.45,Male,No,Sat,Dinner,2 33 | 31,18.35,2.5,Male,No,Sat,Dinner,4 34 | 32,15.06,3.0,Female,No,Sat,Dinner,2 35 | 33,20.69,2.45,Female,No,Sat,Dinner,4 36 | 34,17.78,3.27,Male,No,Sat,Dinner,2 37 | 35,24.06,3.6,Male,No,Sat,Dinner,3 38 | 36,16.31,2.0,Male,No,Sat,Dinner,3 39 | 37,16.93,3.07,Female,No,Sat,Dinner,3 40 | 38,18.69,2.31,Male,No,Sat,Dinner,3 41 | 39,31.27,5.0,Male,No,Sat,Dinner,3 42 | 40,16.04,2.24,Male,No,Sat,Dinner,3 43 | 41,17.46,2.54,Male,No,Sun,Dinner,2 44 | 42,13.94,3.06,Male,No,Sun,Dinner,2 45 | 43,9.68,1.32,Male,No,Sun,Dinner,2 46 | 44,30.4,5.6,Male,No,Sun,Dinner,4 47 | 45,18.29,3.0,Male,No,Sun,Dinner,2 48 | 46,22.23,5.0,Male,No,Sun,Dinner,2 49 | 47,32.4,6.0,Male,No,Sun,Dinner,4 50 | 48,28.55,2.05,Male,No,Sun,Dinner,3 51 | 49,18.04,3.0,Male,No,Sun,Dinner,2 52 | 50,12.54,2.5,Male,No,Sun,Dinner,2 53 | 51,10.29,2.6,Female,No,Sun,Dinner,2 54 | 52,34.81,5.2,Female,No,Sun,Dinner,4 55 | 53,9.94,1.56,Male,No,Sun,Dinner,2 56 | 54,25.56,4.34,Male,No,Sun,Dinner,4 57 | 55,19.49,3.51,Male,No,Sun,Dinner,2 58 | 56,38.01,3.0,Male,Yes,Sat,Dinner,4 59 | 57,26.41,1.5,Female,No,Sat,Dinner,2 60 | 58,11.24,1.76,Male,Yes,Sat,Dinner,2 61 | 59,48.27,6.73,Male,No,Sat,Dinner,4 62 | 60,20.29,3.21,Male,Yes,Sat,Dinner,2 63 | 61,13.81,2.0,Male,Yes,Sat,Dinner,2 64 | 62,11.02,1.98,Male,Yes,Sat,Dinner,2 65 | 63,18.29,3.76,Male,Yes,Sat,Dinner,4 66 | 64,17.59,2.64,Male,No,Sat,Dinner,3 67 | 65,20.08,3.15,Male,No,Sat,Dinner,3 68 | 66,16.45,2.47,Female,No,Sat,Dinner,2 69 | 67,3.07,1.0,Female,Yes,Sat,Dinner,1 70 | 68,20.23,2.01,Male,No,Sat,Dinner,2 71 | 69,15.01,2.09,Male,Yes,Sat,Dinner,2 72 | 70,12.02,1.97,Male,No,Sat,Dinner,2 73 | 71,17.07,3.0,Female,No,Sat,Dinner,3 74 | 72,26.86,3.14,Female,Yes,Sat,Dinner,2 75 | 73,25.28,5.0,Female,Yes,Sat,Dinner,2 76 | 74,14.73,2.2,Female,No,Sat,Dinner,2 77 | 75,10.51,1.25,Male,No,Sat,Dinner,2 78 | 76,17.92,3.08,Male,Yes,Sat,Dinner,2 79 | 77,27.2,4.0,Male,No,Thur,Lunch,4 80 | 78,22.76,3.0,Male,No,Thur,Lunch,2 81 | 79,17.29,2.71,Male,No,Thur,Lunch,2 82 | 80,19.44,3.0,Male,Yes,Thur,Lunch,2 83 | 81,16.66,3.4,Male,No,Thur,Lunch,2 84 | 82,10.07,1.83,Female,No,Thur,Lunch,1 85 | 83,32.68,5.0,Male,Yes,Thur,Lunch,2 86 | 84,15.98,2.03,Male,No,Thur,Lunch,2 87 | 85,34.83,5.17,Female,No,Thur,Lunch,4 88 | 86,13.03,2.0,Male,No,Thur,Lunch,2 89 | 87,18.28,4.0,Male,No,Thur,Lunch,2 90 | 88,24.71,5.85,Male,No,Thur,Lunch,2 91 | 89,21.16,3.0,Male,No,Thur,Lunch,2 92 | 90,28.97,3.0,Male,Yes,Fri,Dinner,2 93 | 91,22.49,3.5,Male,No,Fri,Dinner,2 94 | 92,5.75,1.0,Female,Yes,Fri,Dinner,2 95 | 93,16.32,4.3,Female,Yes,Fri,Dinner,2 96 | 94,22.75,3.25,Female,No,Fri,Dinner,2 97 | 95,40.17,4.73,Male,Yes,Fri,Dinner,4 98 | 96,27.28,4.0,Male,Yes,Fri,Dinner,2 99 | 97,12.03,1.5,Male,Yes,Fri,Dinner,2 100 | 98,21.01,3.0,Male,Yes,Fri,Dinner,2 101 | 99,12.46,1.5,Male,No,Fri,Dinner,2 102 | 100,11.35,2.5,Female,Yes,Fri,Dinner,2 103 | 101,15.38,3.0,Female,Yes,Fri,Dinner,2 104 | 102,44.3,2.5,Female,Yes,Sat,Dinner,3 105 | 103,22.42,3.48,Female,Yes,Sat,Dinner,2 106 | 104,20.92,4.08,Female,No,Sat,Dinner,2 107 | 105,15.36,1.64,Male,Yes,Sat,Dinner,2 108 | 106,20.49,4.06,Male,Yes,Sat,Dinner,2 109 | 107,25.21,4.29,Male,Yes,Sat,Dinner,2 110 | 108,18.24,3.76,Male,No,Sat,Dinner,2 111 | 109,14.31,4.0,Female,Yes,Sat,Dinner,2 112 | 110,14.0,3.0,Male,No,Sat,Dinner,2 113 | 111,7.25,1.0,Female,No,Sat,Dinner,1 114 | 112,38.07,4.0,Male,No,Sun,Dinner,3 115 | 113,23.95,2.55,Male,No,Sun,Dinner,2 116 | 114,25.71,4.0,Female,No,Sun,Dinner,3 117 | 115,17.31,3.5,Female,No,Sun,Dinner,2 118 | 116,29.93,5.07,Male,No,Sun,Dinner,4 119 | 117,10.65,1.5,Female,No,Thur,Lunch,2 120 | 118,12.43,1.8,Female,No,Thur,Lunch,2 121 | 119,24.08,2.92,Female,No,Thur,Lunch,4 122 | 120,11.69,2.31,Male,No,Thur,Lunch,2 123 | 121,13.42,1.68,Female,No,Thur,Lunch,2 124 | 122,14.26,2.5,Male,No,Thur,Lunch,2 125 | 123,15.95,2.0,Male,No,Thur,Lunch,2 126 | 124,12.48,2.52,Female,No,Thur,Lunch,2 127 | 125,29.8,4.2,Female,No,Thur,Lunch,6 128 | 126,8.52,1.48,Male,No,Thur,Lunch,2 129 | 127,14.52,2.0,Female,No,Thur,Lunch,2 130 | 128,11.38,2.0,Female,No,Thur,Lunch,2 131 | 129,22.82,2.18,Male,No,Thur,Lunch,3 132 | 130,19.08,1.5,Male,No,Thur,Lunch,2 133 | 131,20.27,2.83,Female,No,Thur,Lunch,2 134 | 132,11.17,1.5,Female,No,Thur,Lunch,2 135 | 133,12.26,2.0,Female,No,Thur,Lunch,2 136 | 134,18.26,3.25,Female,No,Thur,Lunch,2 137 | 135,8.51,1.25,Female,No,Thur,Lunch,2 138 | 136,10.33,2.0,Female,No,Thur,Lunch,2 139 | 137,14.15,2.0,Female,No,Thur,Lunch,2 140 | 138,16.0,2.0,Male,Yes,Thur,Lunch,2 141 | 139,13.16,2.75,Female,No,Thur,Lunch,2 142 | 140,17.47,3.5,Female,No,Thur,Lunch,2 143 | 141,34.3,6.7,Male,No,Thur,Lunch,6 144 | 142,41.19,5.0,Male,No,Thur,Lunch,5 145 | 143,27.05,5.0,Female,No,Thur,Lunch,6 146 | 144,16.43,2.3,Female,No,Thur,Lunch,2 147 | 145,8.35,1.5,Female,No,Thur,Lunch,2 148 | 146,18.64,1.36,Female,No,Thur,Lunch,3 149 | 147,11.87,1.63,Female,No,Thur,Lunch,2 150 | 148,9.78,1.73,Male,No,Thur,Lunch,2 151 | 149,7.51,2.0,Male,No,Thur,Lunch,2 152 | 150,14.07,2.5,Male,No,Sun,Dinner,2 153 | 151,13.13,2.0,Male,No,Sun,Dinner,2 154 | 152,17.26,2.74,Male,No,Sun,Dinner,3 155 | 153,24.55,2.0,Male,No,Sun,Dinner,4 156 | 154,19.77,2.0,Male,No,Sun,Dinner,4 157 | 155,29.85,5.14,Female,No,Sun,Dinner,5 158 | 156,48.17,5.0,Male,No,Sun,Dinner,6 159 | 157,25.0,3.75,Female,No,Sun,Dinner,4 160 | 158,13.39,2.61,Female,No,Sun,Dinner,2 161 | 159,16.49,2.0,Male,No,Sun,Dinner,4 162 | 160,21.5,3.5,Male,No,Sun,Dinner,4 163 | 161,12.66,2.5,Male,No,Sun,Dinner,2 164 | 162,16.21,2.0,Female,No,Sun,Dinner,3 165 | 163,13.81,2.0,Male,No,Sun,Dinner,2 166 | 164,17.51,3.0,Female,Yes,Sun,Dinner,2 167 | 165,24.52,3.48,Male,No,Sun,Dinner,3 168 | 166,20.76,2.24,Male,No,Sun,Dinner,2 169 | 167,31.71,4.5,Male,No,Sun,Dinner,4 170 | 168,10.59,1.61,Female,Yes,Sat,Dinner,2 171 | 169,10.63,2.0,Female,Yes,Sat,Dinner,2 172 | 170,50.81,10.0,Male,Yes,Sat,Dinner,3 173 | 171,15.81,3.16,Male,Yes,Sat,Dinner,2 174 | 172,7.25,5.15,Male,Yes,Sun,Dinner,2 175 | 173,31.85,3.18,Male,Yes,Sun,Dinner,2 176 | 174,16.82,4.0,Male,Yes,Sun,Dinner,2 177 | 175,32.9,3.11,Male,Yes,Sun,Dinner,2 178 | 176,17.89,2.0,Male,Yes,Sun,Dinner,2 179 | 177,14.48,2.0,Male,Yes,Sun,Dinner,2 180 | 178,9.6,4.0,Female,Yes,Sun,Dinner,2 181 | 179,34.63,3.55,Male,Yes,Sun,Dinner,2 182 | 180,34.65,3.68,Male,Yes,Sun,Dinner,4 183 | 181,23.33,5.65,Male,Yes,Sun,Dinner,2 184 | 182,45.35,3.5,Male,Yes,Sun,Dinner,3 185 | 183,23.17,6.5,Male,Yes,Sun,Dinner,4 186 | 184,40.55,3.0,Male,Yes,Sun,Dinner,2 187 | 185,20.69,5.0,Male,No,Sun,Dinner,5 188 | 186,20.9,3.5,Female,Yes,Sun,Dinner,3 189 | 187,30.46,2.0,Male,Yes,Sun,Dinner,5 190 | 188,18.15,3.5,Female,Yes,Sun,Dinner,3 191 | 189,23.1,4.0,Male,Yes,Sun,Dinner,3 192 | 190,15.69,1.5,Male,Yes,Sun,Dinner,2 193 | 191,19.81,4.19,Female,Yes,Thur,Lunch,2 194 | 192,28.44,2.56,Male,Yes,Thur,Lunch,2 195 | 193,15.48,2.02,Male,Yes,Thur,Lunch,2 196 | 194,16.58,4.0,Male,Yes,Thur,Lunch,2 197 | 195,7.56,1.44,Male,No,Thur,Lunch,2 198 | 196,10.34,2.0,Male,Yes,Thur,Lunch,2 199 | 197,43.11,5.0,Female,Yes,Thur,Lunch,4 200 | 198,13.0,2.0,Female,Yes,Thur,Lunch,2 201 | 199,13.51,2.0,Male,Yes,Thur,Lunch,2 202 | 200,18.71,4.0,Male,Yes,Thur,Lunch,3 203 | 201,12.74,2.01,Female,Yes,Thur,Lunch,2 204 | 202,13.0,2.0,Female,Yes,Thur,Lunch,2 205 | 203,16.4,2.5,Female,Yes,Thur,Lunch,2 206 | 204,20.53,4.0,Male,Yes,Thur,Lunch,4 207 | 205,16.47,3.23,Female,Yes,Thur,Lunch,3 208 | 206,26.59,3.41,Male,Yes,Sat,Dinner,3 209 | 207,38.73,3.0,Male,Yes,Sat,Dinner,4 210 | 208,24.27,2.03,Male,Yes,Sat,Dinner,2 211 | 209,12.76,2.23,Female,Yes,Sat,Dinner,2 212 | 210,30.06,2.0,Male,Yes,Sat,Dinner,3 213 | 211,25.89,5.16,Male,Yes,Sat,Dinner,4 214 | 212,48.33,9.0,Male,No,Sat,Dinner,4 215 | 213,13.27,2.5,Female,Yes,Sat,Dinner,2 216 | 214,28.17,6.5,Female,Yes,Sat,Dinner,3 217 | 215,12.9,1.1,Female,Yes,Sat,Dinner,2 218 | 216,28.15,3.0,Male,Yes,Sat,Dinner,5 219 | 217,11.59,1.5,Male,Yes,Sat,Dinner,2 220 | 218,7.74,1.44,Male,Yes,Sat,Dinner,2 221 | 219,30.14,3.09,Female,Yes,Sat,Dinner,4 222 | 220,12.16,2.2,Male,Yes,Fri,Lunch,2 223 | 221,13.42,3.48,Female,Yes,Fri,Lunch,2 224 | 222,8.58,1.92,Male,Yes,Fri,Lunch,1 225 | 223,15.98,3.0,Female,No,Fri,Lunch,3 226 | 224,13.42,1.58,Male,Yes,Fri,Lunch,2 227 | 225,16.27,2.5,Female,Yes,Fri,Lunch,2 228 | 226,10.09,2.0,Female,Yes,Fri,Lunch,2 229 | 227,20.45,3.0,Male,No,Sat,Dinner,4 230 | 228,13.28,2.72,Male,No,Sat,Dinner,2 231 | 229,22.12,2.88,Female,Yes,Sat,Dinner,2 232 | 230,24.01,2.0,Male,Yes,Sat,Dinner,4 233 | 231,15.69,3.0,Male,Yes,Sat,Dinner,3 234 | 232,11.61,3.39,Male,No,Sat,Dinner,2 235 | 233,10.77,1.47,Male,No,Sat,Dinner,2 236 | 234,15.53,3.0,Male,Yes,Sat,Dinner,2 237 | 235,10.07,1.25,Male,No,Sat,Dinner,2 238 | 236,12.6,1.0,Male,Yes,Sat,Dinner,2 239 | 237,32.83,1.17,Male,Yes,Sat,Dinner,2 240 | 238,35.83,4.67,Female,No,Sat,Dinner,3 241 | 239,29.03,5.92,Male,No,Sat,Dinner,3 242 | 240,27.18,2.0,Female,Yes,Sat,Dinner,2 243 | 241,22.67,2.0,Male,Yes,Sat,Dinner,2 244 | 242,17.82,1.75,Male,No,Sat,Dinner,2 245 | 243,18.78,3.0,Female,No,Thur,Dinner,2 246 | -------------------------------------------------------------------------------- /dataset/weekly.csv: -------------------------------------------------------------------------------- 1 | Date,Total Equity,Domestic Equity,World Equity,Hybrid,Total Bond,Taxable Bond,Municipal Bond,Total 2 | 2012-12-05,-7426,-6060,-1367,-74,5317,4210,1107,-2183 3 | 2012-12-12,-8783,-7520,-1263,123,1818,1598,219,-6842 4 | 2012-12-19,-5496,-5470,-26,-73,103,3472,-3369,-5466 5 | 2012-12-26,-4451,-4076,-375,550,2610,3333,-722,-1291 6 | 2013-01-02,-11156,-9622,-1533,-158,2383,2103,280,-8931 7 | 2013-01-09,14817,7995,6821,2888,9766,7311,2455,27471 8 | 2014-04-02,3155,938,2217,265,3379,3129,250,6799 9 | 2014-04-09,5761,2080,3681,1482,1609,1448,161,8852 10 | 2014-04-16,2286,634,1652,1186,633,604,29,4105 11 | 2014-04-23,3530,1392,2138,1239,1984,1453,531,6753 12 | 2014-04-30,-3890,-3996,106,759,888,559,329,-2242 13 | 2014-05-07,632,-2006,2639,-340,5493,4417,1076,5785 14 | 2014-05-14,-1079,-2321,1242,1188,4037,3141,897,4146 15 | 2014-05-21,697,-1790,2487,1216,2196,1398,798,4109 16 | 2014-05-28,-2453,-2603,150,1108,2041,1236,805,696 17 | 2014-06-04,2098,-1148,3246,1123,188,-470,658,3409 18 | 2014-06-11,1236,-1840,3075,1159,2112,1587,524,4506 19 | 2014-06-18,-922,-2204,1282,1060,4159,3740,419,4297 20 | 2014-06-25,-93,-1354,1262,1246,3256,2694,562,4409 21 | 2014-07-02,-7835,-8887,1052,636,2979,2704,276,-4220 22 | 2014-07-09,666,-1070,1736,1006,2721,3203,-482,4393 23 | 2014-07-30,118,-1171,1290,1024,1806,1119,687,2949 24 | 2014-08-06,-471,-3073,2602,-375,-8193,-8658,465,-9040 25 | 2014-08-13,320,-974,1294,496,1436,539,897,2252 26 | 2014-08-20,2671,738,1933,821,4999,4185,814,8490 27 | 2014-08-27,-577,-2199,1623,943,3655,2921,734,4021 28 | 2014-09-03,-4024,-5305,1281,544,2430,1768,661,-1050 29 | 2014-09-10,1257,-1291,2548,1055,1554,711,843,3866 30 | 2014-11-05,-32,-1634,1602,-176,5813,5284,529,5604 31 | 2014-11-12,1464,61,1403,963,3596,2703,893,6023 32 | 2014-11-19,-3010,-3622,611,99,2529,1758,771,-383 33 | 2014-11-25,-1175,-2044,869,-157,2590,1821,769,1258 34 | 2015-01-07,-3913,-5438,1525,-1057,-3403,-4729,1326,-8373 35 | 2015-01-14,1774,-37,1811,248,3549,2582,967,5572 36 | 2015-01-21,1267,856,411,790,1258,220,1038,3315 37 | 2015-01-28,4343,3455,888,1748,5964,4689,1275,12055 38 | 2015-02-04,4240,3536,703,793,3237,2274,963,8270 39 | 2015-02-11,1268,-27,1296,959,5862,5169,693,8089 40 | 2015-03-04,999,-1933,2932,528,4984,4309,675,6511 41 | 2015-03-11,3911,-7,3918,851,1298,999,298,6059 42 | 2015-03-18,1948,-1758,3706,912,452,258,194,3312 43 | 2015-03-25,-1167,-4478,3311,538,2404,1701,703,1775 44 | 2015-04-01,-1527,-3307,1780,720,-1296,-1392,96,-2103 45 | 2015-04-08,1906,-1321,3227,250,1719,1906,-187,3875 46 | --------------------------------------------------------------------------------