├── 01. Day 1 - Python Basics ├── decision_making.ipynb └── loops.ipynb ├── 02. Day 2 - Functions and Modules ├── functions.ipynb └── high_functions.ipynb ├── 03. Day 3 - Built-in Data Structures ├── dictionary.ipynb ├── list_compre.ipynb ├── lists.ipynb ├── set.ipynb └── tuple.ipynb ├── 04. Day 4 - File Handling and Exception Handling ├── exceptions.ipynb ├── file.ipynb ├── file.txt ├── geek.txt ├── new_file.txt ├── other_file.txt ├── others │ └── geek.txt └── write.txt ├── 05. Day 5 - Python Classes and Objects ├── Python Classes Handwritten Notes.pdf └── classes.ipynb ├── 06. Day 6 - OOPs Concepts Implementation in Python ├── OOPs Implementation in Python.pdf └── classes.ipynb ├── 07. Day 7 - Advanced Topics ├── RegEx Handwritten Notes.pdf ├── high_functions.ipynb ├── list_compre.ipynb └── regex.ipynb ├── 08. Day 8 - Python MySQL ├── Python MySQL Database Notes.pdf └── db.ipynb ├── 09. Day 9 - Day 1 of Project └── bank_mangment │ ├── Account.py │ ├── Customer.py │ ├── Transaction.py │ ├── __pycache__ │ ├── Account.cpython-311.pyc │ ├── Customer.cpython-311.pyc │ ├── Transaction.cpython-311.pyc │ └── db_conn.cpython-311.pyc │ ├── bank.py │ ├── bank_db.py │ ├── db_ER_diagram.pdf │ └── db_conn.py ├── 10. Day 10 - Day 2 of Project ├── Account.py ├── Account_menu.py ├── Customer.py ├── New_Menu.py ├── README.md ├── Transaction.py ├── __pycache__ │ ├── Account.cpython-311.pyc │ ├── Customer.cpython-311.pyc │ ├── New_Menu.cpython-311.pyc │ ├── Transaction.cpython-311.pyc │ ├── create_account.cpython-311.pyc │ ├── create_customer.cpython-311.pyc │ ├── cust_login.cpython-311.pyc │ └── db_conn.cpython-311.pyc ├── a.py ├── bank.py ├── bank_db.py ├── create_account.py ├── create_customer.py ├── cust_login.py └── db_conn.py ├── 11. Day 11 - Project Completion ├── Account.py ├── Account_menu.py ├── Customer.py ├── Errors.py ├── New_Menu.py ├── Transaction.py ├── Transfer.py ├── __pycache__ │ ├── Account.cpython-311.pyc │ ├── Account_menu.cpython-311.pyc │ ├── Customer.cpython-311.pyc │ ├── Errors.cpython-311.pyc │ ├── New_Menu.cpython-311.pyc │ ├── Transaction.cpython-311.pyc │ ├── Transfer.cpython-311.pyc │ ├── create_account.cpython-311.pyc │ ├── create_customer.cpython-311.pyc │ ├── cust_login.cpython-311.pyc │ └── db_conn.cpython-311.pyc ├── bank.py ├── bank_db.py ├── create_account.py ├── create_customer.py ├── cust_login.py └── db_conn.py ├── 12. Day 12 - NumPy Basics ├── numpy.ipynb └── numpy_notes.pdf ├── 13. Day 13 - Numpy Math Operations ├── numpy_math_oper.ipynb └── numpy_math_operations.pdf ├── 14. Day 14 - NumPy Statistic Functions ├── Statistic_functions_Notes.pdf └── numpy_stat_func.ipynb ├── 15. Day 15 - (1-8-23) Pandas Introduction ├── Housing.csv ├── Pandas_intro_Notes.pdf ├── df_csv.csv ├── df_html.html ├── df_json.json └── pandas_intro.ipynb ├── 16. Day 16 - Pandas Data Manipulation ├── Pandas_Data_Manipulation_Notes.pdf └── data_manipulation.ipynb ├── 17. Day 17 - Pandas Data Cleaning ├── Data Cleaning Notes.pdf └── pandas_cleaning.ipynb ├── 18. Day 18 - Pandas Time Series, Feature Engg ├── COVID_19_Containment_measures_data.csv ├── Feature_engg_Time_series_note.pdf ├── IRIS.csv ├── covid_data.csv └── pandas_time_series.ipynb ├── 19. Day 19 - Matplotlib Intro ├── MatplotLib Intro.pdf └── matplotlib_info.ipynb ├── 20. Day 20 - Matplotlib - Scatter and Histogram ├── matplotlib scatter hist notes.pdf └── matplotlib_scatter_hist.ipynb ├── 21. Day 21 - Seaborn Intro ├── Seaborn Intro Notes.pdf └── seaborn_intro.ipynb ├── 22. Day 22 - Seaborn Visualization ├── seaborn visualization notes.pdf └── seaborn_visualization.ipynb ├── 23. Day 23 - Python Basics Revision └── Python Fundamentals Handwritten Notes.pdf ├── 24. Day 24 - NumPy Revision └── NumPy Revision Handwritten Notes.pdf ├── 25. Day 25 - Pandas Revision └── Pandas Revision Handwritten Notes.pdf ├── 26. Day 26 - AI and ML Fundamentals ├── AI and ML Fundamentals Notes.pdf ├── ML.webp └── README.md ├── 27. Day 27 - ML Workflow ├── Machine_Learning_Workflow.pdf ├── Machine_Learning_Workflow_page-0001.jpg └── README.md ├── 28. Day 28 - Model Evaluation Technique ├── README.md └── evaluation.png ├── 29. Day 29 - Overfitting and Underfitting ├── Overfitting_Underfitting_Notes.pdf └── over_under_fit.ipynb ├── 30. Day 30 - Simple Linear Regression ├── README.md ├── SLR Implementation.jpg ├── Simple Linear Regression Notes .pdf ├── Simple Linear Regression.pdf ├── download.png └── linearregrsalaryprediction.ipynb ├── 31. Day 31 - Multiple Linear Regression ├── MLR Implementation.jpg ├── Multiple Linear Regression Notes.pdf ├── README.md └── multiple-linear-regression-student-persormance.ipynb ├── 32. Day 32 - Classification in ML └── Classification in ML.pdf ├── 33. Day 33 - Logistic Regression ├── Logistic Regression Notes .pdf ├── LogisticRegressionIRIS.ipynb └── logistic-regression-titanic.ipynb ├── 34. Day 34 - Decision Tree Concept └── Decision Tree Handwritten Notes.pdf ├── 35. Day 35 - Decision Tree Implementation ├── Decision Tree Implementation.pdf ├── Decision Tree Implementation_page-0001.jpg ├── README.md ├── decisiontreeiris.ipynb └── decisiontreeredwine.ipynb ├── 36. Day 36 - Ensemble Methods ├── New Text Document.txt └── README.md ├── 37. Day 37 - Gradient Boosting └── README.md ├── 38. Day 38 - AdaBoost and XGBoost └── README.md ├── 39. Day 39 - Random Forests Introduction └── README.md ├── 40. Day 40 - Random Forests Implementation ├── Hyperparameter Tuning.pdf ├── HyperparameterRandomForestRedWine.ipynb ├── Random Forest Implementation.pdf ├── Random Forest Implementation_page.jpg ├── RandomForestClassifierIRIS.ipynb └── RandomForestRedWine.ipynb ├── 41. Day 41 - Decision Tree and Random Forest Example └── decision-tree-random-forest-social-network-ads.ipynb ├── 42. Day 42 - SVM Intro └── SVM Introduction.pdf ├── 43. Day 43 - Linear and Non-Linear SVM Implementation ├── SVM Implementation.pdf ├── linear-svm-social-network-ads.ipynb └── non-linear-svm-iris-flower.ipynb ├── 44. Day 44 - SVM Regression Implementation ├── svm-regression-boston-house-pricing.ipynb └── svm-regression-salary-dataset.ipynb ├── 45. Day 45 - KNN Introduction └── KNN Introduction Notes.pdf ├── 46. Day 46 - (1 Sept 2023) KNN Implementation ├── KNN Classification Steps.jpg ├── KNN Regression Steps.jpg ├── README.md ├── knn-classification-iris-flower.ipynb ├── knn-classification-mushroom-classification.ipynb ├── knn-regression-salary-dataset.ipynb └── knn-regression-student-performance-prediction.ipynb ├── 47. Day 47 - KNN Hyperparameter Tuning ├── README.md ├── knn-clf-bmi-classification-hyperparameter.ipynb └── knn-regr-house-price-prediction-hyperparameter.ipynb ├── 48. Day 48 - ML Fundamentals Revision ├── ML Fundamentals Revision Notes.pdf └── Types of Supervised Learning Algo_page-0001.jpg ├── 49. Day 49 - Capstone Project - 5G Resources - MLR, SVR, KNN_R ├── 5g-quality-of-service-all-regression-algorithms.ipynb ├── 5g-quality-of-service-all-regression-algorithms.pdf └── compare_MLR_SVR_KNN.png ├── 50. Day 50 - Capstone Project - Gender Classification - LR, DT, RF, SVM and KNN ├── Compare_LR_DT_RF_SVM_KNN.png ├── gender-classification-lr-dt-rf-svm-and-knn.ipynb └── gender-classification-lr-dt-rf-svm-and-knn.pdf ├── 51. Day 51 - Intro to Cross Validation └── Cross Validation Notes.pdf ├── 52. Day 52 - Cross Validation Implementation ├── k-fold-cross-validation.ipynb └── stratified-k-fold-cross-validation.ipynb ├── 53. Day 53 - Perform EDA Operation ├── eda-on-fifa19-dataset.ipynb ├── eda-on-restaurant-dataset.ipynb └── eda-on-walmart-sales-dataset.ipynb ├── 54. Day 54 - Dimensionality Reduction Intro ├── Dimensionality Reduction Techniques.pdf ├── Dimensionality Reduction Techniques_pages-to-jpg-0001.jpg └── Dimensionality Reduction.pdf ├── 55. Day 55 - Intro to PCA ├── PCA Intro Notes.pdf └── README.md ├── 56. Day 56 - Step in PCA ├── README.md ├── Steps in PCA Notes.pdf ├── covar.svg ├── eig1.svg ├── eig2.svg └── eig3.svg ├── 57. Day 57 - PCA Solved Example └── PCA Solved Example.pdf ├── 58. Day 58 - PCA Implementation ├── PCA.pdf └── principal-component-analysis.ipynb ├── 59. Day 59 - Feature Selection Intro ├── Feature Selection.pdf └── Feature selection.png ├── 60. Day 60 - Feature Selection - Filter Methods ├── Filter Methods.pdf └── feature-selection-filter-methods.ipynb ├── 61. Day 61 - Feature Selection - Wrapper Methods └── Wrapper Methods.pdf ├── 62. Day 62 - Feature Selection - Embedded Methods └── Embedded Methods Feature Selection.pdf ├── 63. Day 63 - EDA on IPL Dataset └── ipl-all-time-best-batsman.ipynb ├── 64. Day 64 - Used Car Price Prediction using SVR ├── used-car-price-prediction-svr.ipynb └── used-car-price-prediction-svr.pdf ├── 65. Day 65 - Movies Recommendation ├── movie-recommendation-with-gridsearch.ipynb └── movie-recommendation-with-gridsearch.pdf ├── 66. Day 66 - SLR on Insurance Dataset ├── slr-notebook.ipynb └── slr-notebook.pdf ├── 67. Day 67 - Linear Regression Salary Dataset ├── salary-dataset-of-busssiness.ipynb └── salary-dataset-of-busssiness.pdf ├── 68. Day 68 - EDA on Gym Exercise Dataset ├── gym-exercises-eda.ipynb └── gym-exercises-eda.pdf ├── 69. Day 69 - EDA on Life Expectations Dataset ├── life-expectancy-eda.ipynb └── life-expectancy-eda.pdf ├── 70. Day 70 - EDA on Student Dropout ├── predict-student-s-drop.ipynb └── predict-student-s-drop.pdf ├── 71. Day 71 - Intro to Clustering └── Clustering Intro.pdf ├── 72. Day 72 - Clustering Algorithms └── Clustering Algorithm.pdf ├── 73. Day 73 - K-means Implementation ├── k-means-customer-clustering.ipynb └── k-means-customer-clustering.pdf ├── 74. Day 74 - K-Means Credit Card Clustering ├── k-means-credit-card-clustering.ipynb └── k-means-credit-card-clustering.pdf ├── 75. Day 75 - Visualize Clusters Exercise ├── results.png ├── visualize-clustering-exercises.ipynb └── visualize-clustering-exercises.pdf ├── 76. Day 76 - Hierarchical Clustering ├── online-retail-k-means-hierarchical-clustering.ipynb └── online-retail-k-means-hierarchical-clustering.pdf ├── 77. Day 77 - Hierarchical Clustering └── Hierarchical clustering.pdf ├── README.md └── data_science.jpg /01. Day 1 - Python Basics/decision_making.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "> **if statement:**" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "i is greater than 5..\n" 20 | ] 21 | } 22 | ], 23 | "source": [ 24 | "# if statement\n", 25 | "i = 10\n", 26 | "if i>5:\n", 27 | " print('i is greater than 5..')" 28 | ] 29 | }, 30 | { 31 | "cell_type": "markdown", 32 | "metadata": {}, 33 | "source": [ 34 | "> **if-else statement:**" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": 2, 40 | "metadata": {}, 41 | "outputs": [ 42 | { 43 | "name": "stdout", 44 | "output_type": "stream", 45 | "text": [ 46 | "i is less than 5\n" 47 | ] 48 | } 49 | ], 50 | "source": [ 51 | "i = 1\n", 52 | "if i>5:\n", 53 | " print('i is greater than 5..')\n", 54 | "else:\n", 55 | " print('i is less than 5')" 56 | ] 57 | }, 58 | { 59 | "cell_type": "markdown", 60 | "metadata": {}, 61 | "source": [ 62 | "> **if-elif-else statement:**" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": 3, 68 | "metadata": {}, 69 | "outputs": [ 70 | { 71 | "name": "stdout", 72 | "output_type": "stream", 73 | "text": [ 74 | "i is equal 10..\n" 75 | ] 76 | } 77 | ], 78 | "source": [ 79 | "i = 10\n", 80 | "if i==5:\n", 81 | " print('i is equal 5..')\n", 82 | "elif i==10:\n", 83 | " print('i is equal 10..')\n", 84 | "else:\n", 85 | " print('i is other..')" 86 | ] 87 | }, 88 | { 89 | "cell_type": "markdown", 90 | "metadata": {}, 91 | "source": [ 92 | "> **Nested-if statements:**" 93 | ] 94 | }, 95 | { 96 | "cell_type": "code", 97 | "execution_count": 4, 98 | "metadata": {}, 99 | "outputs": [ 100 | { 101 | "name": "stdout", 102 | "output_type": "stream", 103 | "text": [ 104 | "Grade: B\n" 105 | ] 106 | } 107 | ], 108 | "source": [ 109 | "# Program to determine a student's grade based on their marks\n", 110 | "\n", 111 | "marks = int(input(\"Enter the student's marks: \"))\n", 112 | "\n", 113 | "if marks >= 90:\n", 114 | " grade = 'A'\n", 115 | " if marks >= 95:\n", 116 | " distinction = True\n", 117 | " else:\n", 118 | " distinction = False\n", 119 | "elif marks >= 80:\n", 120 | " grade = 'B'\n", 121 | " distinction = False\n", 122 | "elif marks >= 70:\n", 123 | " grade = 'C'\n", 124 | " distinction = False\n", 125 | "elif marks >= 60:\n", 126 | " grade = 'D'\n", 127 | " distinction = False\n", 128 | "else:\n", 129 | " grade = 'F'\n", 130 | " distinction = False\n", 131 | "\n", 132 | "print(\"Grade:\", grade)\n", 133 | "\n", 134 | "if distinction:\n", 135 | " print(\"Distinction achieved!\")\n" 136 | ] 137 | }, 138 | { 139 | "cell_type": "markdown", 140 | "metadata": {}, 141 | "source": [ 142 | "> **Short hand if statement:**" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": 2, 148 | "metadata": {}, 149 | "outputs": [ 150 | { 151 | "name": "stdout", 152 | "output_type": "stream", 153 | "text": [ 154 | "i less than 15\n" 155 | ] 156 | } 157 | ], 158 | "source": [ 159 | "# Short hand if statement\n", 160 | "\n", 161 | "i = 10\n", 162 | "if i<15: print('i less than 15..')" 163 | ] 164 | }, 165 | { 166 | "cell_type": "code", 167 | "execution_count": 3, 168 | "metadata": {}, 169 | "outputs": [ 170 | { 171 | "name": "stdout", 172 | "output_type": "stream", 173 | "text": [ 174 | "True\n" 175 | ] 176 | } 177 | ], 178 | "source": [ 179 | "# Short hand if-else statement\n", 180 | "\n", 181 | "i = 10\n", 182 | "print(True) if i==10 else print(False)" 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": 6, 188 | "metadata": {}, 189 | "outputs": [ 190 | { 191 | "name": "stdout", 192 | "output_type": "stream", 193 | "text": [ 194 | "Not matched\n" 195 | ] 196 | } 197 | ], 198 | "source": [ 199 | "# match-case statement\n", 200 | "\n", 201 | "flag = int(input('Enter num: '))\n", 202 | "\n", 203 | "match flag:\n", 204 | " case 5 :\n", 205 | " print('Flag = 5')\n", 206 | " case 10 :\n", 207 | " print('Flag = 10')\n", 208 | " case 15 :\n", 209 | " print('Flag = 15')\n", 210 | " case 20 :\n", 211 | " print('Flag = 20')\n", 212 | " case _ :\n", 213 | " print('Not matched')" 214 | ] 215 | }, 216 | { 217 | "cell_type": "code", 218 | "execution_count": 9, 219 | "metadata": {}, 220 | "outputs": [ 221 | { 222 | "name": "stdout", 223 | "output_type": "stream", 224 | "text": [ 225 | "Allowed access to Admin..\n" 226 | ] 227 | } 228 | ], 229 | "source": [ 230 | "# Match case with OR statement\n", 231 | "\n", 232 | "role = 'Admin'\n", 233 | "\n", 234 | "match role:\n", 235 | " case 'Emp' | 'User':\n", 236 | " print('Not allowed access..')\n", 237 | " case 'Admin':\n", 238 | " print('Allowed access to Admin..')\n", 239 | " case _ :\n", 240 | " print('No role..')" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 11, 246 | "metadata": {}, 247 | "outputs": [ 248 | { 249 | "name": "stdout", 250 | "output_type": "stream", 251 | "text": [ 252 | "No role..\n" 253 | ] 254 | } 255 | ], 256 | "source": [ 257 | "# Use of if in match-case statement\n", 258 | "\n", 259 | "inp = 'Emp'\n", 260 | "roles = ['User', 'Admin']\n", 261 | "\n", 262 | "match inp:\n", 263 | " case 'Emp' if inp in roles:\n", 264 | " print('Access..')\n", 265 | " case 'Admin' if inp in roles:\n", 266 | " print('Access..')\n", 267 | " case _ :\n", 268 | " print('No role..')" 269 | ] 270 | }, 271 | { 272 | "cell_type": "code", 273 | "execution_count": 16, 274 | "metadata": {}, 275 | "outputs": [], 276 | "source": [ 277 | "# Match the sequence patern\n", 278 | "def matchSeq(lst):\n", 279 | " match lst:\n", 280 | " case ['a']:\n", 281 | " print('Only 1 char : a')\n", 282 | " case _:\n", 283 | " print('No match')" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 17, 289 | "metadata": {}, 290 | "outputs": [ 291 | { 292 | "name": "stdout", 293 | "output_type": "stream", 294 | "text": [ 295 | "No match\n" 296 | ] 297 | } 298 | ], 299 | "source": [ 300 | "matchSeq(['a'])" 301 | ] 302 | }, 303 | { 304 | "cell_type": "code", 305 | "execution_count": null, 306 | "metadata": {}, 307 | "outputs": [], 308 | "source": [] 309 | } 310 | ], 311 | "metadata": { 312 | "kernelspec": { 313 | "display_name": "Python 3", 314 | "language": "python", 315 | "name": "python3" 316 | }, 317 | "language_info": { 318 | "codemirror_mode": { 319 | "name": "ipython", 320 | "version": 3 321 | }, 322 | "file_extension": ".py", 323 | "mimetype": "text/x-python", 324 | "name": "python", 325 | "nbconvert_exporter": "python", 326 | "pygments_lexer": "ipython3", 327 | "version": "3.11.3" 328 | }, 329 | "orig_nbformat": 4 330 | }, 331 | "nbformat": 4, 332 | "nbformat_minor": 2 333 | } 334 | -------------------------------------------------------------------------------- /01. Day 1 - Python Basics/loops.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# **while Loop**" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 6, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "1\n", 20 | "2\n", 21 | "3\n", 22 | "4\n" 23 | ] 24 | } 25 | ], 26 | "source": [ 27 | "# While loop\n", 28 | "count = 1\n", 29 | "while count<5:\n", 30 | " print(count)\n", 31 | " count += 1\n" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 7, 37 | "metadata": {}, 38 | "outputs": [ 39 | { 40 | "name": "stdout", 41 | "output_type": "stream", 42 | "text": [ 43 | "1\n", 44 | "2\n", 45 | "3\n", 46 | "4\n", 47 | "End of else\n" 48 | ] 49 | } 50 | ], 51 | "source": [ 52 | "# While loop with else block\n", 53 | "count = 1\n", 54 | "while count<5:\n", 55 | " print(count)\n", 56 | " count += 1\n", 57 | "else:\n", 58 | " print('End of else')" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": 2, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "# Infinite While Loop\n", 68 | "count = 1\n", 69 | "while True:\n", 70 | " print(count, end=' ')\n", 71 | " count += 1" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "# **for Loop**" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 1, 84 | "metadata": {}, 85 | "outputs": [ 86 | { 87 | "name": "stdout", 88 | "output_type": "stream", 89 | "text": [ 90 | "1\n", 91 | "2\n", 92 | "3\n", 93 | "4\n" 94 | ] 95 | } 96 | ], 97 | "source": [ 98 | "# for loop with range() Function\n", 99 | "for i in range(1,5):\n", 100 | " print(i)" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 6, 106 | "metadata": {}, 107 | "outputs": [ 108 | { 109 | "name": "stdout", 110 | "output_type": "stream", 111 | "text": [ 112 | "\n", 113 | "List Iteration\n", 114 | "1 2 3 4 \n", 115 | "1 2 3 4 \n", 116 | "0 1\n", 117 | "1 2\n", 118 | "2 3\n", 119 | "3 4\n", 120 | "\n", 121 | "Tuple Iteration\n", 122 | "6 7 8 9 \n", 123 | "6 7 8 9 \n", 124 | "0 6\n", 125 | "1 7\n", 126 | "2 8\n", 127 | "3 9\n", 128 | "\n", 129 | "Set Iteration\n", 130 | "11 12 13 14 \n", 131 | "\n", 132 | "Dictionary Iteration\n", 133 | "1 2 3 4 \n", 134 | "11 22 33 44 \n", 135 | "(1, 11) (2, 22) (3, 33) (4, 44) \n", 136 | "1 : 11\n", 137 | "2 : 22\n", 138 | "3 : 33\n", 139 | "4 : 44\n", 140 | "\n", 141 | "\n", 142 | "String Iteration\n", 143 | "S n e h a l \n", 144 | "S n e h a l " 145 | ] 146 | } 147 | ], 148 | "source": [ 149 | "# list, tuple, set, string and dict iteration using loop\n", 150 | "# 1. list iteration\n", 151 | "print('\\nList Iteration')\n", 152 | "lst = [1,2,3,4]\n", 153 | "for i in lst:\n", 154 | " print(i, end=' ')\n", 155 | "print()\n", 156 | "for i in range(len(lst)):\n", 157 | " print(lst[i], end=' ')\n", 158 | "print()\n", 159 | "for i,e in enumerate(lst):\n", 160 | " print(i,e)\n", 161 | "\n", 162 | "# 2. Tuple Iteration\n", 163 | "print('\\nTuple Iteration')\n", 164 | "t = (6,7,8,9)\n", 165 | "for i in t:\n", 166 | " print(i, end=' ')\n", 167 | "print()\n", 168 | "for i in range(len(t)):\n", 169 | " print(t[i], end=' ')\n", 170 | "print()\n", 171 | "for i,e in enumerate(t):\n", 172 | " print(i,e)\n", 173 | "\n", 174 | "# 3. Set Iteration\n", 175 | "print('\\nSet Iteration')\n", 176 | "st = {11,12,13,14,12,14,12,11,13,14}\n", 177 | "for i in st:\n", 178 | " print(i, end=' ')\n", 179 | "print()\n", 180 | "# Set does not support indexing\n", 181 | "# for i in range(len(t)):\n", 182 | "# print(t[i], end=' ')\n", 183 | "\n", 184 | "# 4. Dictionary Iteration\n", 185 | "print('\\nDictionary Iteration')\n", 186 | "d = {1:11,2:22,3:33,4:44}\n", 187 | "for i in d.keys():\n", 188 | " print(i, end=' ')\n", 189 | "print()\n", 190 | "for i in d.values():\n", 191 | " print(i, end=' ')\n", 192 | "print()\n", 193 | "for i in d.items():\n", 194 | " print(i, end=' ')\n", 195 | "print()\n", 196 | "for i in d.keys():\n", 197 | " print(i,':',d[i])\n", 198 | "print()\n", 199 | "\n", 200 | "# 5. String Iteration\n", 201 | "print('\\nString Iteration')\n", 202 | "sg = 'Snehal'\n", 203 | "for i in sg:\n", 204 | " print(i, end=' ')\n", 205 | "print()\n", 206 | "for i in range(len(sg)):\n", 207 | " print(sg[i], end=' ')" 208 | ] 209 | }, 210 | { 211 | "cell_type": "code", 212 | "execution_count": 1, 213 | "metadata": {}, 214 | "outputs": [ 215 | { 216 | "name": "stdout", 217 | "output_type": "stream", 218 | "text": [ 219 | "* \n", 220 | "* * \n", 221 | "* * * \n", 222 | "* * * * \n", 223 | "* * * * * \n" 224 | ] 225 | } 226 | ], 227 | "source": [ 228 | "# Nested loops\n", 229 | "\n", 230 | "for i in range(1,6):\n", 231 | " for j in range(i):\n", 232 | " print('*', end=' ')\n", 233 | " print()" 234 | ] 235 | }, 236 | { 237 | "cell_type": "markdown", 238 | "metadata": {}, 239 | "source": [ 240 | "# **Looping control statements**" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 2, 246 | "metadata": {}, 247 | "outputs": [ 248 | { 249 | "name": "stdout", 250 | "output_type": "stream", 251 | "text": [ 252 | "2\n", 253 | "4\n", 254 | "6\n", 255 | "8\n", 256 | "10\n" 257 | ] 258 | } 259 | ], 260 | "source": [ 261 | "for i in range(1,11):\n", 262 | " if i%2==1:\n", 263 | " continue\n", 264 | " print(i)" 265 | ] 266 | }, 267 | { 268 | "cell_type": "code", 269 | "execution_count": 3, 270 | "metadata": {}, 271 | "outputs": [ 272 | { 273 | "name": "stdout", 274 | "output_type": "stream", 275 | "text": [ 276 | "1\n", 277 | "2\n", 278 | "3\n", 279 | "4\n" 280 | ] 281 | } 282 | ], 283 | "source": [ 284 | "for i in range(1,11):\n", 285 | " if i%5==0:\n", 286 | " break\n", 287 | " print(i)" 288 | ] 289 | }, 290 | { 291 | "cell_type": "code", 292 | "execution_count": 4, 293 | "metadata": {}, 294 | "outputs": [ 295 | { 296 | "name": "stdout", 297 | "output_type": "stream", 298 | "text": [ 299 | "Nothing done\n" 300 | ] 301 | } 302 | ], 303 | "source": [ 304 | "for i in range(5):\n", 305 | " pass\n", 306 | "\n", 307 | "print('Nothing done')" 308 | ] 309 | }, 310 | { 311 | "cell_type": "code", 312 | "execution_count": null, 313 | "metadata": {}, 314 | "outputs": [], 315 | "source": [] 316 | } 317 | ], 318 | "metadata": { 319 | "kernelspec": { 320 | "display_name": "Python 3", 321 | "language": "python", 322 | "name": "python3" 323 | }, 324 | "language_info": { 325 | "codemirror_mode": { 326 | "name": "ipython", 327 | "version": 3 328 | }, 329 | "file_extension": ".py", 330 | "mimetype": "text/x-python", 331 | "name": "python", 332 | "nbconvert_exporter": "python", 333 | "pygments_lexer": "ipython3", 334 | "version": "3.11.3" 335 | }, 336 | "orig_nbformat": 4 337 | }, 338 | "nbformat": 4, 339 | "nbformat_minor": 2 340 | } 341 | -------------------------------------------------------------------------------- /02. Day 2 - Functions and Modules/high_functions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "> **1. Lambda Function**" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 4, 14 | "metadata": {}, 15 | "outputs": [ 16 | { 17 | "name": "stdout", 18 | "output_type": "stream", 19 | "text": [ 20 | "30\n", 21 | "16\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "ad = lambda a:a+10\n", 27 | "print(ad(20))\n", 28 | "\n", 29 | "sqr = lambda x:x**2\n", 30 | "print(sqr(4))" 31 | ] 32 | }, 33 | { 34 | "attachments": {}, 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "> **2. map**" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 7, 44 | "metadata": {}, 45 | "outputs": [ 46 | { 47 | "name": "stdout", 48 | "output_type": "stream", 49 | "text": [ 50 | "[1, 4, 9, 16, 25]\n", 51 | "[21, 22, 23, 24, 25]\n" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "# map(func, iterable)\n", 57 | "\n", 58 | "lst = [1,2,3,4,5]\n", 59 | "\n", 60 | "sqrs = list(map(sqr, lst))\n", 61 | "print(sqrs)\n", 62 | "\n", 63 | "ads = list(map(lambda a:a+20, lst))\n", 64 | "print(ads)" 65 | ] 66 | }, 67 | { 68 | "attachments": {}, 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "> **3. filter**" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 10, 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "name": "stdout", 82 | "output_type": "stream", 83 | "text": [ 84 | "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n", 85 | "[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n" 86 | ] 87 | } 88 | ], 89 | "source": [ 90 | "# filter(condition, iterable)\n", 91 | "\n", 92 | "even = list(filter(lambda x:x%2==0, range(1,21)))\n", 93 | "print(even)\n", 94 | "\n", 95 | "odd = list(filter(lambda x:x%2==1, range(1,21)))\n", 96 | "print(odd)" 97 | ] 98 | }, 99 | { 100 | "attachments": {}, 101 | "cell_type": "markdown", 102 | "metadata": {}, 103 | "source": [ 104 | "> **4. reduce**" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 12, 110 | "metadata": {}, 111 | "outputs": [ 112 | { 113 | "name": "stdout", 114 | "output_type": "stream", 115 | "text": [ 116 | "210\n" 117 | ] 118 | } 119 | ], 120 | "source": [ 121 | "from functools import reduce\n", 122 | "\n", 123 | "\n", 124 | "a = reduce(lambda a,b:a+b,range(1,21))\n", 125 | "print(a)" 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": null, 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [] 134 | } 135 | ], 136 | "metadata": { 137 | "kernelspec": { 138 | "display_name": "Python 3", 139 | "language": "python", 140 | "name": "python3" 141 | }, 142 | "language_info": { 143 | "codemirror_mode": { 144 | "name": "ipython", 145 | "version": 3 146 | }, 147 | "file_extension": ".py", 148 | "mimetype": "text/x-python", 149 | "name": "python", 150 | "nbconvert_exporter": "python", 151 | "pygments_lexer": "ipython3", 152 | "version": "3.11.3" 153 | }, 154 | "orig_nbformat": 4 155 | }, 156 | "nbformat": 4, 157 | "nbformat_minor": 2 158 | } 159 | -------------------------------------------------------------------------------- /03. Day 3 - Built-in Data Structures/list_compre.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n" 13 | ] 14 | } 15 | ], 16 | "source": [ 17 | "# 1. Even list using list comprehension\n", 18 | "\n", 19 | "even = [i for i in range(1,21) if i%2==0]\n", 20 | "print(even)" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n" 33 | ] 34 | } 35 | ], 36 | "source": [ 37 | "# 2. Odd list using list comprehension\n", 38 | "\n", 39 | "odd = [i for i in range(1,21) if i%2!=0]\n", 40 | "print(odd)" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 4, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "name": "stdout", 50 | "output_type": "stream", 51 | "text": [ 52 | "[[0, 1, 2], [0, 1, 2], [0, 1, 2]]\n" 53 | ] 54 | } 55 | ], 56 | "source": [ 57 | "# 3. Matrix generation using list comprehension\n", 58 | "\n", 59 | "mat = [[j for j in range(3)] for i in range(3)]\n", 60 | "print(mat)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 9, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "name": "stdout", 70 | "output_type": "stream", 71 | "text": [ 72 | "['S', 'n', 'e', 'h', 'a', 'l', ' ', 'M', 'a', 'n', 'k', 'a', 'r']\n" 73 | ] 74 | } 75 | ], 76 | "source": [ 77 | "# 4. List comprehenstion to iterate through the string\n", 78 | "\n", 79 | "letters = [a for a in 'Snehal Mankar']\n", 80 | "print(letters)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [] 89 | } 90 | ], 91 | "metadata": { 92 | "kernelspec": { 93 | "display_name": "Python 3", 94 | "language": "python", 95 | "name": "python3" 96 | }, 97 | "language_info": { 98 | "codemirror_mode": { 99 | "name": "ipython", 100 | "version": 3 101 | }, 102 | "file_extension": ".py", 103 | "mimetype": "text/x-python", 104 | "name": "python", 105 | "nbconvert_exporter": "python", 106 | "pygments_lexer": "ipython3", 107 | "version": "3.11.3" 108 | }, 109 | "orig_nbformat": 4 110 | }, 111 | "nbformat": 4, 112 | "nbformat_minor": 2 113 | } 114 | -------------------------------------------------------------------------------- /03. Day 3 - Built-in Data Structures/tuple.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "6\n", 13 | "\n" 14 | ] 15 | } 16 | ], 17 | "source": [ 18 | "# Length and type\n", 19 | "\n", 20 | "t = (1,2,3,4,5,6)\n", 21 | "print(len(t))\n", 22 | "print(type(t))" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": 2, 28 | "metadata": {}, 29 | "outputs": [ 30 | { 31 | "name": "stdout", 32 | "output_type": "stream", 33 | "text": [ 34 | "1\n", 35 | "6\n", 36 | "21\n" 37 | ] 38 | } 39 | ], 40 | "source": [ 41 | "# min, max and sum\n", 42 | "\n", 43 | "t = (1,2,3,4,5,6)\n", 44 | "print(min(t))\n", 45 | "print(max(t))\n", 46 | "print(sum(t))" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 5, 52 | "metadata": {}, 53 | "outputs": [ 54 | { 55 | "name": "stdout", 56 | "output_type": "stream", 57 | "text": [ 58 | "3\n", 59 | "4\n", 60 | "(2, 3, 4)\n", 61 | "(3, 4, 5)\n" 62 | ] 63 | } 64 | ], 65 | "source": [ 66 | "# Indexing and Slicing from the tuple\n", 67 | "\n", 68 | "print(t[2])\n", 69 | "print(t[-3])\n", 70 | "print(t[1:4])\n", 71 | "print(t[-4:-1])" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 11, 77 | "metadata": {}, 78 | "outputs": [ 79 | { 80 | "name": "stdout", 81 | "output_type": "stream", 82 | "text": [ 83 | "0\n", 84 | "4\n" 85 | ] 86 | }, 87 | { 88 | "ename": "ValueError", 89 | "evalue": "tuple.index(x): x not in tuple", 90 | "output_type": "error", 91 | "traceback": [ 92 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 93 | "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", 94 | "Cell \u001b[1;32mIn[11], line 6\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[39mprint\u001b[39m(p\u001b[39m.\u001b[39mcount(\u001b[39m7\u001b[39m))\n\u001b[0;32m 5\u001b[0m \u001b[39mprint\u001b[39m(p\u001b[39m.\u001b[39mindex(\u001b[39m2\u001b[39m,\u001b[39m2\u001b[39m,\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m))\n\u001b[1;32m----> 6\u001b[0m \u001b[39mprint\u001b[39m(p\u001b[39m.\u001b[39;49mindex(\u001b[39m7\u001b[39;49m))\n", 95 | "\u001b[1;31mValueError\u001b[0m: tuple.index(x): x not in tuple" 96 | ] 97 | } 98 | ], 99 | "source": [ 100 | "# Count and Index\n", 101 | "\n", 102 | "p = (1,2,3,4,2,3,4,5,2,3,4,2,3,1,3,2)\n", 103 | "print(p.count(7))\n", 104 | "print(p.index(2,2,-1))\n", 105 | "print(p.index(7))" 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "metadata": {}, 112 | "outputs": [], 113 | "source": [] 114 | } 115 | ], 116 | "metadata": { 117 | "kernelspec": { 118 | "display_name": "Python 3", 119 | "language": "python", 120 | "name": "python3" 121 | }, 122 | "language_info": { 123 | "codemirror_mode": { 124 | "name": "ipython", 125 | "version": 3 126 | }, 127 | "file_extension": ".py", 128 | "mimetype": "text/x-python", 129 | "name": "python", 130 | "nbconvert_exporter": "python", 131 | "pygments_lexer": "ipython3", 132 | "version": "3.11.3" 133 | }, 134 | "orig_nbformat": 4 135 | }, 136 | "nbformat": 4, 137 | "nbformat_minor": 2 138 | } 139 | -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/file.txt: -------------------------------------------------------------------------------- 1 | Writing new text to the file.. 2 | With the help of the with keyword.. 3 | Then closing the file.. 4 | Appending new data to the file.. 5 | Without overwriting the file.. 6 | -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/geek.txt: -------------------------------------------------------------------------------- 1 | Appending new data to the file.. 2 | Without overwriting the file.. 3 | -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/new_file.txt: -------------------------------------------------------------------------------- 1 | This is another file... 2 | For demonstrating remove operation.. -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/other_file.txt: -------------------------------------------------------------------------------- 1 | Hii, 2 | Hello 3 | How are you doing 4 | -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/others/geek.txt: -------------------------------------------------------------------------------- 1 | Writing new text to the file.. 2 | With the help of the with keyword.. 3 | Then closing the file.. -------------------------------------------------------------------------------- /04. Day 4 - File Handling and Exception Handling/write.txt: -------------------------------------------------------------------------------- 1 | This is write command 2 | Write in a the file 3 | Appending to the file.. 4 | Without overwriting.. 5 | -------------------------------------------------------------------------------- /05. Day 5 - Python Classes and Objects/Python Classes Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/05. Day 5 - Python Classes and Objects/Python Classes Handwritten Notes.pdf -------------------------------------------------------------------------------- /06. Day 6 - OOPs Concepts Implementation in Python/OOPs Implementation in Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/06. Day 6 - OOPs Concepts Implementation in Python/OOPs Implementation in Python.pdf -------------------------------------------------------------------------------- /07. Day 7 - Advanced Topics/RegEx Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/07. Day 7 - Advanced Topics/RegEx Handwritten Notes.pdf -------------------------------------------------------------------------------- /07. Day 7 - Advanced Topics/high_functions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "> **1. Lambda Function**" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 4, 14 | "metadata": {}, 15 | "outputs": [ 16 | { 17 | "name": "stdout", 18 | "output_type": "stream", 19 | "text": [ 20 | "30\n", 21 | "16\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "ad = lambda a:a+10\n", 27 | "print(ad(20))\n", 28 | "\n", 29 | "sqr = lambda x:x**2\n", 30 | "print(sqr(4))" 31 | ] 32 | }, 33 | { 34 | "attachments": {}, 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "> **2. map**" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 7, 44 | "metadata": {}, 45 | "outputs": [ 46 | { 47 | "name": "stdout", 48 | "output_type": "stream", 49 | "text": [ 50 | "[1, 4, 9, 16, 25]\n", 51 | "[21, 22, 23, 24, 25]\n" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "# map(func, iterable)\n", 57 | "\n", 58 | "lst = [1,2,3,4,5]\n", 59 | "\n", 60 | "sqrs = list(map(sqr, lst))\n", 61 | "print(sqrs)\n", 62 | "\n", 63 | "ads = list(map(lambda a:a+20, lst))\n", 64 | "print(ads)" 65 | ] 66 | }, 67 | { 68 | "attachments": {}, 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "> **3. filter**" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 10, 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "name": "stdout", 82 | "output_type": "stream", 83 | "text": [ 84 | "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n", 85 | "[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n" 86 | ] 87 | } 88 | ], 89 | "source": [ 90 | "# filter(condition, iterable)\n", 91 | "\n", 92 | "even = list(filter(lambda x:x%2==0, range(1,21)))\n", 93 | "print(even)\n", 94 | "\n", 95 | "odd = list(filter(lambda x:x%2==1, range(1,21)))\n", 96 | "print(odd)" 97 | ] 98 | }, 99 | { 100 | "attachments": {}, 101 | "cell_type": "markdown", 102 | "metadata": {}, 103 | "source": [ 104 | "> **4. reduce**" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 12, 110 | "metadata": {}, 111 | "outputs": [ 112 | { 113 | "name": "stdout", 114 | "output_type": "stream", 115 | "text": [ 116 | "210\n" 117 | ] 118 | } 119 | ], 120 | "source": [ 121 | "from functools import reduce\n", 122 | "\n", 123 | "\n", 124 | "a = reduce(lambda a,b:a+b,range(1,21))\n", 125 | "print(a)" 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": null, 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [] 134 | } 135 | ], 136 | "metadata": { 137 | "kernelspec": { 138 | "display_name": "Python 3", 139 | "language": "python", 140 | "name": "python3" 141 | }, 142 | "language_info": { 143 | "codemirror_mode": { 144 | "name": "ipython", 145 | "version": 3 146 | }, 147 | "file_extension": ".py", 148 | "mimetype": "text/x-python", 149 | "name": "python", 150 | "nbconvert_exporter": "python", 151 | "pygments_lexer": "ipython3", 152 | "version": "3.11.3" 153 | }, 154 | "orig_nbformat": 4 155 | }, 156 | "nbformat": 4, 157 | "nbformat_minor": 2 158 | } 159 | -------------------------------------------------------------------------------- /07. Day 7 - Advanced Topics/list_compre.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n" 13 | ] 14 | } 15 | ], 16 | "source": [ 17 | "# 1. Even list using list comprehension\n", 18 | "\n", 19 | "even = [i for i in range(1,21) if i%2==0]\n", 20 | "print(even)" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n" 33 | ] 34 | } 35 | ], 36 | "source": [ 37 | "# 2. Odd list using list comprehension\n", 38 | "\n", 39 | "odd = [i for i in range(1,21) if i%2!=0]\n", 40 | "print(odd)" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 4, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "name": "stdout", 50 | "output_type": "stream", 51 | "text": [ 52 | "[[0, 1, 2], [0, 1, 2], [0, 1, 2]]\n" 53 | ] 54 | } 55 | ], 56 | "source": [ 57 | "# 3. Matrix generation using list comprehension\n", 58 | "\n", 59 | "mat = [[j for j in range(3)] for i in range(3)]\n", 60 | "print(mat)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 9, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "name": "stdout", 70 | "output_type": "stream", 71 | "text": [ 72 | "['S', 'n', 'e', 'h', 'a', 'l', ' ', 'M', 'a', 'n', 'k', 'a', 'r']\n" 73 | ] 74 | } 75 | ], 76 | "source": [ 77 | "# 4. List comprehenstion to iterate through the string\n", 78 | "\n", 79 | "letters = [a for a in 'Snehal Mankar']\n", 80 | "print(letters)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [] 89 | } 90 | ], 91 | "metadata": { 92 | "kernelspec": { 93 | "display_name": "Python 3", 94 | "language": "python", 95 | "name": "python3" 96 | }, 97 | "language_info": { 98 | "codemirror_mode": { 99 | "name": "ipython", 100 | "version": 3 101 | }, 102 | "file_extension": ".py", 103 | "mimetype": "text/x-python", 104 | "name": "python", 105 | "nbconvert_exporter": "python", 106 | "pygments_lexer": "ipython3", 107 | "version": "3.11.3" 108 | }, 109 | "orig_nbformat": 4 110 | }, 111 | "nbformat": 4, 112 | "nbformat_minor": 2 113 | } 114 | -------------------------------------------------------------------------------- /08. Day 8 - Python MySQL/Python MySQL Database Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/08. Day 8 - Python MySQL/Python MySQL Database Notes.pdf -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/Account.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Account: 4 | count = 0 5 | def __init__(self, acct_ID: int=None, balance: float=None, acct_type: str=None, cust_ID: int=None) -> None: 6 | self.acct_ID = acct_ID 7 | self.balance = balance 8 | self.acct_type = acct_type 9 | self.cust_ID = cust_ID 10 | 11 | insert_sql = 'INSERT INTO account(acct_ID,balance,acct_type,cust_ID) \ 12 | VALUES(%s,%s,%s,%s)' 13 | # val = (acct_ID, balance, acct_type, cust_ID) 14 | val = (1,50000,'Savings',1) 15 | 16 | my_cursor.execute(insert_sql, val) 17 | conn.commit() 18 | print(my_cursor.rowcount, ' Account created..') 19 | 20 | 21 | def __get_all_accounts(self) -> list: 22 | sql = 'SELECT * FROM account' 23 | my_cursor.execute(sql) 24 | Account.count = my_cursor.rowcount 25 | 26 | result = list(my_cursor.fetchall()) 27 | return result 28 | 29 | 30 | @classmethod 31 | def _get_accounts_count() -> int: 32 | sql = 'SELECT COUNT(*) FROM account' 33 | my_cursor.execute(sql) 34 | result = my_cursor.fetchall() 35 | Account.count = result 36 | return result 37 | 38 | 39 | @classmethod 40 | def get_all_accounts_by_cust_ID(c_ID: int) -> Account: 41 | sql = f'SELECT * FROM account WHERE cust_ID = {c_ID}' 42 | my_cursor.execute(sql) 43 | Account.count = my_cursor.rowcount 44 | 45 | result = list(my_cursor.fetchall()) 46 | return result 47 | 48 | 49 | @classmethod 50 | def get_all_accounts_count_by_cust_ID(c_ID: int) -> int: 51 | sql = f'SELECT COUNT(*) FROM account WHERE cust_ID = {c_ID}' 52 | my_cursor.execute(sql) 53 | 54 | result = int(my_cursor) 55 | return result 56 | -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/Customer.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Customer: 4 | count = 1 5 | def __init__(self, cust_ID: int, f_name: str, m_name: str, l_name: str, username: str, password: str, address: str, birth_date: str, phone: int, email: str, age: int) -> None: 6 | self.cust_ID = cust_ID 7 | self.f_name = f_name 8 | self.m_name = m_name 9 | self.l_name = l_name 10 | self.username = username 11 | self.__password = password 12 | self.address = address 13 | self.birth_date = birth_date 14 | self.phone = phone 15 | self.email = email 16 | self.age = age 17 | 18 | 19 | 20 | def insert_cust(self) -> str: 21 | insert_sql = 'INSERT INTO customer(cust_ID, f_name, m_name, l_name, username, password, \ 22 | address, birth_date, phone, email, age) \ 23 | VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)' 24 | 25 | val = (Customer.count, self.f_name, self.m_name, self.l_name, 26 | self.username, self.password, self.address, self.birth_date, 27 | self.phone, self.email, self.age) 28 | 29 | my_cursor.execute(insert_sql, val) 30 | conn.commit() 31 | return my_cursor.rowcount+' Customer created..' 32 | 33 | 34 | def update_password(self, password: str) -> None: 35 | self.__password = password 36 | update_sql = 'UPDATE customer SET password = %s, where cust_ID = %s' 37 | val = (password, self.cust_ID) 38 | my_cursor.execute(update_sql, val) 39 | 40 | 41 | def __str__(self) -> str: 42 | return f''' 43 | 44 | ''' 45 | 46 | 47 | @classmethod 48 | def _get_cust_count() -> int: 49 | sql = 'SELECT COUNT(*) FROM customer' 50 | my_cursor.execute(sql) 51 | result = my_cursor.fetchall() 52 | Customer.count = result 53 | return result 54 | 55 | 56 | def __get_all_cust(self) -> list : 57 | sql = 'SELECT * FROM customer' 58 | my_cursor.execute(sql) 59 | Customer.count = my_cursor.rowcount 60 | 61 | result = list(my_cursor.fetchall()) 62 | return result 63 | 64 | 65 | @classmethod 66 | def get_cust_by_id(id: int) -> Customer: 67 | sql = f'SELECT * FROM customer WHERE id = {id}' 68 | my_cursor.execute(sql) 69 | result = my_cursor.fetchone() 70 | return result 71 | 72 | 73 | @classmethod 74 | def get_cust_by_username(u_name: str) -> Customer: 75 | sql = f'SELECT * FROM customer WHERE username = {u_name}' 76 | my_cursor.execute(sql) 77 | result = my_cursor.fetchone() 78 | return result 79 | 80 | 81 | -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/Transaction.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Transaction: 4 | def __init__(self, trans_ID: int=None, acct_ID: int=None, transac_type: str=None, ammount: float=None, transac_date: str=None) -> None: 5 | self.trans_ID = trans_ID 6 | self.acct_ID = acct_ID 7 | self.transac_type = transac_type 8 | self.ammount = ammount 9 | self.transac_date = transac_date 10 | 11 | 12 | def insert_transaction(self) -> str: 13 | insert_sql = 'INSERT INTO transaction(trans_ID, acct_ID, transac_type, ammount, transac_date) \ 14 | VALUES(%s,%s,%s,%s,%s)' 15 | val = (self.trans_ID, self.acct_ID, self.transac_type, self.ammount, 16 | self.transac_date) 17 | # val = (1,1,'Deposit',3000,'2023-07-25') 18 | 19 | my_cursor.execute(insert_sql, val) 20 | conn.commit() 21 | return my_cursor.rowcount+' Transaction created..' 22 | 23 | 24 | def __get_all_transactions(self) -> list: 25 | sql = 'SELECT * FROM transaction' 26 | my_cursor.execute(sql) 27 | Account.count = my_cursor.rowcount 28 | 29 | result = list(my_cursor.fetchall()) 30 | return result 31 | 32 | 33 | @classmethod 34 | def get_all_accounts_by_cust_ID(c_ID: int) -> Account: 35 | sql = f'SELECT * FROM transaction WHERE cust_ID = {c_ID}' 36 | my_cursor.execute(sql) 37 | Account.count = my_cursor.rowcount 38 | 39 | result = list(my_cursor.fetchall()) 40 | return result 41 | -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Account.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Account.cpython-311.pyc -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Customer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Customer.cpython-311.pyc -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Transaction.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/Transaction.cpython-311.pyc -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/db_conn.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/09. Day 9 - Day 1 of Project/bank_mangment/__pycache__/db_conn.cpython-311.pyc -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/bank.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | from Customer import Customer 3 | from Transaction import Transaction 4 | 5 | 6 | if __name__ == '__main__': 7 | 8 | # print('Create customer..') 9 | # full = input('Enter full name:') 10 | # f_name, m_name, l_name = full.split(' ') 11 | # username = input('Enter ussername for you: ') 12 | # password = input('Enter password: ') 13 | # address = input('Enter your address: ') 14 | # birth_date = input('Enter your birth date: ') 15 | # phone = input('Enter your phone number: ') 16 | # email = input('Enter your email: ') 17 | # age = int(input('Enter your age: ')) 18 | 19 | # cust = Customer(0, f_name, m_name, l_name, username, password, address, 20 | # birth_date, phone, email, age) 21 | 22 | # acct = Account() 23 | tran = Transaction() -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/bank_db.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | 4 | 5 | cust_sql = 'CREATE TABLE customer(cust_ID INT PRIMARY KEY AUTO_INCREMENT, f_name VARCHAR(20), \ 6 | m_name VARCHAR(20), l_name VARCHAR(20), username VARCHAR(20), password VARCHAR(50), \ 7 | address VARCHAR(45), birth_date DATE, phone DECIMAL(10,0), email VARCHAR(45), age INT)' 8 | my_cursor.execute(cust_sql) 9 | 10 | acct_sql = 'CREATE TABLE account(acct_ID INT PRIMARY KEY AUTO_INCREMENT, balance FLOAT, \ 11 | acct_type VARCHAR(20), cust_ID INT, \ 12 | CONSTRAINT FK_cust_ID FOREIGN KEY (cust_ID) REFERENCES customer(cust_ID))' 13 | my_cursor.execute(acct_sql) 14 | 15 | tran_sql = 'CREATE TABLE transaction(trans_ID INT PRIMARY KEY AUTO_INCREMENT, \ 16 | acct_ID INT, transac_date DATE, ammount FLOAT, transac_type VARCHAR(20), \ 17 | CONSTRAINT FK_acct_ID FOREIGN KEY (acct_ID) REFERENCES account(acct_ID))' 18 | my_cursor.execute(tran_sql) 19 | 20 | -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/db_ER_diagram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/09. Day 9 - Day 1 of Project/bank_mangment/db_ER_diagram.pdf -------------------------------------------------------------------------------- /09. Day 9 - Day 1 of Project/bank_mangment/db_conn.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | 3 | conn = mysql.connector.connect( 4 | host = 'localhost', 5 | user = 'root', 6 | password = 'snehal21', 7 | database = 'bank_management' 8 | ) 9 | 10 | my_cursor = conn.cursor() -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/Account.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Account: 4 | count = 0 5 | def __init__(self, acct_ID: int=None, balance: float=None, acct_type: str=None, cust_ID: int=None) -> None: 6 | self.acct_ID = acct_ID 7 | self.balance = balance 8 | self.acct_type = acct_type 9 | self.cust_ID = cust_ID 10 | 11 | insert_sql = 'INSERT INTO account(acct_ID,balance,acct_type,cust_ID) \ 12 | VALUES(%s,%s,%s,%s)' 13 | val = (acct_ID, balance, acct_type, cust_ID) 14 | # val = (1,50000,'Savings',1) 15 | 16 | my_cursor.execute(insert_sql, val) 17 | conn.commit() 18 | print(my_cursor.rowcount, ' Account created..') 19 | 20 | 21 | def __get_all_accounts(self) -> list: 22 | sql = 'SELECT * FROM account' 23 | my_cursor.execute(sql) 24 | Account.count = my_cursor.rowcount 25 | 26 | result = list(my_cursor.fetchall()) 27 | return result 28 | 29 | 30 | @classmethod 31 | def _get_accounts_count() -> int: 32 | sql = 'SELECT COUNT(*) FROM account' 33 | my_cursor.execute(sql) 34 | result = my_cursor.fetchall() 35 | Account.count = result 36 | return result 37 | 38 | 39 | @staticmethod 40 | def get_all_accounts_by_cust_ID(c_ID: int): 41 | sql = f'SELECT * FROM account WHERE cust_ID = {c_ID}' 42 | my_cursor.execute(sql) 43 | Account.count = my_cursor.rowcount 44 | 45 | result = list(my_cursor.fetchall()) 46 | return result 47 | 48 | 49 | @classmethod 50 | def get_all_accounts_count_by_cust_ID(c_ID: int) -> int: 51 | sql = f'SELECT COUNT(*) FROM account WHERE cust_ID = {c_ID}' 52 | my_cursor.execute(sql) 53 | 54 | result = int(my_cursor) 55 | return result 56 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/Account_menu.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def acct_menu(): 4 | while True: 5 | print('1. Deposit') 6 | print('2. Withdraw') 7 | print('3. Exit') 8 | ch = int(input('Enter your choice: ')) 9 | match ch: 10 | case 1: 11 | amount = float(input('Enter amount to deposit: ')) 12 | case 2: 13 | amount = float(input('Enter amount to withdraw: ')) 14 | case 3: 15 | return 16 | case _: 17 | print('Choose correct option...') 18 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/Customer.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Customer: 4 | count = 1 5 | def __init__(self, cust_ID: int, f_name: str, m_name: str, l_name: str, username: str, password: str, address: str, birth_date: str, phone: int, email: str, age: int) -> None: 6 | self.cust_ID = cust_ID 7 | self.f_name = f_name 8 | self.m_name = m_name 9 | self.l_name = l_name 10 | self.username = username 11 | self.__password = password 12 | self.address = address 13 | self.birth_date = birth_date 14 | self.phone = phone 15 | self.email = email 16 | self.age = age 17 | 18 | 19 | 20 | def insert_cust(self) -> str: 21 | insert_sql = 'INSERT INTO customer(cust_ID, f_name, m_name, l_name, username, password, \ 22 | address, birth_date, phone, email, age) \ 23 | VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)' 24 | 25 | val = (Customer.count, self.f_name, self.m_name, self.l_name, 26 | self.username, self.password, self.address, self.birth_date, 27 | self.phone, self.email, self.age) 28 | 29 | my_cursor.execute(insert_sql, val) 30 | conn.commit() 31 | return my_cursor.rowcount+' Customer created..' 32 | 33 | 34 | def update_password(self, password: str) -> None: 35 | self.__password = password 36 | update_sql = 'UPDATE customer SET password = %s, where cust_ID = %s' 37 | val = (password, self.cust_ID) 38 | my_cursor.execute(update_sql, val) 39 | 40 | 41 | def __str__(self) -> str: 42 | return f''' 43 | 44 | ''' 45 | 46 | 47 | @classmethod 48 | def _get_cust_count() -> int: 49 | sql = 'SELECT COUNT(*) FROM customer' 50 | my_cursor.execute(sql) 51 | result = my_cursor.fetchall() 52 | Customer.count = result 53 | return result 54 | 55 | 56 | def __get_all_cust(self) -> list : 57 | sql = 'SELECT * FROM customer' 58 | my_cursor.execute(sql) 59 | Customer.count = my_cursor.rowcount 60 | 61 | result = list(my_cursor.fetchall()) 62 | return result 63 | 64 | 65 | @classmethod 66 | def get_cust_by_id(id: int): 67 | sql = f'SELECT * FROM customer WHERE id = {id}' 68 | my_cursor.execute(sql) 69 | result = my_cursor.fetchone() 70 | return result 71 | 72 | 73 | @staticmethod 74 | def get_cust_by_username(u_name: str): 75 | sql = f'SELECT * FROM customer WHERE username = "{u_name}"' 76 | my_cursor.execute(sql) 77 | result = my_cursor.fetchone() 78 | return result 79 | 80 | 81 | if __name__ == '__main__': 82 | print(Customer.get_cust_by_username('snehalmankar')) 83 | print(type(Customer.get_cust_by_username('snehalmankar'))) 84 | 85 | print(Customer.get_cust_by_username('snehal')) 86 | print(type(Customer.get_cust_by_username('snehal'))) 87 | 88 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/New_Menu.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | from create_account import create_acct 3 | 4 | 5 | def display_menu(user_dict): 6 | print(f'|************* Welcome to the Bank, { user_dict["f_name"] } ***************|') 7 | print('1. Create new Account') 8 | print('2. Choose Existing Account') 9 | print('3. List all the Existing Account') 10 | print('4. Logout from the Bank System') 11 | while True: 12 | ch = int(input('\nEnter your choice: ')) 13 | 14 | match ch: 15 | case 1: 16 | print('Create new Account...') 17 | create_acct(user_dict) 18 | break 19 | case 2: 20 | a_ID = int(input('Enter your Account ID: ')) 21 | print('Perform following Account Operations..') 22 | 23 | 24 | case 3: 25 | print('Your all Accounts are: ') 26 | acct_list = Account.get_all_accounts_by_cust_ID(user_dict['cust_ID']) 27 | for acct in acct_list: 28 | print(acct) 29 | case 4: 30 | print('Logout Successful..') 31 | case _: 32 | print('Choose correct option...') 33 | 34 | print('End...') -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/README.md: -------------------------------------------------------------------------------- 1 | Day 2 Implemetation of the Project 2 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/Transaction.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Transaction: 4 | count = 0 5 | def __init__(self, trans_ID: int=None, acct_ID: int=None, transac_type: str=None, ammount: float=None, transac_date: str=None) -> None: 6 | self.trans_ID = trans_ID 7 | self.acct_ID = acct_ID 8 | self.transac_type = transac_type 9 | self.ammount = ammount 10 | self.transac_date = transac_date 11 | 12 | 13 | def insert_transaction(self) -> str: 14 | insert_sql = 'INSERT INTO transaction(trans_ID, acct_ID, transac_type, ammount, transac_date) \ 15 | VALUES(%s,%s,%s,%s,%s)' 16 | val = (self.trans_ID, self.acct_ID, self.transac_type, self.ammount, 17 | self.transac_date) 18 | # val = (1,1,'Deposit',3000,'2023-07-25') 19 | 20 | my_cursor.execute(insert_sql, val) 21 | conn.commit() 22 | return my_cursor.rowcount+' Transaction created..' 23 | 24 | 25 | def __get_all_transactions(self) -> list: 26 | sql = 'SELECT * FROM transaction' 27 | my_cursor.execute(sql) 28 | Transaction.count = my_cursor.rowcount 29 | 30 | result = list(my_cursor.fetchall()) 31 | return result 32 | 33 | 34 | @classmethod 35 | def get_all_transactions_by_acct_ID(a_ID: int) -> list: 36 | sql = f'SELECT * FROM transaction WHERE acct_ID = {a_ID}' 37 | my_cursor.execute(sql) 38 | 39 | result = list(my_cursor.fetchall()) 40 | return result 41 | 42 | @classmethod 43 | def get_all_transactions_count_by_acct_ID(a_ID: int) -> int: 44 | sql = f'SELECT * FROM transaction WHERE acct_ID = {a_ID}' 45 | my_cursor.execute(sql) 46 | Transaction.count = my_cursor.rowcount 47 | 48 | result = list(my_cursor.fetchall()) 49 | return result 50 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/Account.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/Account.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/Customer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/Customer.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/New_Menu.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/New_Menu.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/Transaction.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/Transaction.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/create_account.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/create_account.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/create_customer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/create_customer.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/cust_login.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/cust_login.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/__pycache__/db_conn.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/10. Day 10 - Day 2 of Project/__pycache__/db_conn.cpython-311.pyc -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/a.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from decimal import Decimal 3 | import re 4 | 5 | from Customer import Customer 6 | from New_Menu import display_menu 7 | from create_account import create_acct 8 | from cust_login import login 9 | 10 | # user_dict = login() 11 | # print(user_dict) 12 | 13 | user_dict = {'cust_ID': 1, 'f_name': 'snehal', 'm_name': 'sanjay', 'l_name': 'mankar', 14 | 'username': 'snehalmankar', 'password': 'snehal21', 'address': 'kop', 15 | 'birth_date': 'datetime.date(2001, 8, 21)', 'phone': '9730990136', 16 | 'email': 'snehal@gmail.com', 'age': 22} 17 | 18 | display_menu(user_dict) 19 | 20 | # create_acct(user_dict) 21 | 22 | 23 | 24 | print('End.....') 25 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/bank.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | from Customer import Customer 3 | from New_Menu import display_menu 4 | from Transaction import Transaction 5 | import re 6 | 7 | from create_customer import create_cust 8 | from cust_login import login 9 | 10 | 11 | 12 | if __name__ == '__main__': 13 | 14 | 15 | while True: 16 | print('|************** Welcome to Py_Bank ***********|') 17 | print('1. Login') 18 | print('2. Create Customer') 19 | ch = int(input('Enter your choice: ')) 20 | print() 21 | match ch: 22 | case 1: 23 | print('Enter your credentials..') 24 | user_dict = login() 25 | # print(user_dict) 26 | display_menu(user_dict) 27 | 28 | 29 | 30 | case 2: 31 | print('Create customer..') 32 | 33 | user_dict = create_cust() 34 | 35 | # cust = Customer(0, user_dict['f_name'], user_dict['m_name'], user_dict['l_name'], 36 | # user_dict['username'], user_dict['password'], user_dict['address'], 37 | # user_dict['birth_date'], user_dict['phone'], user_dict['email'], 38 | # user_dict['age']) 39 | 40 | 41 | case _: 42 | print('Please choose correct choice again...\n') 43 | 44 | # acct = Account() 45 | # tran = Transaction() 46 | 47 | 48 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/bank_db.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | 4 | 5 | cust_sql = 'CREATE TABLE customer(cust_ID INT PRIMARY KEY AUTO_INCREMENT, f_name VARCHAR(20), \ 6 | m_name VARCHAR(20), l_name VARCHAR(20), username VARCHAR(20), password VARCHAR(50), \ 7 | address VARCHAR(45), birth_date DATE, phone DECIMAL(10,0), email VARCHAR(45), age INT)' 8 | my_cursor.execute(cust_sql) 9 | 10 | acct_sql = 'CREATE TABLE account(acct_ID INT PRIMARY KEY AUTO_INCREMENT, balance FLOAT, \ 11 | acct_type VARCHAR(20), cust_ID INT, \ 12 | CONSTRAINT FK_cust_ID FOREIGN KEY (cust_ID) REFERENCES customer(cust_ID))' 13 | my_cursor.execute(acct_sql) 14 | 15 | tran_sql = 'CREATE TABLE transaction(trans_ID INT PRIMARY KEY AUTO_INCREMENT, \ 16 | acct_ID INT, transac_date DATE, ammount FLOAT, transac_type VARCHAR(20), \ 17 | CONSTRAINT FK_acct_ID FOREIGN KEY (acct_ID) REFERENCES account(acct_ID))' 18 | my_cursor.execute(tran_sql) 19 | 20 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/create_account.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | 3 | 4 | def create_acct(user_dict): 5 | while True: 6 | print('1. Current Account.') 7 | print('2. Savings Account.') 8 | print('3. Fixed Account.') 9 | ch = int(input('Enter your choice: ')) 10 | 11 | match ch: 12 | case 1: 13 | type = 'Current' 14 | case 2: 15 | type = 'Savings' 16 | case 3: 17 | type = 'Fixed' 18 | case _: 19 | print('Choose correct option from the menu...') 20 | 21 | amount = float(input('Enter amount you want to deposit: ')) 22 | 23 | acct = Account(0, amount, type, user_dict['cust_ID']) 24 | break 25 | 26 | print('End..') -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/create_customer.py: -------------------------------------------------------------------------------- 1 | import re 2 | from Customer import Customer 3 | 4 | def username_input() -> str: 5 | while True: 6 | username = input('\nEnter username for you: ') 7 | user = Customer.get_cust_by_username(username) 8 | if type(user) == tuple: 9 | print('Username already exist..\nChoose another name for you..') 10 | else: 11 | break 12 | return username 13 | 14 | 15 | def password_input() -> str: 16 | while True: 17 | print('Password should contain: \n1. Atleast 6 alphabetic character\ 18 | \n2. Atleast 2 numeric Characters \ 19 | \n3. Atleast 1 Capital alphabetic character \ 20 | \n3. No Space Character') 21 | password = input('Enter password: ') 22 | char_count = re.findall('[A-Za-z]', password) 23 | int_count = re.findall('[\d]', password) 24 | sp_count = re.findall('[\s]', password) 25 | cap_count = re.findall('[A-Z]', password) 26 | print(int_count,sp_count, cap_count) 27 | 28 | if (len(char_count)>=6 and len(int_count)>=2 and len(cap_count)>=1 29 | and len(sp_count)==0): 30 | print('Strong Password...') 31 | break 32 | else: 33 | print('Invalid Password..') 34 | 35 | return password 36 | 37 | 38 | def birth_input() -> str: 39 | while True: 40 | email_pattern = re.compile('[\d]{4}-[\d]{2}-[\d]{2}') 41 | birth_date = input('Enter your birth date(YYYY-MM-DD): ') 42 | flag = email_pattern.search(birth_date) 43 | if flag: 44 | break 45 | else: 46 | print('Date not valid..') 47 | return birth_date 48 | 49 | 50 | def phone_input() -> str: 51 | while True: 52 | phone = input('Enter your phone number(10 digit): ') 53 | pattern = re.compile('[\d]{10}') 54 | if pattern.search(phone): 55 | break 56 | else: 57 | print('Not Valid...') 58 | return phone 59 | 60 | 61 | def email_input() -> str: 62 | while True: 63 | email_pattern = re.compile('[\w]+@[\w].[\w]+') 64 | email = input('Enter your email: ') 65 | flag = email_pattern.search(email) 66 | # print(flag) 67 | if flag: 68 | # print('Email valid..') 69 | break 70 | else: 71 | print('Email not valid..') 72 | 73 | 74 | def age_input() -> int: 75 | while True: 76 | try: 77 | age = int(input('Enter your age: ')) 78 | break 79 | except: 80 | print('\nEnter age in integer: ') 81 | return age 82 | 83 | 84 | 85 | 86 | 87 | 88 | def create_cust() -> dict: 89 | key_list = ['f_name', 'm_name', 'l_name', 'username', 'password', 'address', 90 | 'birth_date', 'phone', 'email', 'age'] 91 | user_dict = dict.fromkeys(key_list) 92 | 93 | # Full name Input 94 | full = input('Enter full name(first middle last):') 95 | user_dict['f_name'], user_dict['m_name'], user_dict['l_name'] = full.split(' ') 96 | 97 | # username Input 98 | user_dict['username'] = username_input() 99 | 100 | # Password Input 101 | user_dict['password'] = password_input() 102 | 103 | # Address Input 104 | user_dict['address'] = input('Enter your address: ') 105 | 106 | # Birth Date Input 107 | user_dict['birth_date'] = birth_input() 108 | 109 | # Phone Number Input 110 | user_dict['phone'] = phone_input() 111 | 112 | # Email Input 113 | user_dict['email'] = email_input() 114 | 115 | # Age Input 116 | user_dict['age'] = age_input() 117 | 118 | 119 | 120 | return user_dict -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/cust_login.py: -------------------------------------------------------------------------------- 1 | from Customer import Customer 2 | 3 | 4 | def login(): 5 | while True: 6 | username = input('Enter username: ') 7 | user = Customer.get_cust_by_username(username) 8 | print(user) 9 | if type(user) == tuple: 10 | password = input('Enter password: ') 11 | print(user[5], password) 12 | if user[5] == password: 13 | print('Login Successful...') 14 | break 15 | else: 16 | print('Password Incorrect...') 17 | else: 18 | print('Username Invalid...') 19 | 20 | key_list = ['cust_ID', 'f_name', 'm_name', 'l_name', 'username', 'password', 21 | 'address', 'birth_date', 'phone', 'email', 'age'] 22 | user_dict = dict(zip(key_list, user)) 23 | return user_dict 24 | -------------------------------------------------------------------------------- /10. Day 10 - Day 2 of Project/db_conn.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | 3 | conn = mysql.connector.connect( 4 | host = 'localhost', 5 | user = 'root', 6 | password = 'snehal21', 7 | database = 'bank_management' 8 | ) 9 | 10 | my_cursor = conn.cursor() -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Account.py: -------------------------------------------------------------------------------- 1 | from Errors import LowBalanceError 2 | from Transaction import Transaction 3 | from db_conn import my_cursor, conn 4 | 5 | class Account: 6 | count = 0 7 | def __init__(self, acct_ID: int=None, balance: float=None, acct_type: str=None, cust_ID: int=None) -> None: 8 | self.acct_ID = acct_ID 9 | self.balance = balance 10 | self.acct_type = acct_type 11 | self.cust_ID = cust_ID 12 | 13 | self.insert_account() 14 | 15 | def insert_account(self) -> None: 16 | insert_sql = 'INSERT INTO account(acct_ID,balance,acct_type,cust_ID) \ 17 | VALUES(%s,%s,%s,%s)' 18 | val = (self.acct_ID, self.balance, self.acct_type, self.cust_ID) 19 | 20 | my_cursor.execute(insert_sql, val) 21 | conn.commit() 22 | 23 | 24 | def __get_all_accounts(self) -> list: 25 | sql = 'SELECT * FROM account' 26 | my_cursor.execute(sql) 27 | Account.count = my_cursor.rowcount 28 | 29 | result = list(my_cursor.fetchall()) 30 | return result 31 | 32 | 33 | @classmethod 34 | def _get_accounts_count() -> int: 35 | sql = 'SELECT COUNT(*) FROM account' 36 | my_cursor.execute(sql) 37 | result = my_cursor.fetchall() 38 | Account.count = result 39 | return result 40 | 41 | 42 | @staticmethod 43 | def get_all_accounts_by_cust_ID(c_ID: int): 44 | sql = f'SELECT * FROM account WHERE cust_ID = {c_ID}' 45 | my_cursor.execute(sql) 46 | Account.count = my_cursor.rowcount 47 | 48 | result = list(my_cursor.fetchall()) 49 | return result 50 | 51 | 52 | @staticmethod 53 | def get_account_balance_by_acct_ID(a_ID: int) -> float: 54 | sql = f'SELECT balance FROM account WHERE acct_ID = {a_ID}' 55 | my_cursor.execute(sql) 56 | bal = my_cursor.fetchone()[0] 57 | return bal 58 | 59 | 60 | @staticmethod 61 | def update_balace(acct_ID: int, new_balance: float) -> str: 62 | 63 | sql = f'UPDATE account SET balance = {new_balance} \ 64 | WHERE acct_ID = {acct_ID}' 65 | 66 | my_cursor.execute(sql) 67 | conn.commit() 68 | 69 | 70 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Account_menu.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from Account import Account 3 | from Errors import LowBalanceError 4 | from Transaction import Transaction 5 | from Transfer import Transfer 6 | 7 | 8 | 9 | def deposit_amt(id,today): 10 | amount = float(input('Enter amount to deposit: ')) 11 | type = 'Deposit' 12 | existing_bal = Account.get_account_balance_by_acct_ID(id) 13 | new_balance = existing_bal + amount 14 | Account.update_balace(id, new_balance) 15 | 16 | trans = Transaction(0,id,type,amount,today) 17 | print(amount,'Deposited Successfully..\n') 18 | 19 | 20 | def withdraw_amt(id, today): 21 | amount = float(input('Enter amount to withdraw: ')) 22 | type = 'Withdraw' 23 | existing_bal = Account.get_account_balance_by_acct_ID(id) 24 | 25 | try: 26 | if existing_bal=amount: 29 | new_balance = existing_bal - amount 30 | Account.update_balace(id, new_balance) 31 | except LowBalanceError: 32 | print('Cannot perform withdraw operation..') 33 | print('Check Account balance first..') 34 | return 35 | 36 | trans = Transaction(0,id,type,amount,today) 37 | print(amount,'Withdrawal Successful..\n') 38 | 39 | 40 | def tranfer_amt(f_ID, today): 41 | t_ID = int(input('Enter account id: ')) 42 | amount = float(input('Enter amount to tranfer: ')) 43 | existing_bal = Account.get_account_balance_by_acct_ID(f_ID) 44 | try: 45 | if existing_bal=amount: 48 | f_bal = existing_bal - amount 49 | t_bal = existing_bal + amount 50 | Account.update_balace(f_ID, f_bal) 51 | Account.update_balace(t_ID, t_bal) 52 | except LowBalanceError: 53 | print('Cannot perform Transfer operation..') 54 | print('Check Account balance first..') 55 | return 56 | 57 | transfer = Transfer(0,f_ID,t_ID,amount,today) 58 | print(amount,'Transfer Successful..\n') 59 | 60 | 61 | def list_trans(id: int): 62 | trans_list = Transaction.get_all_transactions_by_acct_ID(id) 63 | if len(trans_list) == 0: 64 | print('\nNo transactions performed yet..') 65 | else: 66 | print(f'\nAll the Transactions on the account ID({id}) are: ') 67 | for trans in trans_list: 68 | print('Transaction Type: ',trans[2],end='\t') 69 | print('Transaction Amount: ',trans[3],end='\t') 70 | print('Transaction Time: ',trans[4]) 71 | 72 | 73 | 74 | 75 | 76 | 77 | def acct_menu(id): 78 | while True: 79 | print('\n|****** Perform following Account Operations ******|') 80 | print('1. Deposit') 81 | print('2. Withdraw') 82 | print('3. Tranfer') 83 | print('4. List all Transactions') 84 | print('5. Check Account Balance') 85 | print('6. Exit') 86 | ch = int(input('Enter your choice: ')) 87 | now = datetime.now() 88 | today = now.strftime("%Y-%m-%d %H:%M:%S") 89 | 90 | match ch: 91 | case 1: 92 | print('\nWelcome to perform Deposit Operation...') 93 | deposit_amt(id, today) 94 | 95 | case 2: 96 | print('\nWelcome to perform Withdraw Operation...') 97 | withdraw_amt(id, today) 98 | 99 | case 3: 100 | print('\nWelcome to perform Transfer Operation...') 101 | tranfer_amt(id, today) 102 | 103 | case 4: 104 | list_trans(id) 105 | print() 106 | 107 | case 5: 108 | balance = Account.get_account_balance_by_acct_ID(id) 109 | print('\nBalance present in your account:') 110 | print(balance, '\n') 111 | 112 | case 6: 113 | print('\nThank you for performing operations..\n') 114 | return 115 | 116 | case _: 117 | print('\nChoose correct option...\n') 118 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Customer.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Customer: 4 | count = 1 5 | def __init__(self, cust_ID: int, f_name: str, m_name: str, l_name: str, username: str, password: str, address: str, birth_date: str, phone: int, email: str, age: int) -> None: 6 | self.cust_ID = cust_ID 7 | self.f_name = f_name 8 | self.m_name = m_name 9 | self.l_name = l_name 10 | self.username = username 11 | self.__password = password 12 | self.address = address 13 | self.birth_date = birth_date 14 | self.phone = phone 15 | self.email = email 16 | self.age = age 17 | 18 | msg = self.insert_cust() 19 | 20 | 21 | 22 | def insert_cust(self) -> str: 23 | insert_sql = 'INSERT INTO customer(cust_ID, f_name, m_name, l_name, username, password, \ 24 | address, birth_date, phone, email, age) \ 25 | VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)' 26 | 27 | val = (0, self.f_name, self.m_name, self.l_name, 28 | self.username, self.__password, self.address, self.birth_date, 29 | self.phone, self.email, self.age) 30 | 31 | my_cursor.execute(insert_sql, val) 32 | conn.commit() 33 | return ('Congratulations for Signing Up Successfully..') 34 | 35 | 36 | def update_password(self, password: str) -> None: 37 | self.__password = password 38 | update_sql = 'UPDATE customer SET password = %s, where cust_ID = %s' 39 | val = (password, self.cust_ID) 40 | my_cursor.execute(update_sql, val) 41 | 42 | 43 | def __str__(self) -> str: 44 | return f''' 45 | 46 | ''' 47 | 48 | 49 | @classmethod 50 | def _get_cust_count() -> int: 51 | sql = 'SELECT COUNT(*) FROM customer' 52 | my_cursor.execute(sql) 53 | result = my_cursor.fetchall() 54 | Customer.count = result 55 | return result 56 | 57 | 58 | def __get_all_cust(self) -> list : 59 | sql = 'SELECT * FROM customer' 60 | my_cursor.execute(sql) 61 | Customer.count = my_cursor.rowcount 62 | 63 | result = list(my_cursor.fetchall()) 64 | return result 65 | 66 | 67 | @classmethod 68 | def get_cust_by_id(id: int): 69 | sql = f'SELECT * FROM customer WHERE id = {id}' 70 | my_cursor.execute(sql) 71 | result = my_cursor.fetchone() 72 | return result 73 | 74 | 75 | @staticmethod 76 | def get_cust_by_username(u_name: str): 77 | sql = f'SELECT * FROM customer WHERE username = "{u_name}"' 78 | my_cursor.execute(sql) 79 | result = my_cursor.fetchone() 80 | return result 81 | 82 | 83 | if __name__ == '__main__': 84 | print(Customer.get_cust_by_username('snehalmankar')) 85 | print(type(Customer.get_cust_by_username('snehalmankar'))) 86 | 87 | print(Customer.get_cust_by_username('snehal')) 88 | print(type(Customer.get_cust_by_username('snehal'))) 89 | 90 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Errors.py: -------------------------------------------------------------------------------- 1 | class LowBalanceError(Exception): 2 | '''Low Balance in the Account''' 3 | def __init__(self, *args: object) -> None: 4 | super().__init__(*args) 5 | def __str__(self) -> str: 6 | return 'Balance is Low in Account' 7 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/New_Menu.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | from Account_menu import acct_menu 3 | from create_account import create_acct 4 | 5 | 6 | def list_accts(user_dict): 7 | acct_list = Account.get_all_accounts_by_cust_ID(user_dict['cust_ID']) 8 | if len(acct_list)==0: 9 | print('\nYou have no Accounts...\n') 10 | else: 11 | print('\nYour all Accounts are: ') 12 | for acct in acct_list: 13 | print("Account ID: ",acct[0],end='\t') 14 | print("Account Type: ",acct[2],end='\t') 15 | print("Account Balance: ",acct[1]) 16 | print() 17 | 18 | 19 | def display_menu(user_dict): 20 | while True: 21 | print(f'\n|************* Welcome to the Bank, { user_dict["f_name"] } ***************|') 22 | print('1. Create new Account') 23 | print('2. Choose Existing Account') 24 | print('3. List all the Existing Account') 25 | print('4. Logout from the Bank System') 26 | ch = int(input('\nEnter your choice: ')) 27 | 28 | match ch: 29 | case 1: 30 | print('Create new Account...') 31 | create_acct(user_dict) 32 | break 33 | 34 | case 2: 35 | a_ID = int(input('Enter your Account ID: ')) 36 | acct_menu(a_ID) 37 | 38 | case 3: 39 | list_accts(user_dict) 40 | 41 | case 4: 42 | print('\nLogout Successful..\n') 43 | return 44 | 45 | case _: 46 | print('Choose correct option...') 47 | 48 | print('End...') -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Transaction.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | class Transaction: 4 | count = 0 5 | def __init__(self, trans_ID: int=None, acct_ID: int=None, transac_type: str=None, ammount: float=None, transac_date: str=None) -> None: 6 | self.trans_ID = trans_ID 7 | self.acct_ID = acct_ID 8 | self.transac_type = transac_type 9 | self.ammount = ammount 10 | self.transac_date = transac_date 11 | 12 | self.insert_transaction() 13 | 14 | 15 | def insert_transaction(self) -> str: 16 | insert_sql = 'INSERT INTO transaction(trans_ID, acct_ID, transac_type, ammount, transac_date) \ 17 | VALUES(%s,%s,%s,%s,%s)' 18 | val = (self.trans_ID, self.acct_ID, self.transac_type, self.ammount, 19 | self.transac_date) 20 | 21 | my_cursor.execute(insert_sql, val) 22 | conn.commit() 23 | return (my_cursor.rowcount,' Transaction created..') 24 | 25 | 26 | def __get_all_transactions(self) -> list: 27 | sql = 'SELECT * FROM transaction' 28 | my_cursor.execute(sql) 29 | Transaction.count = my_cursor.rowcount 30 | 31 | result = list(my_cursor.fetchall()) 32 | return result 33 | 34 | 35 | @staticmethod 36 | def get_all_transactions_by_acct_ID(a_ID: int) -> list: 37 | sql = f'SELECT * FROM transaction WHERE acct_ID = {a_ID}' 38 | my_cursor.execute(sql) 39 | 40 | result = list(my_cursor.fetchall()) 41 | return result 42 | 43 | 44 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/Transfer.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from db_conn import my_cursor, conn 3 | 4 | class Transfer: 5 | 6 | def __init__(self, transfer_ID: int, from_acct_ID: int, to_acct_ID: int, amount: float, transfer_date: datetime) -> None: 7 | self.transfer_ID = transfer_ID 8 | self.from_acct_ID = from_acct_ID 9 | self.to_acct_ID = to_acct_ID 10 | self.amount = amount 11 | self.transfer_date = transfer_date 12 | 13 | self.insert_transfer() 14 | 15 | def insert_transfer(self) -> str: 16 | insert_sql = 'INSERT INTO transfers(transfer_ID,from_acct_ID,to_acct_ID,amount,transfer_date) \ 17 | VALUES(%s,%s,%s,%s,%s)' 18 | val = (self.transfer_ID, self.from_acct_ID, self.to_acct_ID, self.amount, self.transfer_date) 19 | 20 | my_cursor.execute(insert_sql, val) 21 | conn.commit() 22 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Account.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Account.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Account_menu.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Account_menu.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Customer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Customer.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Errors.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Errors.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/New_Menu.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/New_Menu.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Transaction.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Transaction.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/Transfer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/Transfer.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/create_account.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/create_account.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/create_customer.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/create_customer.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/cust_login.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/cust_login.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/__pycache__/db_conn.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/11. Day 11 - Project Completion/__pycache__/db_conn.cpython-311.pyc -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/bank.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | from Customer import Customer 3 | from New_Menu import display_menu 4 | from Transaction import Transaction 5 | import re 6 | 7 | from create_customer import create_cust 8 | from cust_login import login 9 | 10 | 11 | 12 | if __name__ == '__main__': 13 | 14 | 15 | while True: 16 | print('|************** Welcome to Py_Bank ***********|') 17 | print('1. Login') 18 | print('2. Create Customer') 19 | print('3. Exit') 20 | ch = int(input('Enter your choice: ')) 21 | print() 22 | match ch: 23 | case 1: 24 | print('Enter your credentials..') 25 | user_dict = login() 26 | # print(user_dict) 27 | display_menu(user_dict) 28 | 29 | 30 | 31 | case 2: 32 | print('|*********** Sign Up to the Py_Bank ****************|') 33 | 34 | user_dict = create_cust() 35 | 36 | cust = Customer(0, user_dict['f_name'], user_dict['m_name'], user_dict['l_name'], 37 | user_dict['username'], user_dict['password'], user_dict['address'], 38 | user_dict['birth_date'], user_dict['phone'], user_dict['email'], 39 | user_dict['age']) 40 | 41 | print('Congratulations for Signing Up Successfully..\n\n') 42 | 43 | case 3: 44 | print('Thank You for visiting the Py_Bank...') 45 | break 46 | 47 | case _: 48 | print('Please choose correct choice again...\n') 49 | 50 | # acct = Account() 51 | # tran = Transaction() 52 | 53 | 54 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/bank_db.py: -------------------------------------------------------------------------------- 1 | from db_conn import my_cursor, conn 2 | 3 | 4 | 5 | cust_sql = 'CREATE TABLE customer(cust_ID INT PRIMARY KEY AUTO_INCREMENT, f_name VARCHAR(20), \ 6 | m_name VARCHAR(20), l_name VARCHAR(20), username VARCHAR(20), password VARCHAR(50), \ 7 | address VARCHAR(45), birth_date DATE, phone DECIMAL(10,0), email VARCHAR(45), age INT)' 8 | my_cursor.execute(cust_sql) 9 | 10 | acct_sql = 'CREATE TABLE account(acct_ID INT PRIMARY KEY AUTO_INCREMENT, balance FLOAT, \ 11 | acct_type VARCHAR(20), cust_ID INT, \ 12 | CONSTRAINT FK_cust_ID FOREIGN KEY (cust_ID) REFERENCES customer(cust_ID))' 13 | my_cursor.execute(acct_sql) 14 | 15 | tran_sql = 'CREATE TABLE transaction(trans_ID INT PRIMARY KEY AUTO_INCREMENT, \ 16 | acct_ID INT, transac_date DATE, ammount FLOAT, transac_type VARCHAR(20), \ 17 | CONSTRAINT FK_acct_ID FOREIGN KEY (acct_ID) REFERENCES account(acct_ID))' 18 | my_cursor.execute(tran_sql) 19 | 20 | transfer_sql = 'CREATE TABLE tranfers(transfer_ID INT AUTO_INCREMENT PRIMARY KEY, \ 21 | from_acct_ID INT, to_acct_ID INT, amount FLOAT, transfer_date DATETIME)' 22 | my_cursor.execute(transfer_sql) 23 | 24 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/create_account.py: -------------------------------------------------------------------------------- 1 | from Account import Account 2 | 3 | 4 | def create_acct(user_dict): 5 | while True: 6 | print('1. Current Account.') 7 | print('2. Savings Account.') 8 | print('3. Fixed Account.') 9 | ch = int(input('Enter your choice: ')) 10 | 11 | match ch: 12 | case 1: 13 | type = 'Current' 14 | case 2: 15 | type = 'Savings' 16 | case 3: 17 | type = 'Fixed' 18 | case _: 19 | print('Choose correct option from the menu...') 20 | 21 | amount = float(input('Enter amount you want to deposit: ')) 22 | 23 | acct = Account(0, amount, type, user_dict['cust_ID']) 24 | break 25 | 26 | print('End..') -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/create_customer.py: -------------------------------------------------------------------------------- 1 | import re 2 | from Customer import Customer 3 | 4 | def username_input() -> str: 5 | while True: 6 | username = input('\nEnter username for you: ') 7 | user = Customer.get_cust_by_username(username) 8 | if type(user) == tuple: 9 | print('Username already exist..\nChoose another name for you..') 10 | else: 11 | break 12 | return username 13 | 14 | 15 | def password_input() -> str: 16 | while True: 17 | print('Password should contain: \n1. Atleast 6 alphabetic character\ 18 | \n2. Atleast 2 numeric Characters \ 19 | \n3. Atleast 1 Capital alphabetic character \ 20 | \n3. No Space Character') 21 | password = input('Enter password: ') 22 | char_count = re.findall('[A-Za-z]', password) 23 | int_count = re.findall('[\d]', password) 24 | sp_count = re.findall('[\s]', password) 25 | cap_count = re.findall('[A-Z]', password) 26 | 27 | if (len(char_count)>=6 and len(int_count)>=2 and len(cap_count)>=1 28 | and len(sp_count)==0): 29 | print('Strong Password...') 30 | break 31 | else: 32 | print('Invalid Password..') 33 | 34 | return password 35 | 36 | 37 | def birth_input() -> str: 38 | while True: 39 | email_pattern = re.compile('[\d]{4}-[\d]{2}-[\d]{2}') 40 | birth_date = input('Enter your birth date(YYYY-MM-DD): ') 41 | flag = email_pattern.search(birth_date) 42 | if flag: 43 | break 44 | else: 45 | print('Date not valid..') 46 | return birth_date 47 | 48 | 49 | def phone_input() -> str: 50 | while True: 51 | phone = input('Enter your phone number(10 digit): ') 52 | pattern = re.compile('[\d]{10}') 53 | if pattern.search(phone): 54 | break 55 | else: 56 | print('Not Valid...') 57 | return phone 58 | 59 | 60 | def email_input() -> str: 61 | while True: 62 | email_pattern = re.compile('[\w]+@[\w].[\w]+') 63 | email = input('Enter your email: ') 64 | flag = email_pattern.search(email) 65 | if flag: 66 | break 67 | else: 68 | print('Email not valid..') 69 | return email 70 | 71 | 72 | def age_input() -> int: 73 | while True: 74 | try: 75 | age = int(input('Enter your age: ')) 76 | break 77 | except: 78 | print('\nEnter age in integer: ') 79 | return age 80 | 81 | 82 | 83 | 84 | 85 | 86 | def create_cust() -> dict: 87 | key_list = ['f_name', 'm_name', 'l_name', 'username', 'password', 'address', 88 | 'birth_date', 'phone', 'email', 'age'] 89 | user_dict = dict.fromkeys(key_list) 90 | 91 | # Full name Input 92 | full = input('Enter full name(first middle last):') 93 | user_dict['f_name'], user_dict['m_name'], user_dict['l_name'] = full.split(' ') 94 | 95 | # username Input 96 | user_dict['username'] = username_input() 97 | 98 | # Password Input 99 | print() 100 | user_dict['password'] = password_input() 101 | 102 | # Address Input 103 | print() 104 | user_dict['address'] = input('Enter your address: ') 105 | 106 | # Birth Date Input 107 | print() 108 | user_dict['birth_date'] = birth_input() 109 | 110 | # Phone Number Input 111 | print() 112 | user_dict['phone'] = phone_input() 113 | 114 | # Email Input 115 | print() 116 | user_dict['email'] = email_input() 117 | 118 | # Age Input 119 | print() 120 | user_dict['age'] = age_input() 121 | print() 122 | 123 | 124 | 125 | return user_dict -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/cust_login.py: -------------------------------------------------------------------------------- 1 | from Customer import Customer 2 | 3 | 4 | def login(): 5 | while True: 6 | username = input('Enter username: ') 7 | user = Customer.get_cust_by_username(username) 8 | # print(user) 9 | if type(user) == tuple: 10 | password = input('Enter password: ') 11 | # print(user[5], password) 12 | if user[5] == password: 13 | print('\nLogin Successful...\n\n') 14 | break 15 | else: 16 | print('Password Incorrect...\n') 17 | else: 18 | print('Username Invalid...\n') 19 | 20 | key_list = ['cust_ID', 'f_name', 'm_name', 'l_name', 'username', 'password', 21 | 'address', 'birth_date', 'phone', 'email', 'age'] 22 | user_dict = dict(zip(key_list, user)) 23 | return user_dict 24 | -------------------------------------------------------------------------------- /11. Day 11 - Project Completion/db_conn.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | 3 | conn = mysql.connector.connect( 4 | host = 'localhost', 5 | user = 'root', 6 | password = 'snehal21', 7 | database = 'bank_management' 8 | ) 9 | 10 | my_cursor = conn.cursor() -------------------------------------------------------------------------------- /12. Day 12 - NumPy Basics/numpy_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/12. Day 12 - NumPy Basics/numpy_notes.pdf -------------------------------------------------------------------------------- /13. Day 13 - Numpy Math Operations/numpy_math_operations.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/13. Day 13 - Numpy Math Operations/numpy_math_operations.pdf -------------------------------------------------------------------------------- /14. Day 14 - NumPy Statistic Functions/Statistic_functions_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/14. Day 14 - NumPy Statistic Functions/Statistic_functions_Notes.pdf -------------------------------------------------------------------------------- /15. Day 15 - (1-8-23) Pandas Introduction/Pandas_intro_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/15. Day 15 - (1-8-23) Pandas Introduction/Pandas_intro_Notes.pdf -------------------------------------------------------------------------------- /15. Day 15 - (1-8-23) Pandas Introduction/df_csv.csv: -------------------------------------------------------------------------------- 1 | ,name,age,subjects 2 | 0,Snehal,22,C 3 | 1,Snehal,22,C++ 4 | 2,Snehal,22,HTML 5 | 3,Snehal,22,Java 6 | 4,Snehal,22,Python 7 | -------------------------------------------------------------------------------- /15. Day 15 - (1-8-23) Pandas Introduction/df_html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
nameagesubjects
0Snehal22C
1Snehal22C++
2Snehal22HTML
3Snehal22Java
4Snehal22Python
-------------------------------------------------------------------------------- /15. Day 15 - (1-8-23) Pandas Introduction/df_json.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": { 3 | "0": "Snehal", 4 | "1": "Snehal", 5 | "2": "Snehal", 6 | "3": "Snehal", 7 | "4": "Snehal" 8 | }, 9 | "age": { 10 | "0": 22, 11 | "1": 22, 12 | "2": 22, 13 | "3": 22, 14 | "4": 22 15 | }, 16 | "subjects": { 17 | "0": "C", 18 | "1": "C++", 19 | "2": "HTML", 20 | "3": "Java", 21 | "4": "Python" 22 | } 23 | } -------------------------------------------------------------------------------- /16. Day 16 - Pandas Data Manipulation/Pandas_Data_Manipulation_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/16. Day 16 - Pandas Data Manipulation/Pandas_Data_Manipulation_Notes.pdf -------------------------------------------------------------------------------- /17. Day 17 - Pandas Data Cleaning/Data Cleaning Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/17. Day 17 - Pandas Data Cleaning/Data Cleaning Notes.pdf -------------------------------------------------------------------------------- /18. Day 18 - Pandas Time Series, Feature Engg/Feature_engg_Time_series_note.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/18. Day 18 - Pandas Time Series, Feature Engg/Feature_engg_Time_series_note.pdf -------------------------------------------------------------------------------- /18. Day 18 - Pandas Time Series, Feature Engg/IRIS.csv: -------------------------------------------------------------------------------- 1 | sepal_length,sepal_width,petal_length,petal_width,species 2 | 5.1,3.5,1.4,0.2,Iris-setosa 3 | 4.9,3,1.4,0.2,Iris-setosa 4 | 4.7,3.2,1.3,0.2,Iris-setosa 5 | 4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,3.6,1.4,0.2,Iris-setosa 7 | 5.4,3.9,1.7,0.4,Iris-setosa 8 | 4.6,3.4,1.4,0.3,Iris-setosa 9 | 5,3.4,1.5,0.2,Iris-setosa 10 | 4.4,2.9,1.4,0.2,Iris-setosa 11 | 4.9,3.1,1.5,0.1,Iris-setosa 12 | 5.4,3.7,1.5,0.2,Iris-setosa 13 | 4.8,3.4,1.6,0.2,Iris-setosa 14 | 4.8,3,1.4,0.1,Iris-setosa 15 | 4.3,3,1.1,0.1,Iris-setosa 16 | 5.8,4,1.2,0.2,Iris-setosa 17 | 5.7,4.4,1.5,0.4,Iris-setosa 18 | 5.4,3.9,1.3,0.4,Iris-setosa 19 | 5.1,3.5,1.4,0.3,Iris-setosa 20 | 5.7,3.8,1.7,0.3,Iris-setosa 21 | 5.1,3.8,1.5,0.3,Iris-setosa 22 | 5.4,3.4,1.7,0.2,Iris-setosa 23 | 5.1,3.7,1.5,0.4,Iris-setosa 24 | 4.6,3.6,1,0.2,Iris-setosa 25 | 5.1,3.3,1.7,0.5,Iris-setosa 26 | 4.8,3.4,1.9,0.2,Iris-setosa 27 | 5,3,1.6,0.2,Iris-setosa 28 | 5,3.4,1.6,0.4,Iris-setosa 29 | 5.2,3.5,1.5,0.2,Iris-setosa 30 | 5.2,3.4,1.4,0.2,Iris-setosa 31 | 4.7,3.2,1.6,0.2,Iris-setosa 32 | 4.8,3.1,1.6,0.2,Iris-setosa 33 | 5.4,3.4,1.5,0.4,Iris-setosa 34 | 5.2,4.1,1.5,0.1,Iris-setosa 35 | 5.5,4.2,1.4,0.2,Iris-setosa 36 | 4.9,3.1,1.5,0.1,Iris-setosa 37 | 5,3.2,1.2,0.2,Iris-setosa 38 | 5.5,3.5,1.3,0.2,Iris-setosa 39 | 4.9,3.1,1.5,0.1,Iris-setosa 40 | 4.4,3,1.3,0.2,Iris-setosa 41 | 5.1,3.4,1.5,0.2,Iris-setosa 42 | 5,3.5,1.3,0.3,Iris-setosa 43 | 4.5,2.3,1.3,0.3,Iris-setosa 44 | 4.4,3.2,1.3,0.2,Iris-setosa 45 | 5,3.5,1.6,0.6,Iris-setosa 46 | 5.1,3.8,1.9,0.4,Iris-setosa 47 | 4.8,3,1.4,0.3,Iris-setosa 48 | 5.1,3.8,1.6,0.2,Iris-setosa 49 | 4.6,3.2,1.4,0.2,Iris-setosa 50 | 5.3,3.7,1.5,0.2,Iris-setosa 51 | 5,3.3,1.4,0.2,Iris-setosa 52 | 7,3.2,4.7,1.4,Iris-versicolor 53 | 6.4,3.2,4.5,1.5,Iris-versicolor 54 | 6.9,3.1,4.9,1.5,Iris-versicolor 55 | 5.5,2.3,4,1.3,Iris-versicolor 56 | 6.5,2.8,4.6,1.5,Iris-versicolor 57 | 5.7,2.8,4.5,1.3,Iris-versicolor 58 | 6.3,3.3,4.7,1.6,Iris-versicolor 59 | 4.9,2.4,3.3,1,Iris-versicolor 60 | 6.6,2.9,4.6,1.3,Iris-versicolor 61 | 5.2,2.7,3.9,1.4,Iris-versicolor 62 | 5,2,3.5,1,Iris-versicolor 63 | 5.9,3,4.2,1.5,Iris-versicolor 64 | 6,2.2,4,1,Iris-versicolor 65 | 6.1,2.9,4.7,1.4,Iris-versicolor 66 | 5.6,2.9,3.6,1.3,Iris-versicolor 67 | 6.7,3.1,4.4,1.4,Iris-versicolor 68 | 5.6,3,4.5,1.5,Iris-versicolor 69 | 5.8,2.7,4.1,1,Iris-versicolor 70 | 6.2,2.2,4.5,1.5,Iris-versicolor 71 | 5.6,2.5,3.9,1.1,Iris-versicolor 72 | 5.9,3.2,4.8,1.8,Iris-versicolor 73 | 6.1,2.8,4,1.3,Iris-versicolor 74 | 6.3,2.5,4.9,1.5,Iris-versicolor 75 | 6.1,2.8,4.7,1.2,Iris-versicolor 76 | 6.4,2.9,4.3,1.3,Iris-versicolor 77 | 6.6,3,4.4,1.4,Iris-versicolor 78 | 6.8,2.8,4.8,1.4,Iris-versicolor 79 | 6.7,3,5,1.7,Iris-versicolor 80 | 6,2.9,4.5,1.5,Iris-versicolor 81 | 5.7,2.6,3.5,1,Iris-versicolor 82 | 5.5,2.4,3.8,1.1,Iris-versicolor 83 | 5.5,2.4,3.7,1,Iris-versicolor 84 | 5.8,2.7,3.9,1.2,Iris-versicolor 85 | 6,2.7,5.1,1.6,Iris-versicolor 86 | 5.4,3,4.5,1.5,Iris-versicolor 87 | 6,3.4,4.5,1.6,Iris-versicolor 88 | 6.7,3.1,4.7,1.5,Iris-versicolor 89 | 6.3,2.3,4.4,1.3,Iris-versicolor 90 | 5.6,3,4.1,1.3,Iris-versicolor 91 | 5.5,2.5,4,1.3,Iris-versicolor 92 | 5.5,2.6,4.4,1.2,Iris-versicolor 93 | 6.1,3,4.6,1.4,Iris-versicolor 94 | 5.8,2.6,4,1.2,Iris-versicolor 95 | 5,2.3,3.3,1,Iris-versicolor 96 | 5.6,2.7,4.2,1.3,Iris-versicolor 97 | 5.7,3,4.2,1.2,Iris-versicolor 98 | 5.7,2.9,4.2,1.3,Iris-versicolor 99 | 6.2,2.9,4.3,1.3,Iris-versicolor 100 | 5.1,2.5,3,1.1,Iris-versicolor 101 | 5.7,2.8,4.1,1.3,Iris-versicolor 102 | 6.3,3.3,6,2.5,Iris-virginica 103 | 5.8,2.7,5.1,1.9,Iris-virginica 104 | 7.1,3,5.9,2.1,Iris-virginica 105 | 6.3,2.9,5.6,1.8,Iris-virginica 106 | 6.5,3,5.8,2.2,Iris-virginica 107 | 7.6,3,6.6,2.1,Iris-virginica 108 | 4.9,2.5,4.5,1.7,Iris-virginica 109 | 7.3,2.9,6.3,1.8,Iris-virginica 110 | 6.7,2.5,5.8,1.8,Iris-virginica 111 | 7.2,3.6,6.1,2.5,Iris-virginica 112 | 6.5,3.2,5.1,2,Iris-virginica 113 | 6.4,2.7,5.3,1.9,Iris-virginica 114 | 6.8,3,5.5,2.1,Iris-virginica 115 | 5.7,2.5,5,2,Iris-virginica 116 | 5.8,2.8,5.1,2.4,Iris-virginica 117 | 6.4,3.2,5.3,2.3,Iris-virginica 118 | 6.5,3,5.5,1.8,Iris-virginica 119 | 7.7,3.8,6.7,2.2,Iris-virginica 120 | 7.7,2.6,6.9,2.3,Iris-virginica 121 | 6,2.2,5,1.5,Iris-virginica 122 | 6.9,3.2,5.7,2.3,Iris-virginica 123 | 5.6,2.8,4.9,2,Iris-virginica 124 | 7.7,2.8,6.7,2,Iris-virginica 125 | 6.3,2.7,4.9,1.8,Iris-virginica 126 | 6.7,3.3,5.7,2.1,Iris-virginica 127 | 7.2,3.2,6,1.8,Iris-virginica 128 | 6.2,2.8,4.8,1.8,Iris-virginica 129 | 6.1,3,4.9,1.8,Iris-virginica 130 | 6.4,2.8,5.6,2.1,Iris-virginica 131 | 7.2,3,5.8,1.6,Iris-virginica 132 | 7.4,2.8,6.1,1.9,Iris-virginica 133 | 7.9,3.8,6.4,2,Iris-virginica 134 | 6.4,2.8,5.6,2.2,Iris-virginica 135 | 6.3,2.8,5.1,1.5,Iris-virginica 136 | 6.1,2.6,5.6,1.4,Iris-virginica 137 | 7.7,3,6.1,2.3,Iris-virginica 138 | 6.3,3.4,5.6,2.4,Iris-virginica 139 | 6.4,3.1,5.5,1.8,Iris-virginica 140 | 6,3,4.8,1.8,Iris-virginica 141 | 6.9,3.1,5.4,2.1,Iris-virginica 142 | 6.7,3.1,5.6,2.4,Iris-virginica 143 | 6.9,3.1,5.1,2.3,Iris-virginica 144 | 5.8,2.7,5.1,1.9,Iris-virginica 145 | 6.8,3.2,5.9,2.3,Iris-virginica 146 | 6.7,3.3,5.7,2.5,Iris-virginica 147 | 6.7,3,5.2,2.3,Iris-virginica 148 | 6.3,2.5,5,1.9,Iris-virginica 149 | 6.5,3,5.2,2,Iris-virginica 150 | 6.2,3.4,5.4,2.3,Iris-virginica 151 | 5.9,3,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /18. Day 18 - Pandas Time Series, Feature Engg/covid_data.csv: -------------------------------------------------------------------------------- 1 | ,id,country,start_date,end,quantity 2 | 378,254,Finland,"Mar 16, 2020","Apr 13, 2020",10.0 3 | 414,292,Lithuania,"Mar 16, 2020","Mar 30, 2020",50.0 4 | 452,345,Latvia,"Mar 13, 2020","Apr 14, 2020",200.0 5 | 453,342,Netherlands,"Mar 15, 2020","Apr 06, 2020",30.0 6 | 468,364,Ireland,"Mar 15, 2020","Mar 29, 2020",10.0 7 | 503,396,United States,"Mar 16, 2020","Mar 30, 2020",1000.0 8 | 529,447,Romania,"Mar 08, 2020","Mar 31, 2020",1000.0 9 | 530,436,Romania,"Mar 11, 2020","Mar 31, 2020",100.0 10 | 533,442,Norway,"Mar 12, 2020","Mar 26, 2020",50.0 11 | 544,459,Germany,"Mar 13, 2020","Apr 20, 2020",90.0 12 | 599,588,Russia,"Mar 10, 2020","Apr 10, 2020",5000.0 13 | 613,583,Russia,"Mar 16, 2020","Apr 10, 2020",50.0 14 | 615,574,Russia,"Mar 13, 2020","Mar 20, 2020",1000.0 15 | 632,618,US: Oregon,"Mar 16, 2020","Apr 16, 2020",25.0 16 | 940,861,Denmark,"Mar 18, 2020","Apr 13, 2020",10.0 17 | -------------------------------------------------------------------------------- /19. Day 19 - Matplotlib Intro/MatplotLib Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/19. Day 19 - Matplotlib Intro/MatplotLib Intro.pdf -------------------------------------------------------------------------------- /20. Day 20 - Matplotlib - Scatter and Histogram/matplotlib scatter hist notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/20. Day 20 - Matplotlib - Scatter and Histogram/matplotlib scatter hist notes.pdf -------------------------------------------------------------------------------- /21. Day 21 - Seaborn Intro/Seaborn Intro Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/21. Day 21 - Seaborn Intro/Seaborn Intro Notes.pdf -------------------------------------------------------------------------------- /22. Day 22 - Seaborn Visualization/seaborn visualization notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/22. Day 22 - Seaborn Visualization/seaborn visualization notes.pdf -------------------------------------------------------------------------------- /23. Day 23 - Python Basics Revision/Python Fundamentals Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/23. Day 23 - Python Basics Revision/Python Fundamentals Handwritten Notes.pdf -------------------------------------------------------------------------------- /24. Day 24 - NumPy Revision/NumPy Revision Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/24. Day 24 - NumPy Revision/NumPy Revision Handwritten Notes.pdf -------------------------------------------------------------------------------- /25. Day 25 - Pandas Revision/Pandas Revision Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/25. Day 25 - Pandas Revision/Pandas Revision Handwritten Notes.pdf -------------------------------------------------------------------------------- /26. Day 26 - AI and ML Fundamentals/AI and ML Fundamentals Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/26. Day 26 - AI and ML Fundamentals/AI and ML Fundamentals Notes.pdf -------------------------------------------------------------------------------- /26. Day 26 - AI and ML Fundamentals/ML.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/26. Day 26 - AI and ML Fundamentals/ML.webp -------------------------------------------------------------------------------- /26. Day 26 - AI and ML Fundamentals/README.md: -------------------------------------------------------------------------------- 1 | ## 🔹 Introduction to Artificial Intelligence and Machine Learning Fundamentals 🔹 2 | 3 | 4 | 5 | 6 | ### 🔸 Artificial Intelligence: 7 | Artificial Intelligence, or AI, embodies the creation of intelligent systems that can simulate human thought processes. It encompasses tasks like problem-solving, decision-making, and natural language understanding. AI technologies, including machine learning and deep learning, empower us to develop systems that learn, adapt, and evolve. 8 | 9 | 10 | 11 | ### 🔸 Machine Learning: 12 | 13 | 1. Difference between AI and Machine Learning: While AI is the broader concept of creating machines capable of intelligent behavior, Machine Learning is a subset that involves enabling machines to learn from data without explicit programming. 14 | 15 | 2. Applications of Machine Learning: From recommendation systems to fraud detection, medical diagnosis to autonomous vehicles, Machine Learning applications are vast and transformative. 16 | 17 | 3. Limitations of Machine Learning: While powerful, Machine Learning has limitations like dependency on data quality, lack of reasoning abilities, and susceptibility to bias. 18 | 19 | 4. Types of Machine Learning: 20 | 21 | - Supervised Learning: Learning from labeled data, where the algorithm predicts outcomes based on examples. 22 | 23 | - Unsupervised Learning: Unearthing patterns and relationships in unlabeled data, often used for clustering and dimensionality reduction. 24 | 25 | - Reinforcement Learning: Training algorithms to take actions in an environment to maximize a reward, often used in robotics and gaming. 26 | 27 | 5. Comparisons between all Types: Understanding the unique characteristics and applications of each Machine Learning type is essential for informed decision-making. 28 | 29 | 30 | 31 | 32 | 🔗 Here's the link to my GitHub repository: https://github.com/mankarsnehal/100-Days-of-Code-Data-Science 33 | 34 | To make your learning even more comprehensive, I've prepared detailed handwritten notes summarizing the essence of AI and Machine Learning. These notes will guide us as we explore these transformative technologies. 35 | 36 | 37 | 38 | 39 | Get ready to be captivated by the limitless potential of Artificial Intelligence and Machine Learning. Let's continue this journey of growth, discovery, and transformation as we unravel the mysteries of AI and Machine Learning! 🚀🤖 40 | 41 | -------------------------------------------------------------------------------- /27. Day 27 - ML Workflow/Machine_Learning_Workflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/27. Day 27 - ML Workflow/Machine_Learning_Workflow.pdf -------------------------------------------------------------------------------- /27. Day 27 - ML Workflow/Machine_Learning_Workflow_page-0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/27. Day 27 - ML Workflow/Machine_Learning_Workflow_page-0001.jpg -------------------------------------------------------------------------------- /27. Day 27 - ML Workflow/README.md: -------------------------------------------------------------------------------- 1 |

Machine Learning Workflow

2 | 3 | 4 | 5 | --- 6 | 7 | ## Data Preprocessing: 8 | Data preprocessing is a crucial step in the machine learning workflow. It involves cleaning, transforming, and preparing the raw data to make it suitable for training and evaluating machine learning models. Some common tasks in data preprocessing include: 9 | 10 | - **Data Cleaning:** Handling missing values, outliers, and inconsistencies in the data. 11 | - **Feature Selection/Extraction:** Choosing relevant features or creating new features from existing ones to improve model performance. 12 | - **Normalization/Scaling:** Scaling numerical features to the same range to prevent features with larger values from dominating the learning process. 13 | - **Encoding Categorical Variables:** Converting categorical variables into numerical representations (e.g., one-hot encoding) that can be used by the model. 14 | - **Splitting Data:** Dividing the dataset into training, validation, and test sets. The training set is used for model training, the validation set helps tune hyperparameters, and the test set evaluates the final model's performance. 15 | 16 | 17 | ## Model Training: 18 | Model training involves feeding the preprocessed data into a machine learning algorithm to learn patterns and relationships from the data. The goal is for the model to capture these patterns and make accurate predictions on new, unseen data. The process includes the following steps: 19 | 20 | - **Selecting a Model:** Choose an appropriate machine learning algorithm based on the problem type (e.g., classification, regression) and the characteristics of the data. 21 | - **Initializing Parameters:** Initialize the model's parameters or weights. 22 | - **Training Loop:** Feed the training data into the model iteratively, adjusting the model's parameters to minimize a chosen loss function that quantifies the difference between predicted and actual values. 23 | - **Gradient Descent (for Optimization):** Many machine learning algorithms use gradient descent or its variants to update model parameters in the direction that reduces the loss function. 24 | - **Hyperparameter Tuning:** Tune hyperparameters (parameters not learned during training) to optimize model performance. This can be done using techniques like grid search or random search. 25 | 26 | 27 | ## Model Evaluation: 28 | Once the model is trained, it's essential to assess its performance to determine how well it will perform on new, unseen data. Evaluation methods vary based on the problem type and the nature of the data. Common evaluation techniques include: 29 | 30 | - **Metrics:** Use appropriate evaluation metrics such as accuracy, precision, recall, F1-score for classification; mean squared error (MSE), root mean squared error (RMSE) for regression, etc. 31 | - **Cross-Validation:** Perform cross-validation to get a more robust estimate of the model's performance by splitting the data into multiple train-test folds. 32 | - **Confusion Matrix:** Especially useful for classification problems, it helps visualize the model's performance in terms of true positives, true negatives, false positives, and false negatives. 33 | - **ROC and AUC:** Receiver Operating Characteristic (ROC) curve and Area Under the Curve (AUC) provide insight into a model's ability to distinguish between classes in classification tasks. 34 | - **Overfitting and Underfitting:** Analyze whether the model is overfitting (performing well on training data but poorly on new data) or underfitting (performing poorly on both training and new data). 35 | 36 | -------------------------------------------------------------------------------- /28. Day 28 - Model Evaluation Technique/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ## 1. Accuracy: 9 | 10 | Accuracy measures the ratio of correctly predicted instances to the total instances. It's suitable for balanced datasets but can be misleading for imbalanced ones. 11 | 12 | ## 2. Precision: 13 | Precision measures the proportion of correctly predicted positive instances out of all instances predicted as positive. It's important when false positives are costly. 14 | 15 | ## 3. Recall (Sensitivity or True Positive Rate): 16 | Recall measures the proportion of correctly predicted positive instances out of all actual positive instances. It's important when false negatives are costly. 17 | 18 | ## 4. F1-Score: 19 | F1-score is the harmonic mean of precision and recall. It balances precision and recall, making it useful when you want to consider both false positives and false negatives. 20 | 21 | ## 5. Specificity (True Negative Rate): 22 | Specificity measures the proportion of correctly predicted negative instances out of all actual negative instances. 23 | 24 | ## 6. ROC Curve (Receiver Operating Characteristic): 25 | The ROC curve visualizes the tradeoff between true positive rate (recall) and false positive rate as the classification threshold changes. 26 | 27 | ## 7. AUC (Area Under the ROC Curve): 28 | AUC quantifies the area under the ROC curve. It's a single value that measures the model's ability to distinguish between classes. 29 | 30 | ## 8. Confusion Matrix: 31 | A confusion matrix displays the counts of true positives, true negatives, false positives, and false negatives. It's useful for understanding model performance in classification tasks. 32 | 33 | ## 9. Mean Squared Error (MSE): 34 | MSE measures the average squared difference between predicted and actual values in regression tasks. It quantifies the model's predictive accuracy. 35 | 36 | ## 10. Root Mean Squared Error (RMSE): 37 | RMSE is the square root of MSE. It's more interpretable as it's in the same unit as the target variable. 38 | 39 | ## 11. R-squared (Coefficient of Determination): 40 | R-squared measures the proportion of the variance in the dependent variable that's explained by the model. It assesses the model's goodness of fit. 41 | 42 | ## 12. Mean Absolute Error (MAE): 43 | MAE calculates the average absolute difference between predicted and actual values. It's another metric for evaluating regression models. 44 | 45 | ## 13. Cross-Validation: 46 | Cross-validation involves dividing the dataset into multiple subsets and training/evaluating the model on different combinations of training and test sets. It provides more robust performance estimates. 47 | 48 | ## 14. Stratified K-Fold Cross-Validation: 49 | Similar to k-fold cross-validation, but ensures that class proportions are maintained in each fold for classification tasks. 50 | 51 | ## 15. Bias-Variance Tradeoff Analysis: 52 | Analyzes the tradeoff between bias (simplification) and variance (flexibility) in models. It helps understand whether a model is underfitting or overfitting. 53 | 54 | ## 16. Learning Curves: 55 | Learning curves show how model performance changes with the size of the training data. They help diagnose underfitting or overfitting. 56 | 57 | ## 17. Feature Importance Analysis: 58 | Identifies the importance of each feature in influencing model predictions. Useful for understanding feature relevance and potential model improvements. 59 | 60 | ## 18. Residual Analysis: 61 | In regression tasks, residual analysis examines the patterns in the model's errors (residuals) to check for any systematic deviations. 62 | 63 | ## 19. Hyperparameter Tuning: 64 | Adjusting hyperparameters to optimize model performance. Techniques include grid search, random search, and Bayesian optimization. 65 | 66 | ## 20. Ensemble Methods: 67 | Using combinations of multiple models to improve overall predictive performance. Techniques include bagging, boosting, and stacking. 68 | 69 | ## 21. Domain-Specific Metrics: 70 | Some domains have specialized evaluation metrics. For example, Mean Average Precision (MAP) in information retrieval or Gini coefficient in economics. 71 | -------------------------------------------------------------------------------- /28. Day 28 - Model Evaluation Technique/evaluation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/28. Day 28 - Model Evaluation Technique/evaluation.png -------------------------------------------------------------------------------- /29. Day 29 - Overfitting and Underfitting/Overfitting_Underfitting_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/29. Day 29 - Overfitting and Underfitting/Overfitting_Underfitting_Notes.pdf -------------------------------------------------------------------------------- /29. Day 29 - Overfitting and Underfitting/over_under_fit.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# **Diagnose and Address Underfitting and Overfitting**" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "> **1. Diagnosing Underfitting:**\n", 15 | "\n", 16 | "Underfitting occurs when a model is too simplistic to capture the underlying patterns in the data. It performs poorly on both the training and test sets. Signs of underfitting include:\n", 17 | "\n", 18 | "* Low training and test performance (low accuracy, high error).\n", 19 | "\n", 20 | "* Consistently poor performance across different datasets or folds in cross-validation.\n", 21 | "\n", 22 | "* Model doesn't seem to learn from the training data." 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "**Addressing Underfitting:**\n", 30 | "\n", 31 | "* **Increase Model Complexity:** Consider using a more complex model with more parameters, such as using deeper neural networks, higher-degree polynomial regression, or more complex algorithms.\n", 32 | "\n", 33 | "* **Feature Engineering:** Add more relevant features to the dataset to provide the model with more information.\n", 34 | "\n", 35 | "* **Fine-tuning Hyperparameters:** Adjust hyperparameters like learning rate, regularization strength, or the number of hidden units/layers in a neural network.\n", 36 | "\n", 37 | "* **Reduce Regularization:** If you're using regularization techniques, consider reducing the strength of regularization or using a different type." 38 | ] 39 | }, 40 | { 41 | "cell_type": "markdown", 42 | "metadata": {}, 43 | "source": [ 44 | "**Reasons for Underfitting:**\n", 45 | "\n", 46 | "* High bias and low variance.\n", 47 | "\n", 48 | "* The size of the training dataset used is not enough.\n", 49 | "\n", 50 | "* The model is too simple.\n", 51 | "\n", 52 | "* Training data is not cleaned and also contains noise in it." 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [ 59 | "**Techniques to Reduce Underfitting:**\n", 60 | "\n", 61 | "* Increase model complexity.\n", 62 | "\n", 63 | "* Increase the number of features, performing feature engineering.\n", 64 | "\n", 65 | "* Remove noise from the data.\n", 66 | "\n", 67 | "* Increase the number of epochs or increase the duration of training to get better results." 68 | ] 69 | }, 70 | { 71 | "cell_type": "markdown", 72 | "metadata": {}, 73 | "source": [ 74 | "> **2. Diagnosing Overfitting:**\n", 75 | "\n", 76 | " Overfitting occurs when a model becomes too flexible and fits the training data noise and outliers. It performs very well on the training set but poorly on the test set. Signs of overfitting include:\n", 77 | "\n", 78 | "* High training performance but significantly lower test performance.\n", 79 | "\n", 80 | "* Large differences between training and test performance.\n", 81 | "\n", 82 | "* Model captures noise and fluctuations in the training data." 83 | ] 84 | }, 85 | { 86 | "cell_type": "markdown", 87 | "metadata": {}, 88 | "source": [ 89 | "**Addressing Overfitting:**\n", 90 | "\n", 91 | "* **Regularization:** Apply regularization techniques to penalize overly complex models. Common methods include L1 regularization (Lasso), L2 regularization (Ridge), and dropout in neural networks.\n", 92 | "\n", 93 | "* **Feature Selection:** Remove irrelevant or noisy features that might be contributing to overfitting.\n", 94 | "\n", 95 | "* **More Data:** Increase the size of your training dataset to provide the model with more examples to learn from.\n", 96 | "\n", 97 | "* **Early Stopping:** Monitor the performance on the validation set during training and stop training when performance starts to degrade.\n", 98 | "\n", 99 | "* **Simpler Model:** Consider using a simpler model architecture with fewer parameters.\n", 100 | "Ensemble Methods: Combine predictions from multiple models to reduce overfitting." 101 | ] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "metadata": {}, 106 | "source": [ 107 | "**Reasons for Overfitting:**\n", 108 | "\n", 109 | "* High variance and low bias.\n", 110 | "\n", 111 | "* The model is too complex.\n", 112 | "\n", 113 | "* The size of the training data." 114 | ] 115 | }, 116 | { 117 | "cell_type": "markdown", 118 | "metadata": {}, 119 | "source": [ 120 | "**Techniques to Reduce Overfitting:**\n", 121 | "\n", 122 | "* Increase training data.\n", 123 | "\n", 124 | "* Reduce model complexity.\n", 125 | "\n", 126 | "* Early stopping during the training phase (have an eye over the loss over the training period as soon as loss begins to increase stop training).\n", 127 | "\n", 128 | "* Ridge Regularization and Lasso Regularization.\n", 129 | "\n", 130 | "* Use dropout for neural networks to tackle overfitting." 131 | ] 132 | }, 133 | { 134 | "cell_type": "markdown", 135 | "metadata": {}, 136 | "source": [ 137 | "> **3. Using Cross-Validation:**\n", 138 | "\n", 139 | "Cross-validation is a powerful tool to diagnose both underfitting and overfitting. If a model performs poorly on both training and validation sets across multiple folds, it might indicate underfitting. If the model performs very well on training but poorly on validation, it suggests overfitting." 140 | ] 141 | } 142 | ], 143 | "metadata": { 144 | "language_info": { 145 | "name": "python" 146 | }, 147 | "orig_nbformat": 4 148 | }, 149 | "nbformat": 4, 150 | "nbformat_minor": 2 151 | } 152 | -------------------------------------------------------------------------------- /30. Day 30 - Simple Linear Regression/README.md: -------------------------------------------------------------------------------- 1 |

Simple Linear Regression

2 | 3 | 4 | 5 | --- 6 | 7 | # **Linear Regression** 8 | 9 | **Supervised machine learning algorithms:** It is a type of machine learning, where the algorithm learns from labeled data. 10 | 11 | * **Labeled data** means the dataset whose respective target value is already known. 12 | 13 | * Supervised learning has two types: 14 | 15 | * **Classification:** It predicts the class of the dataset based on the independent input variable. Class is the categorical or discrete values. like the image of an animal is a cat or dog? 16 | 17 | * **Regression:** It predicts the continuous output variables based on the independent input variable. like the prediction of house prices based on different parameters like house age, distance from the main road, location, area, etc. 18 | 19 | --- 20 | 21 | 22 | 23 | 24 | The above diagram is an example of Simple Linear Regression, where change in the value of feature 'Y' is proportional to value of 'X'. 25 | 26 | * **Y :** Dependent or Target Variable. 27 | 28 | * **X :** Independent Variable. 29 | 30 | * **Regression Line:** It is best-fit line of the model, by which we can predict value of 'Y' for new values of 'X'. 31 | 32 | --- 33 | 34 | > **Assumption of Linear Regression:** 35 | 36 | Linear regression makes several key assumptions about the data and the relationships it models. Violations of these assumptions can affect the validity and reliability of the regression results. Here are the main assumptions of linear regression: 37 | 38 | * **Linearity:** The relationship between the independent variable(s) and the dependent variable is linear. This means that the change in the dependent variable for a unit change in the independent variable is constant. 39 | 40 | * **Independence of Errors:** The errors (residuals) of the model are assumed to be independent of each other. In other words, the error of one observation should not be influenced by the errors of other observations. 41 | 42 | * **Homoscedasticity:** Homoscedasticity refers to the assumption that the variance of the residuals is constant across all levels of the independent variables. This means that the spread of residuals should be roughly the same throughout the range of the predictor variables. 43 | 44 | * **Normality of Errors:** The errors (residuals) should be normally distributed. This assumption is important for hypothesis testing and constructing confidence intervals. 45 | 46 | * **No or Little Multicollinearity:** Multicollinearity occurs when two or more independent variables in the model are highly correlated. This can make it difficult to interpret the individual effects of each variable on the dependent variable. 47 | 48 | * **No Endogeneity:** Endogeneity refers to the situation where an independent variable is correlated with the error term. This can arise due to omitted variable bias or simultaneous causation and can lead to biased and inconsistent coefficient estimates. 49 | 50 | * **No Autocorrelation:** Autocorrelation occurs when the residuals of the model are correlated with each other. This assumption is important when dealing with time series data, where observations are dependent on previous observations. 51 | 52 | * **Constant Variance of Residuals (Homoscedasticity):** Also known as homoscedasticity, this assumption states that the variance of the residuals is consistent across all levels of the independent variables. This is crucial for accurate hypothesis testing and confidence interval estimation. 53 | 54 | * **No Perfect Collinearity:** Perfect collinearity exists when one independent variable can be perfectly predicted by a linear combination of other independent variables. This situation leads to a rank-deficient matrix, making it impossible to estimate unique regression coefficients. 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /30. Day 30 - Simple Linear Regression/SLR Implementation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/30. Day 30 - Simple Linear Regression/SLR Implementation.jpg -------------------------------------------------------------------------------- /30. Day 30 - Simple Linear Regression/Simple Linear Regression Notes .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/30. Day 30 - Simple Linear Regression/Simple Linear Regression Notes .pdf -------------------------------------------------------------------------------- /30. Day 30 - Simple Linear Regression/Simple Linear Regression.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/30. Day 30 - Simple Linear Regression/Simple Linear Regression.pdf -------------------------------------------------------------------------------- /30. Day 30 - Simple Linear Regression/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/30. Day 30 - Simple Linear Regression/download.png -------------------------------------------------------------------------------- /31. Day 31 - Multiple Linear Regression/MLR Implementation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/31. Day 31 - Multiple Linear Regression/MLR Implementation.jpg -------------------------------------------------------------------------------- /31. Day 31 - Multiple Linear Regression/Multiple Linear Regression Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/31. Day 31 - Multiple Linear Regression/Multiple Linear Regression Notes.pdf -------------------------------------------------------------------------------- /31. Day 31 - Multiple Linear Regression/README.md: -------------------------------------------------------------------------------- 1 |

Multiple Linear Regression

2 | 3 | 4 | 5 | 6 | --- 7 | 8 | # Multiple Linear Regression: 9 | 10 | - Models Linear relationship between single Independent continuous variable and multiple Independent Variable. 11 | 12 | - It is Simple Linear Regression extension, takes more than one predictor (Independent) variables to predict 1 target variable. 13 | 14 | 15 | # Implementation Steps: 16 | 17 | 1. **Import libraries :** Import the important libraries like - pandas, numpy and matplotlib for further use. 18 | 19 | 2. **Gather Data :** Then, import the dataset. 20 | 21 | 3. **EDA (Exploratory Data Analysis) :** Handle null/missing values, remove duplicates and encoding of categorical data. 22 | 23 | 4. **Split the dataset :** Firstly, extract Dependent and Independent variables from the dataset. Then, split the data into training and testing data. 24 | 25 | 5. **Training model :** Use LinearRegression( ) to train the model using the data reserved for training the model. 26 | 27 | 6. **Result prediction :** Using the model, predict output for testing data. 28 | 29 | 7. **Model Evaluation :** Make use of R2-Score and mean squared error metrics to find goodness of fit of the model. 30 | 31 | 32 | 33 | # Real-world Application: Student Performance Analysis - 34 | 35 | Imagine predicting student performance based on factors like study time, attendance, and socioeconomic background. Multiple Linear Regression allows us to model these relationships, offering insights for improving academic outcomes. 36 | -------------------------------------------------------------------------------- /32. Day 32 - Classification in ML/Classification in ML.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/32. Day 32 - Classification in ML/Classification in ML.pdf -------------------------------------------------------------------------------- /33. Day 33 - Logistic Regression/Logistic Regression Notes .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/33. Day 33 - Logistic Regression/Logistic Regression Notes .pdf -------------------------------------------------------------------------------- /34. Day 34 - Decision Tree Concept/Decision Tree Handwritten Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/34. Day 34 - Decision Tree Concept/Decision Tree Handwritten Notes.pdf -------------------------------------------------------------------------------- /35. Day 35 - Decision Tree Implementation/Decision Tree Implementation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/35. Day 35 - Decision Tree Implementation/Decision Tree Implementation.pdf -------------------------------------------------------------------------------- /35. Day 35 - Decision Tree Implementation/Decision Tree Implementation_page-0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/35. Day 35 - Decision Tree Implementation/Decision Tree Implementation_page-0001.jpg -------------------------------------------------------------------------------- /35. Day 35 - Decision Tree Implementation/README.md: -------------------------------------------------------------------------------- 1 |

Decision Tree implementation

2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /36. Day 36 - Ensemble Methods/New Text Document.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/36. Day 36 - Ensemble Methods/New Text Document.txt -------------------------------------------------------------------------------- /36. Day 36 - Ensemble Methods/README.md: -------------------------------------------------------------------------------- 1 |

Ensemble Methods

2 | -------------------------------------------------------------------------------- /37. Day 37 - Gradient Boosting/README.md: -------------------------------------------------------------------------------- 1 |

Gadient Boosting

2 | -------------------------------------------------------------------------------- /38. Day 38 - AdaBoost and XGBoost/README.md: -------------------------------------------------------------------------------- 1 |

AdaBoost

2 | 3 | 4 | 5 | --- 6 |

XGBoost

7 | -------------------------------------------------------------------------------- /39. Day 39 - Random Forests Introduction/README.md: -------------------------------------------------------------------------------- 1 | 2 |

Random Forests

3 | -------------------------------------------------------------------------------- /40. Day 40 - Random Forests Implementation/Hyperparameter Tuning.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/40. Day 40 - Random Forests Implementation/Hyperparameter Tuning.pdf -------------------------------------------------------------------------------- /40. Day 40 - Random Forests Implementation/Random Forest Implementation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/40. Day 40 - Random Forests Implementation/Random Forest Implementation.pdf -------------------------------------------------------------------------------- /40. Day 40 - Random Forests Implementation/Random Forest Implementation_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/40. Day 40 - Random Forests Implementation/Random Forest Implementation_page.jpg -------------------------------------------------------------------------------- /41. Day 41 - Decision Tree and Random Forest Example/decision-tree-random-forest-social-network-ads.ipynb: -------------------------------------------------------------------------------- 1 | {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# **Social Network Ads - Decision Tree and Random Forest**","metadata":{}},{"cell_type":"markdown","source":"# **1. Decision Tree**","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.123630Z","iopub.execute_input":"2023-08-27T12:52:50.124071Z","iopub.status.idle":"2023-08-27T12:52:50.165146Z","shell.execute_reply.started":"2023-08-27T12:52:50.124038Z","shell.execute_reply":"2023-08-27T12:52:50.163635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **1. Data Pre-Processing :**","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/social-network-ads/Social_Network_Ads.csv')","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.230094Z","iopub.execute_input":"2023-08-27T12:52:50.230480Z","iopub.status.idle":"2023-08-27T12:52:50.263082Z","shell.execute_reply.started":"2023-08-27T12:52:50.230451Z","shell.execute_reply":"2023-08-27T12:52:50.261546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.268786Z","iopub.execute_input":"2023-08-27T12:52:50.269367Z","iopub.status.idle":"2023-08-27T12:52:50.308402Z","shell.execute_reply.started":"2023-08-27T12:52:50.269321Z","shell.execute_reply":"2023-08-27T12:52:50.306907Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.310025Z","iopub.execute_input":"2023-08-27T12:52:50.310438Z","iopub.status.idle":"2023-08-27T12:52:50.330441Z","shell.execute_reply.started":"2023-08-27T12:52:50.310401Z","shell.execute_reply":"2023-08-27T12:52:50.329521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.tail()","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.332360Z","iopub.execute_input":"2023-08-27T12:52:50.332721Z","iopub.status.idle":"2023-08-27T12:52:50.345061Z","shell.execute_reply.started":"2023-08-27T12:52:50.332692Z","shell.execute_reply":"2023-08-27T12:52:50.343100Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.348313Z","iopub.execute_input":"2023-08-27T12:52:50.348689Z","iopub.status.idle":"2023-08-27T12:52:50.384012Z","shell.execute_reply.started":"2023-08-27T12:52:50.348659Z","shell.execute_reply":"2023-08-27T12:52:50.382513Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = df.drop('Purchased', axis=1)\nY = df['Purchased']","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:52:50.386120Z","iopub.execute_input":"2023-08-27T12:52:50.386888Z","iopub.status.idle":"2023-08-27T12:52:50.395901Z","shell.execute_reply.started":"2023-08-27T12:52:50.386841Z","shell.execute_reply":"2023-08-27T12:52:50.394594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\n\nx_train,x_test,y_train,y_test = train_test_split(X, Y, test_size=0.20, random_state=42)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T12:53:11.510185Z","iopub.execute_input":"2023-08-27T12:53:11.510759Z","iopub.status.idle":"2023-08-27T12:53:11.520812Z","shell.execute_reply.started":"2023-08-27T12:53:11.510707Z","shell.execute_reply":"2023-08-27T12:53:11.519485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **2. Fitting Decision Tree Algorithm using Training Data :**","metadata":{}},{"cell_type":"code","source":"from sklearn.tree import DecisionTreeClassifier","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:05:52.344203Z","iopub.execute_input":"2023-08-27T13:05:52.344649Z","iopub.status.idle":"2023-08-27T13:05:52.351862Z","shell.execute_reply.started":"2023-08-27T13:05:52.344615Z","shell.execute_reply":"2023-08-27T13:05:52.350051Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"classifier = DecisionTreeClassifier(criterion='entropy')\nmodel = classifier.fit(x_train, y_train)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:07:16.544211Z","iopub.execute_input":"2023-08-27T13:07:16.544752Z","iopub.status.idle":"2023-08-27T13:07:16.556419Z","shell.execute_reply.started":"2023-08-27T13:07:16.544707Z","shell.execute_reply":"2023-08-27T13:07:16.554928Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **3. Predicting the Test Set Results :**","metadata":{}},{"cell_type":"code","source":"y_pred = classifier.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:07:55.903974Z","iopub.execute_input":"2023-08-27T13:07:55.904412Z","iopub.status.idle":"2023-08-27T13:07:55.912460Z","shell.execute_reply.started":"2023-08-27T13:07:55.904373Z","shell.execute_reply":"2023-08-27T13:07:55.911329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **4. Evaluate Performance of the Model :**","metadata":{}},{"cell_type":"code","source":"from sklearn.metrics import confusion_matrix, classification_report, accuracy_score","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:10:11.150079Z","iopub.execute_input":"2023-08-27T13:10:11.151219Z","iopub.status.idle":"2023-08-27T13:10:11.156875Z","shell.execute_reply.started":"2023-08-27T13:10:11.151175Z","shell.execute_reply":"2023-08-27T13:10:11.155878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mat = confusion_matrix(y_test, y_pred)\nmat","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:10:13.793913Z","iopub.execute_input":"2023-08-27T13:10:13.794631Z","iopub.status.idle":"2023-08-27T13:10:13.803953Z","shell.execute_reply.started":"2023-08-27T13:10:13.794583Z","shell.execute_reply":"2023-08-27T13:10:13.802790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"report = classification_report(y_test, y_pred)\nprint(report)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:10:17.144182Z","iopub.execute_input":"2023-08-27T13:10:17.144860Z","iopub.status.idle":"2023-08-27T13:10:17.159853Z","shell.execute_reply.started":"2023-08-27T13:10:17.144823Z","shell.execute_reply":"2023-08-27T13:10:17.158271Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"score = accuracy_score(y_test, y_pred)\nprint(score)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:10:20.029196Z","iopub.execute_input":"2023-08-27T13:10:20.029646Z","iopub.status.idle":"2023-08-27T13:10:20.039415Z","shell.execute_reply.started":"2023-08-27T13:10:20.029610Z","shell.execute_reply":"2023-08-27T13:10:20.037741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **5. Plot the Decision Tree :**","metadata":{}},{"cell_type":"code","source":"from sklearn import tree","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:10:56.754432Z","iopub.execute_input":"2023-08-27T13:10:56.754902Z","iopub.status.idle":"2023-08-27T13:10:56.762588Z","shell.execute_reply.started":"2023-08-27T13:10:56.754870Z","shell.execute_reply":"2023-08-27T13:10:56.760757Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize = (10, 15))\ntree.plot_tree(model, filled=True)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:11:32.948789Z","iopub.execute_input":"2023-08-27T13:11:32.949228Z","iopub.status.idle":"2023-08-27T13:11:37.276182Z","shell.execute_reply.started":"2023-08-27T13:11:32.949193Z","shell.execute_reply":"2023-08-27T13:11:37.274711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **2. Random Forest**","metadata":{}},{"cell_type":"markdown","source":"> **1. Fitting Random Forest Classifier on Training Data :**","metadata":{}},{"cell_type":"code","source":"from sklearn.ensemble import RandomForestClassifier","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:17.464670Z","iopub.execute_input":"2023-08-27T13:09:17.465939Z","iopub.status.idle":"2023-08-27T13:09:17.473579Z","shell.execute_reply.started":"2023-08-27T13:09:17.465869Z","shell.execute_reply":"2023-08-27T13:09:17.471178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rfc = RandomForestClassifier(n_estimators = 600)\nrfc.fit(x_train, y_train)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:19.745352Z","iopub.execute_input":"2023-08-27T13:09:19.746154Z","iopub.status.idle":"2023-08-27T13:09:20.890340Z","shell.execute_reply.started":"2023-08-27T13:09:19.746107Z","shell.execute_reply":"2023-08-27T13:09:20.889212Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **2. Predicting the Test Set Results :**","metadata":{}},{"cell_type":"code","source":"y_pred = rfc.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:24.000231Z","iopub.execute_input":"2023-08-27T13:09:24.001711Z","iopub.status.idle":"2023-08-27T13:09:24.084699Z","shell.execute_reply.started":"2023-08-27T13:09:24.001646Z","shell.execute_reply":"2023-08-27T13:09:24.083714Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> **3. Model Evaluation :**","metadata":{}},{"cell_type":"code","source":"from sklearn.metrics import confusion_matrix, classification_report, accuracy_score","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:31.183893Z","iopub.execute_input":"2023-08-27T13:09:31.184332Z","iopub.status.idle":"2023-08-27T13:09:31.190801Z","shell.execute_reply.started":"2023-08-27T13:09:31.184302Z","shell.execute_reply":"2023-08-27T13:09:31.189568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mat = confusion_matrix(y_test, y_pred)\nmat","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:34.904057Z","iopub.execute_input":"2023-08-27T13:09:34.904586Z","iopub.status.idle":"2023-08-27T13:09:34.918589Z","shell.execute_reply.started":"2023-08-27T13:09:34.904551Z","shell.execute_reply":"2023-08-27T13:09:34.917424Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"report = classification_report(y_test, y_pred)\nprint(report)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:39.063965Z","iopub.execute_input":"2023-08-27T13:09:39.064427Z","iopub.status.idle":"2023-08-27T13:09:39.079465Z","shell.execute_reply.started":"2023-08-27T13:09:39.064393Z","shell.execute_reply":"2023-08-27T13:09:39.078467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"score = accuracy_score(y_test, y_pred)\nprint(score)","metadata":{"execution":{"iopub.status.busy":"2023-08-27T13:09:43.283544Z","iopub.execute_input":"2023-08-27T13:09:43.283996Z","iopub.status.idle":"2023-08-27T13:09:43.292284Z","shell.execute_reply.started":"2023-08-27T13:09:43.283963Z","shell.execute_reply":"2023-08-27T13:09:43.290838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} -------------------------------------------------------------------------------- /42. Day 42 - SVM Intro/SVM Introduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/42. Day 42 - SVM Intro/SVM Introduction.pdf -------------------------------------------------------------------------------- /43. Day 43 - Linear and Non-Linear SVM Implementation/SVM Implementation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/43. Day 43 - Linear and Non-Linear SVM Implementation/SVM Implementation.pdf -------------------------------------------------------------------------------- /45. Day 45 - KNN Introduction/KNN Introduction Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/45. Day 45 - KNN Introduction/KNN Introduction Notes.pdf -------------------------------------------------------------------------------- /46. Day 46 - (1 Sept 2023) KNN Implementation/KNN Classification Steps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/46. Day 46 - (1 Sept 2023) KNN Implementation/KNN Classification Steps.jpg -------------------------------------------------------------------------------- /46. Day 46 - (1 Sept 2023) KNN Implementation/KNN Regression Steps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/46. Day 46 - (1 Sept 2023) KNN Implementation/KNN Regression Steps.jpg -------------------------------------------------------------------------------- /46. Day 46 - (1 Sept 2023) KNN Implementation/README.md: -------------------------------------------------------------------------------- 1 | 2 |

KNN Implementation

3 | 4 | - **KNN Classification:** 5 | - IRIS Flower Prediction : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-classification-iris-flower) 6 | - Mushroom Clasification : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-classification-mushroom-classification) 7 | 8 | 9 | 10 | --- 11 | 12 | - **KNN Regression:** 13 | - Employee Salary Prediciton : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-regression-salary-dataset) 14 | - Student Performance Prediction : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-regression-student-performance-prediction) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /47. Day 47 - KNN Hyperparameter Tuning/README.md: -------------------------------------------------------------------------------- 1 | 2 |

KNN Implementation with Hyperparameter Tuning

3 | 4 | 5 | - **KNN Regression:** 6 | - House Price Prediction : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-regr-house-price-prediction-hyperparameter/notebook) 7 | - **KNN Classification:** 8 | - BMI Classification : [Kaggle Notebook](https://www.kaggle.com/code/snehalsanjaymankar/knn-clf-bmi-classification-hyperparameter/notebook) 9 | -------------------------------------------------------------------------------- /48. Day 48 - ML Fundamentals Revision/ML Fundamentals Revision Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/48. Day 48 - ML Fundamentals Revision/ML Fundamentals Revision Notes.pdf -------------------------------------------------------------------------------- /48. Day 48 - ML Fundamentals Revision/Types of Supervised Learning Algo_page-0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/48. Day 48 - ML Fundamentals Revision/Types of Supervised Learning Algo_page-0001.jpg -------------------------------------------------------------------------------- /49. Day 49 - Capstone Project - 5G Resources - MLR, SVR, KNN_R/5g-quality-of-service-all-regression-algorithms.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/49. Day 49 - Capstone Project - 5G Resources - MLR, SVR, KNN_R/5g-quality-of-service-all-regression-algorithms.pdf -------------------------------------------------------------------------------- /49. Day 49 - Capstone Project - 5G Resources - MLR, SVR, KNN_R/compare_MLR_SVR_KNN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/49. Day 49 - Capstone Project - 5G Resources - MLR, SVR, KNN_R/compare_MLR_SVR_KNN.png -------------------------------------------------------------------------------- /50. Day 50 - Capstone Project - Gender Classification - LR, DT, RF, SVM and KNN/Compare_LR_DT_RF_SVM_KNN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/50. Day 50 - Capstone Project - Gender Classification - LR, DT, RF, SVM and KNN/Compare_LR_DT_RF_SVM_KNN.png -------------------------------------------------------------------------------- /50. Day 50 - Capstone Project - Gender Classification - LR, DT, RF, SVM and KNN/gender-classification-lr-dt-rf-svm-and-knn.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/50. Day 50 - Capstone Project - Gender Classification - LR, DT, RF, SVM and KNN/gender-classification-lr-dt-rf-svm-and-knn.pdf -------------------------------------------------------------------------------- /51. Day 51 - Intro to Cross Validation/Cross Validation Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/51. Day 51 - Intro to Cross Validation/Cross Validation Notes.pdf -------------------------------------------------------------------------------- /52. Day 52 - Cross Validation Implementation/k-fold-cross-validation.ipynb: -------------------------------------------------------------------------------- 1 | {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.672293Z","iopub.execute_input":"2023-09-07T14:23:12.672692Z","iopub.status.idle":"2023-09-07T14:23:12.678119Z","shell.execute_reply.started":"2023-09-07T14:23:12.672660Z","shell.execute_reply":"2023-09-07T14:23:12.676940Z"},"trusted":true},"execution_count":21,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/iris-flower-dataset/IRIS.csv')","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.701910Z","iopub.execute_input":"2023-09-07T14:23:12.703039Z","iopub.status.idle":"2023-09-07T14:23:12.716188Z","shell.execute_reply.started":"2023-09-07T14:23:12.703004Z","shell.execute_reply":"2023-09-07T14:23:12.715122Z"},"trusted":true},"execution_count":22,"outputs":[]},{"cell_type":"code","source":"X = df.drop('species', axis=1)\nY = df['species']","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.726328Z","iopub.execute_input":"2023-09-07T14:23:12.727050Z","iopub.status.idle":"2023-09-07T14:23:12.732872Z","shell.execute_reply.started":"2023-09-07T14:23:12.727017Z","shell.execute_reply":"2023-09-07T14:23:12.732074Z"},"trusted":true},"execution_count":23,"outputs":[]},{"cell_type":"code","source":"# Initialize the KFold object\nkf = KFold(n_splits=5, shuffle=True, random_state=42)","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.746551Z","iopub.execute_input":"2023-09-07T14:23:12.747309Z","iopub.status.idle":"2023-09-07T14:23:12.751616Z","shell.execute_reply.started":"2023-09-07T14:23:12.747274Z","shell.execute_reply":"2023-09-07T14:23:12.750814Z"},"trusted":true},"execution_count":24,"outputs":[]},{"cell_type":"code","source":"kf","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.768482Z","iopub.execute_input":"2023-09-07T14:23:12.769431Z","iopub.status.idle":"2023-09-07T14:23:12.776337Z","shell.execute_reply.started":"2023-09-07T14:23:12.769381Z","shell.execute_reply":"2023-09-07T14:23:12.775277Z"},"trusted":true},"execution_count":25,"outputs":[{"execution_count":25,"output_type":"execute_result","data":{"text/plain":"KFold(n_splits=5, random_state=42, shuffle=True)"},"metadata":{}}]},{"cell_type":"code","source":"# Initialize a list to store the accuracy scores for each fold\naccuracy_scores = []","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.792413Z","iopub.execute_input":"2023-09-07T14:23:12.793396Z","iopub.status.idle":"2023-09-07T14:23:12.797456Z","shell.execute_reply.started":"2023-09-07T14:23:12.793360Z","shell.execute_reply":"2023-09-07T14:23:12.796640Z"},"trusted":true},"execution_count":26,"outputs":[]},{"cell_type":"code","source":"for x, y in kf.split(X):\n print(x, y)","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:23:12.799291Z","iopub.execute_input":"2023-09-07T14:23:12.799866Z","iopub.status.idle":"2023-09-07T14:23:12.815405Z","shell.execute_reply.started":"2023-09-07T14:23:12.799835Z","shell.execute_reply":"2023-09-07T14:23:12.814642Z"},"trusted":true},"execution_count":27,"outputs":[{"name":"stdout","text":"[ 0 1 2 3 4 5 6 7 8 10 11 13 14 15 16 17 20 21\n 22 23 24 25 27 28 32 33 34 35 37 38 39 40 41 42 43 44\n 46 47 48 49 50 51 52 53 54 57 58 59 60 61 62 63 65 66\n 67 70 71 72 74 75 77 79 80 81 83 84 85 86 87 88 89 90\n 91 92 93 94 95 96 97 98 99 100 101 102 103 105 106 107 109 111\n 112 113 114 115 116 117 119 120 121 122 123 124 125 126 129 130 133 134\n 135 136 137 138 139 140 142 144 146 147 148 149] [ 9 12 18 19 26 29 30 31 36 45 55 56 64 68 69 73 76 78\n 82 104 108 110 118 127 128 131 132 141 143 145]\n[ 1 2 3 5 6 7 8 9 12 13 14 17 18 19 20 21 23 24\n 25 26 29 30 31 33 34 35 36 37 38 39 41 43 45 46 47 48\n 49 50 52 53 54 55 56 57 58 59 61 62 63 64 68 69 70 71\n 72 73 74 76 77 78 79 80 82 83 84 87 88 89 90 91 92 93\n 94 95 97 98 99 100 101 102 103 104 106 107 108 110 111 112 113 114\n 115 116 117 118 119 120 121 123 124 125 126 127 128 129 130 131 132 134\n 135 136 138 139 140 141 143 144 145 147 148 149] [ 0 4 10 11 15 16 22 27 28 32 40 42 44 51 60 65 66 67\n 75 81 85 86 96 105 109 122 133 137 142 146]\n[ 0 1 2 3 4 6 8 9 10 11 12 13 14 15 16 17 18 19\n 20 21 22 26 27 28 29 30 31 32 36 37 38 40 41 42 44 45\n 46 48 50 51 52 54 55 56 57 58 59 60 61 63 64 65 66 67\n 68 69 71 72 73 74 75 76 78 79 81 82 83 85 86 87 88 89\n 90 91 92 96 98 99 100 102 103 104 105 106 107 108 109 110 112 115\n 116 118 119 120 121 122 124 125 126 127 128 129 130 131 132 133 134 135\n 136 137 139 140 141 142 143 144 145 146 147 149] [ 5 7 23 24 25 33 34 35 39 43 47 49 53 62 70 77 80 84\n 93 94 95 97 101 111 113 114 117 123 138 148]\n[ 0 1 4 5 7 9 10 11 12 14 15 16 18 19 20 21 22 23\n 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42\n 43 44 45 47 48 49 51 52 53 55 56 57 58 60 62 64 65 66\n 67 68 69 70 71 73 74 75 76 77 78 80 81 82 84 85 86 87\n 88 90 91 92 93 94 95 96 97 99 101 102 103 104 105 106 107 108\n 109 110 111 113 114 116 117 118 121 122 123 124 127 128 129 130 131 132\n 133 137 138 140 141 142 143 144 145 146 148 149] [ 2 3 6 8 13 17 38 46 50 54 59 61 63 72 79 83 89 98\n 100 112 115 119 120 125 126 134 135 136 139 147]\n[ 0 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19\n 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40\n 42 43 44 45 46 47 49 50 51 53 54 55 56 59 60 61 62 63\n 64 65 66 67 68 69 70 72 73 75 76 77 78 79 80 81 82 83\n 84 85 86 89 93 94 95 96 97 98 100 101 104 105 108 109 110 111\n 112 113 114 115 117 118 119 120 122 123 125 126 127 128 131 132 133 134\n 135 136 137 138 139 141 142 143 145 146 147 148] [ 1 14 20 21 37 41 48 52 57 58 71 74 87 88 90 91 92 99\n 102 103 106 107 116 121 124 129 130 140 144 149]\n","output_type":"stream"}]},{"cell_type":"code","source":"from sklearn.model_selection import KFold\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.datasets import load_iris\nfrom sklearn.metrics import accuracy_score\n\n# Load a dataset (e.g., Iris dataset)\ndata = load_iris()\nX, y = data.data, data.target\n\n# Define the number of splits (k) for cross-validation\nk = 5\n\n# Initialize the KFold object\nkf = KFold(n_splits=k, shuffle=True, random_state=42)\n\n# Initialize a list to store the accuracy scores for each fold\naccuracy_scores = []\n\n# Perform k-fold cross-validation\nfor train_index, test_index in kf.split(X):\n X_train, X_test = X[train_index], X[test_index]\n y_train, y_test = y[train_index], y[test_index]\n\n # Initialize and train a classifier (e.g., Logistic Regression)\n classifier = LogisticRegression(max_iter=1000)\n classifier.fit(X_train, y_train)\n\n # Make predictions on the test set\n y_pred = classifier.predict(X_test)\n\n # Calculate and store the accuracy score for this fold\n accuracy = accuracy_score(y_test, y_pred)\n accuracy_scores.append(accuracy)\n\n# Calculate the mean and standard deviation of accuracy scores\nmean_accuracy = sum(accuracy_scores) / k\nstd_deviation = (sum((x - mean_accuracy) ** 2 for x in accuracy_scores) / (k - 1)) ** 0.5\n\nprint(\"Accuracy Scores for Each Fold:\", accuracy_scores)\nprint(\"Mean Accuracy:\", mean_accuracy)\nprint(\"Standard Deviation of Accuracy:\", std_deviation)\n","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:24:28.637903Z","iopub.execute_input":"2023-09-07T14:24:28.638324Z","iopub.status.idle":"2023-09-07T14:24:28.769124Z","shell.execute_reply.started":"2023-09-07T14:24:28.638291Z","shell.execute_reply":"2023-09-07T14:24:28.767899Z"},"trusted":true},"execution_count":30,"outputs":[{"name":"stdout","text":"Accuracy Scores for Each Fold: [1.0, 1.0, 0.9333333333333333, 0.9666666666666667, 0.9666666666666667]\nMean Accuracy: 0.9733333333333334\nStandard Deviation of Accuracy: 0.027888667551135844\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} -------------------------------------------------------------------------------- /52. Day 52 - Cross Validation Implementation/stratified-k-fold-cross-validation.ipynb: -------------------------------------------------------------------------------- 1 | {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:25:03.786527Z","iopub.execute_input":"2023-09-07T14:25:03.787001Z","iopub.status.idle":"2023-09-07T14:25:03.792926Z","shell.execute_reply.started":"2023-09-07T14:25:03.786964Z","shell.execute_reply":"2023-09-07T14:25:03.791587Z"},"trusted":true},"execution_count":10,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/iris/Iris.csv')","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:25:03.795361Z","iopub.execute_input":"2023-09-07T14:25:03.795870Z","iopub.status.idle":"2023-09-07T14:25:03.816087Z","shell.execute_reply.started":"2023-09-07T14:25:03.795827Z","shell.execute_reply":"2023-09-07T14:25:03.814839Z"},"trusted":true},"execution_count":11,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import StratifiedKFold\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.datasets import load_iris\nfrom sklearn.metrics import accuracy_score\n\n# Load a dataset (e.g., Iris dataset)\ndata = load_iris()\nX, y = data.data, data.target\n\n# Define the number of splits (k) for stratified k-fold cross-validation\nk = 5\n\n# Initialize the StratifiedKFold object\nskf = StratifiedKFold(n_splits=k, shuffle=True, random_state=42)\n\n# Initialize a list to store the accuracy scores for each fold\naccuracy_scores = []\n\n# Perform stratified k-fold cross-validation\nfor train_index, test_index in skf.split(X, y):\n X_train, X_test = X[train_index], X[test_index]\n y_train, y_test = y[train_index], y[test_index]\n\n # Initialize and train a classifier (e.g., Logistic Regression)\n classifier = LogisticRegression(max_iter=1000)\n classifier.fit(X_train, y_train)\n\n # Make predictions on the test set\n y_pred = classifier.predict(X_test)\n\n # Calculate and store the accuracy score for this fold\n accuracy = accuracy_score(y_test, y_pred)\n accuracy_scores.append(accuracy)\n\n# Calculate the mean and standard deviation of accuracy scores\nmean_accuracy = sum(accuracy_scores) / k\nstd_deviation = (sum((x - mean_accuracy) ** 2 for x in accuracy_scores) / (k - 1)) ** 0.5\n\nprint(\"Accuracy Scores for Each Fold:\", accuracy_scores)\nprint(\"Mean Accuracy:\", mean_accuracy)\nprint(\"Standard Deviation of Accuracy:\", std_deviation)\n","metadata":{"execution":{"iopub.status.busy":"2023-09-07T14:25:21.666639Z","iopub.execute_input":"2023-09-07T14:25:21.667082Z","iopub.status.idle":"2023-09-07T14:25:21.809314Z","shell.execute_reply.started":"2023-09-07T14:25:21.667047Z","shell.execute_reply":"2023-09-07T14:25:21.808196Z"},"trusted":true},"execution_count":14,"outputs":[{"name":"stdout","text":"Accuracy Scores for Each Fold: [1.0, 0.9666666666666667, 0.9333333333333333, 1.0, 0.9333333333333333]\nMean Accuracy: 0.9666666666666668\nStandard Deviation of Accuracy: 0.033333333333333326\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} -------------------------------------------------------------------------------- /54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction Techniques.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction Techniques.pdf -------------------------------------------------------------------------------- /54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction Techniques_pages-to-jpg-0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction Techniques_pages-to-jpg-0001.jpg -------------------------------------------------------------------------------- /54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/54. Day 54 - Dimensionality Reduction Intro/Dimensionality Reduction.pdf -------------------------------------------------------------------------------- /55. Day 55 - Intro to PCA/PCA Intro Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/55. Day 55 - Intro to PCA/PCA Intro Notes.pdf -------------------------------------------------------------------------------- /55. Day 55 - Intro to PCA/README.md: -------------------------------------------------------------------------------- 1 |

Principal Component Analysis (PCA)

2 | 3 | - Principal Component Analysis is an unsupervised learning algorithm that is used for the dimensionality reduction in Machine Learning. 4 | 5 | - It is a statistical process that converts the observations of correlated features into a set of linearly uncorrelated features with the help of orthogonal transformation. These new transformed features are called the **Principal Components**. 6 | 7 | - It is one of the popular tools that is used for exploratory data analysis and predictive modeling. 8 | 9 | - Some real-world applications of PCA are **image processing, movie recommendation system, optimizing the power allocation in various communication channels**. 10 | 11 | 12 | ### **PCA algorithm is based on some mathematical concepts such as :** 13 | - Variance and Covariance 14 | - Eigenvalues and Eigen factors 15 | 16 | --- 17 | 18 | ### **Some common terms used in PCA algorithm :** 19 | - **Dimensionality:** It is the number of features or variables present in the given dataset. More easily, it is the number of columns present in the dataset. 20 | - **Correlation:** It signifies that how strongly two variables are related to each other. Such as if one changes, the other variable also gets changed. The correlation value ranges from -1 to +1. Here, -1 occurs if variables are inversely proportional to each other, and +1 indicates that variables are directly proportional to each other. 21 | - **Orthogonal:** It defines that variables are not correlated to each other, and hence the correlation between the pair of variables is zero. 22 | - **Eigenvectors:** If there is a square matrix M, and a non-zero vector v is given. Then v will be eigenvector if Av is the scalar multiple of v. 23 | - **Covariance Matrix:** A matrix containing the covariance between the pair of variables is called the Covariance Matrix. 24 | 25 | --- 26 | 27 | ### **Uses of PCA :** 28 | PCA is a widely used technique in data analysis and has a variety of applications, including: 29 | 30 | - **Data compression:** PCA can be used to reduce the dimensionality of high-dimensional datasets, making them easier to store and analyze. 31 | - **Feature extraction:** PCA can be used to identify the most important features in a dataset, which can be used to build predictive models. 32 | - **Visualization:** PCA can be used to visualize high-dimensional data in two or three dimensions, making it easier to understand and interpret. 33 | - **Data pre-processing:** PCA can be used as a pre-processing step for other machine learning algorithms, such as clustering and classification. 34 | 35 | --- 36 | 37 | ### **Advantages of Principal Component Analysis :** 38 | 39 | - **Dimensionality Reduction:** Principal Component Analysis is a popular technique used for dimensionality reduction, which is the process of reducing the number of variables in a dataset. 40 | - **Feature Selection:** Principal Component Analysis can be used for feature selection, which is the process of selecting the most important variables in a dataset. This is useful in machine learning, where the number of variables can be very large, and it is difficult to identify the most important variables. 41 | - **Data Visualization:** Principal Component Analysis can be used for data visualization. By reducing the number of variables, PCA can plot high-dimensional data in two or three dimensions, making it easier to interpret. 42 | - **Multicollinearity:** Principal Component Analysis can be used to deal with multicollinearity, which is a common problem in a regression analysis where two or more independent variables are highly correlated. PCA can help identify the underlying structure in the data and create new, uncorrelated variables that can be used in the regression model. 43 | - **Noise Reduction:** Principal Component Analysis can be used to reduce the noise in data. By removing the principal components with low variance, which are assumed to represent noise, Principal Component Analysis can improve the signal-to-noise ratio and make it easier to identify the underlying structure in the data. 44 | - **Data Compression:** Principal Component Analysis can be used for data compression. By representing the data using a smaller number of principal components, which capture most of the variation in the data, PCA can reduce the storage requirements and speed up processing. 45 | - **Outlier Detection:** Principal Component Analysis can be used for outlier detection. Outliers are data points that are significantly different from the other data points in the dataset. Principal Component Analysis can identify these outliers by looking for data points that are far from the other points in the principal component space. 46 | 47 | --- 48 | 49 | ### **Limitations of Principal Component Analysis :** 50 | 51 | - **Interpretation of Principal Components:** The principal components created by Principal Component Analysis are linear combinations of the original variables, and it is often difficult to interpret them in terms of the original variables. This can make it difficult to explain the results of PCA to others. 52 | - **Data Scaling:** Principal Component Analysis is sensitive to the scale of the data. If the data is not properly scaled, then PCA may not work well. Therefore, it is important to scale the data before applying Principal Component Analysis. 53 | - **Information Loss:** Principal Component Analysis can result in information loss. While Principal Component Analysis reduces the number of variables, it can also lead to loss of information. The degree of information loss depends on the number of principal components selected. Therefore, it is important to carefully select the number of principal components to retain. 54 | - **Non-linear Relationships:** Principal Component Analysis assumes that the relationships between variables are linear. However, if there are non-linear relationships between variables, Principal Component Analysis may not work well. 55 | - **Computational Complexity:** Computing Principal Component Analysis can be computationally expensive for large datasets. This is especially true if the number of variables in the dataset is large. 56 | - **Overfitting:** Principal Component Analysis can sometimes result in overfitting, which is when the model fits the training data too well and performs poorly on new data. This can happen if too many principal components are used or if the model is trained on a small dataset. 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /56. Day 56 - Step in PCA/README.md: -------------------------------------------------------------------------------- 1 |

Steps in PCA (Principal Component Analysis)

2 | 3 | 4 | ### **Step 1 : Covariance Matrix Computation** 5 | 6 | Covariance measures the strength of joint variability between two or more variables, indicating how much they change in relation to each other. To find the covariance we can use the formula: 7 | 8 | 9 | 10 | The value of covariance can be positive, negative, or zeros. 11 | 12 | - Positive: As the x1 increases x2 also increases. 13 | - Negative: As the x1 increases x2 also decreases. 14 | - Zeros: No direct relation 15 | 16 | 17 | --- 18 | 19 | 20 | ### **Step 2 : Compute Eigenvalues and Eigenvectors of Covariance Matrix to Identify Principal Components** 21 | 22 | Let A be a square matrix with n*n dimensions and X be a non-zero vector for which 23 | 24 | 25 | 26 | for some scalar values \lambda . then \lambda is known as the eigenvalue of matrix A and X is known as the eigenvector of matrix A for the corresponding eigenvalue. 27 | 28 | It can also be written as : 29 | 30 | 31 | 32 | where I am the identity matrix of the same shape as matrix A. And the above conditions will be true only if (A - \lambda I) will be non-invertible (i.e. singular matrix). That means, 33 | 34 | 35 | 36 | From the above equation, we can find the eigenvalues \lambda, and therefore corresponding eigenvector can be found using the equation AX = \lambda X . 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /56. Day 56 - Step in PCA/Steps in PCA Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/56. Day 56 - Step in PCA/Steps in PCA Notes.pdf -------------------------------------------------------------------------------- /56. Day 56 - Step in PCA/eig1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /56. Day 56 - Step in PCA/eig2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /56. Day 56 - Step in PCA/eig3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /57. Day 57 - PCA Solved Example/PCA Solved Example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/57. Day 57 - PCA Solved Example/PCA Solved Example.pdf -------------------------------------------------------------------------------- /58. Day 58 - PCA Implementation/PCA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/58. Day 58 - PCA Implementation/PCA.pdf -------------------------------------------------------------------------------- /59. Day 59 - Feature Selection Intro/Feature Selection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/59. Day 59 - Feature Selection Intro/Feature Selection.pdf -------------------------------------------------------------------------------- /59. Day 59 - Feature Selection Intro/Feature selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/59. Day 59 - Feature Selection Intro/Feature selection.png -------------------------------------------------------------------------------- /60. Day 60 - Feature Selection - Filter Methods/Filter Methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/60. Day 60 - Feature Selection - Filter Methods/Filter Methods.pdf -------------------------------------------------------------------------------- /60. Day 60 - Feature Selection - Filter Methods/feature-selection-filter-methods.ipynb: -------------------------------------------------------------------------------- 1 | {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nfrom sklearn.feature_selection import SelectKBest, f_classif, mutual_info_classif, chi2\nfrom sklearn.datasets import load_iris\n","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:01:02.460299Z","iopub.execute_input":"2023-09-15T07:01:02.460681Z","iopub.status.idle":"2023-09-15T07:01:05.197876Z","shell.execute_reply.started":"2023-09-15T07:01:02.460646Z","shell.execute_reply":"2023-09-15T07:01:05.196391Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"# Load dataset\ndata = load_iris()\nX = pd.DataFrame(data.data, columns=data.feature_names)\ny = data.target\n","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:01:05.200315Z","iopub.execute_input":"2023-09-15T07:01:05.200880Z","iopub.status.idle":"2023-09-15T07:01:05.218731Z","shell.execute_reply.started":"2023-09-15T07:01:05.200824Z","shell.execute_reply":"2023-09-15T07:01:05.217387Z"},"trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"code","source":"# Method 1: Correlation-based Feature Selection (for classification)\n# Calculate feature-target correlation\ncorrelation_scores = X.corrwith(pd.Series(y, name=\"Target\"))\ncorrelation_scores = correlation_scores.abs().sort_values(ascending=False)\n# Select the top 'k' features based on correlation (e.g., top 3)\nk = 3\nselected_features_corr = correlation_scores.index[:k]\n\nprint(selected_features_corr)\n","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:11:04.666409Z","iopub.execute_input":"2023-09-15T07:11:04.666897Z","iopub.status.idle":"2023-09-15T07:11:04.681264Z","shell.execute_reply.started":"2023-09-15T07:11:04.666856Z","shell.execute_reply":"2023-09-15T07:11:04.680193Z"},"trusted":true},"execution_count":13,"outputs":[{"name":"stdout","text":"Index(['petal width (cm)', 'petal length (cm)', 'sepal length (cm)'], dtype='object')\n","output_type":"stream"}]},{"cell_type":"code","source":"# Method 2: Mutual Information-based Feature Selection (for classification)\n# Select the top 'k' features based on mutual information (e.g., top 3)\nk = 3\nselected_features_mi = SelectKBest(score_func=mutual_info_classif, k=k).fit(X, y)\nselected_features_mi = X.columns[selected_features_mi.get_support()]\n\nprint(selected_features_mi)","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:11:16.481071Z","iopub.execute_input":"2023-09-15T07:11:16.481480Z","iopub.status.idle":"2023-09-15T07:11:16.509443Z","shell.execute_reply.started":"2023-09-15T07:11:16.481451Z","shell.execute_reply":"2023-09-15T07:11:16.508272Z"},"trusted":true},"execution_count":14,"outputs":[{"name":"stdout","text":"Index(['sepal length (cm)', 'petal length (cm)', 'petal width (cm)'], dtype='object')\n","output_type":"stream"}]},{"cell_type":"code","source":"# Chi-square Test\n\nfrom sklearn.feature_selection import SelectKBest, chi2\n\nchi2_features = SelectKBest(chi2, k=3)\nX_kbest_features = chi2_features.fit_transform(X, y)\n\nprint(X.shape)\nprint(X_kbest_features.shape)\n","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:01:05.307526Z","iopub.execute_input":"2023-09-15T07:01:05.308299Z","iopub.status.idle":"2023-09-15T07:01:05.334716Z","shell.execute_reply.started":"2023-09-15T07:01:05.308254Z","shell.execute_reply":"2023-09-15T07:01:05.333456Z"},"trusted":true},"execution_count":6,"outputs":[{"name":"stdout","text":"(150, 4)\n(150, 3)\n","output_type":"stream"}]},{"cell_type":"code","source":"# Fisher's Score\n\n# Perform Fisher's Score feature selection\nk = 2 # Number of top features to select\nf_score_selector = SelectKBest(score_func=f_classif, k=k, )\nX_new = f_score_selector.fit_transform(X, y)\n\n# Get the indices of the selected features\nselected_feature_indices = f_score_selector.get_support(indices=True)\n\n# Print the selected features and their indices\nselected_features = [data.feature_names[i] for i in selected_feature_indices]\nprint(\"Selected Features:\")\nprint(selected_features)\n","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:02:44.426576Z","iopub.execute_input":"2023-09-15T07:02:44.427062Z","iopub.status.idle":"2023-09-15T07:02:44.442405Z","shell.execute_reply.started":"2023-09-15T07:02:44.427024Z","shell.execute_reply":"2023-09-15T07:02:44.441104Z"},"trusted":true},"execution_count":8,"outputs":[{"name":"stdout","text":"Selected Features:\n['petal length (cm)', 'petal width (cm)']\n","output_type":"stream"}]},{"cell_type":"code","source":"# Missing Value Ration\n\nfrom sklearn.impute import SimpleImputer\n\n# Calculate the missing value ratio for each feature\nmissing_value_threshold = 0.3 # Set your desired threshold for missing values (e.g., 30%)\nmissing_value_ratio = X.isnull().mean()\n\n# Select features with missing value ratio below the threshold\nselected_features = X.columns[missing_value_ratio < missing_value_threshold]\n\n# Impute missing values if needed (e.g., using mean imputation)\nimputer = SimpleImputer(strategy='mean')\nX[selected_features] = imputer.fit_transform(X[selected_features])\n\n# Print the selected features\nprint(\"Selected Features:\")\nprint(selected_features)","metadata":{"execution":{"iopub.status.busy":"2023-09-15T07:09:43.046668Z","iopub.execute_input":"2023-09-15T07:09:43.047080Z","iopub.status.idle":"2023-09-15T07:09:43.080307Z","shell.execute_reply.started":"2023-09-15T07:09:43.047048Z","shell.execute_reply":"2023-09-15T07:09:43.079247Z"},"trusted":true},"execution_count":10,"outputs":[{"name":"stdout","text":"Selected Features:\nIndex(['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)',\n 'petal width (cm)'],\n dtype='object')\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} -------------------------------------------------------------------------------- /61. Day 61 - Feature Selection - Wrapper Methods/Wrapper Methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/61. Day 61 - Feature Selection - Wrapper Methods/Wrapper Methods.pdf -------------------------------------------------------------------------------- /62. Day 62 - Feature Selection - Embedded Methods/Embedded Methods Feature Selection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/62. Day 62 - Feature Selection - Embedded Methods/Embedded Methods Feature Selection.pdf -------------------------------------------------------------------------------- /64. Day 64 - Used Car Price Prediction using SVR/used-car-price-prediction-svr.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/64. Day 64 - Used Car Price Prediction using SVR/used-car-price-prediction-svr.pdf -------------------------------------------------------------------------------- /65. Day 65 - Movies Recommendation/movie-recommendation-with-gridsearch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/65. Day 65 - Movies Recommendation/movie-recommendation-with-gridsearch.pdf -------------------------------------------------------------------------------- /66. Day 66 - SLR on Insurance Dataset/slr-notebook.ipynb: -------------------------------------------------------------------------------- 1 | {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd \nimport numpy as np \nimport matplotlib.pyplot as plt ","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.399507Z","iopub.execute_input":"2023-09-21T17:17:07.399895Z","iopub.status.idle":"2023-09-21T17:17:07.782895Z","shell.execute_reply.started":"2023-09-21T17:17:07.399864Z","shell.execute_reply":"2023-09-21T17:17:07.781650Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/insurance-dataset-simple-linear-regression/simplelinearregression.csv\")\nX = df.iloc[:,:-1].values \ny = df.iloc[:,-1].values\ndf","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.784937Z","iopub.execute_input":"2023-09-21T17:17:07.785488Z","iopub.status.idle":"2023-09-21T17:17:07.820630Z","shell.execute_reply.started":"2023-09-21T17:17:07.785449Z","shell.execute_reply":"2023-09-21T17:17:07.819623Z"},"trusted":true},"execution_count":2,"outputs":[{"execution_count":2,"output_type":"execute_result","data":{"text/plain":" Age Premium\n0 18 10000\n1 22 15000\n2 23 18000\n3 26 21000\n4 28 24000\n5 31 26500\n6 33 27000","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
AgePremium
01810000
12215000
22318000
32621000
42824000
53126500
63327000
\n
"},"metadata":{}}]},{"cell_type":"code","source":"print(X)","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.821976Z","iopub.execute_input":"2023-09-21T17:17:07.822352Z","iopub.status.idle":"2023-09-21T17:17:07.828117Z","shell.execute_reply.started":"2023-09-21T17:17:07.822325Z","shell.execute_reply":"2023-09-21T17:17:07.826790Z"},"trusted":true},"execution_count":3,"outputs":[{"name":"stdout","text":"[[18]\n [22]\n [23]\n [26]\n [28]\n [31]\n [33]]\n","output_type":"stream"}]},{"cell_type":"code","source":"print(y)","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.830938Z","iopub.execute_input":"2023-09-21T17:17:07.831345Z","iopub.status.idle":"2023-09-21T17:17:07.842168Z","shell.execute_reply.started":"2023-09-21T17:17:07.831310Z","shell.execute_reply":"2023-09-21T17:17:07.840969Z"},"trusted":true},"execution_count":4,"outputs":[{"name":"stdout","text":"[10000 15000 18000 21000 24000 26500 27000]\n","output_type":"stream"}]},{"cell_type":"code","source":"y = y.reshape(len(y),1)\nprint(y)","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.843822Z","iopub.execute_input":"2023-09-21T17:17:07.844207Z","iopub.status.idle":"2023-09-21T17:17:07.853538Z","shell.execute_reply.started":"2023-09-21T17:17:07.844171Z","shell.execute_reply":"2023-09-21T17:17:07.852646Z"},"trusted":true},"execution_count":5,"outputs":[{"name":"stdout","text":"[[10000]\n [15000]\n [18000]\n [21000]\n [24000]\n [26500]\n [27000]]\n","output_type":"stream"}]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nX_train, X_test, y_train, y_test = train_test_split (X,y, test_size=0.2, random_state =0)","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:07.854861Z","iopub.execute_input":"2023-09-21T17:17:07.855709Z","iopub.status.idle":"2023-09-21T17:17:09.267655Z","shell.execute_reply.started":"2023-09-21T17:17:07.855681Z","shell.execute_reply":"2023-09-21T17:17:09.265798Z"},"trusted":true},"execution_count":6,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split, cross_val_score\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score\n\n# Create a list of regression models\nmodels = [\n (\"Linear Regression\", LinearRegression()),\n (\"Decision Tree Regression\", DecisionTreeRegressor(random_state=42)),\n (\"Random Forest Regression\", RandomForestRegressor(random_state=42))\n]\nmae_values = []\nmse_values = []\nrmse_values = []\n# Iterate through the models, train, and evaluate them\nfor model_name, model in models:\n # Train the model\n model.fit(X_train, y_train)\n \n # Make predictions\n y_pred = model.predict(X_test)\n \n # Calculate evaluation metrics\n mae = mean_absolute_error(y_test, y_pred)\n mse = mean_squared_error(y_test, y_pred)\n rmse = np.sqrt(mse)\n r2 = r2_score(y_test, y_pred)\n \n # Print the results\n print(f\"Model: {model_name}\")\n print(f\"Mean Absolute Error (MAE): {mae:.2f}\")\n print(f\"Mean Squared Error (MSE): {mse:.2f}\")\n print(f\"Root Mean Squared Error (RMSE): {rmse:.2f}\")\n print(f\"R-squared (R2) Score: {r2:.2f}\")\n print(\"-\" * 40)\n\n\n ","metadata":{"execution":{"iopub.status.busy":"2023-09-21T17:17:09.273514Z","iopub.execute_input":"2023-09-21T17:17:09.274146Z","iopub.status.idle":"2023-09-21T17:17:09.926838Z","shell.execute_reply.started":"2023-09-21T17:17:09.274104Z","shell.execute_reply":"2023-09-21T17:17:09.925487Z"},"trusted":true},"execution_count":7,"outputs":[{"name":"stdout","text":"Model: Linear Regression\nMean Absolute Error (MAE): 2086.54\nMean Squared Error (MSE): 4919031.07\nRoot Mean Squared Error (RMSE): 2217.89\nR-squared (R2) Score: 0.76\n----------------------------------------\nModel: Decision Tree Regression\nMean Absolute Error (MAE): 1750.00\nMean Squared Error (MSE): 4625000.00\nRoot Mean Squared Error (RMSE): 2150.58\nR-squared (R2) Score: 0.77\n----------------------------------------\nModel: Random Forest Regression\nMean Absolute Error (MAE): 1870.00\nMean Squared Error (MSE): 3497300.00\nRoot Mean Squared Error (RMSE): 1870.11\nR-squared (R2) Score: 0.83\n----------------------------------------\n","output_type":"stream"},{"name":"stderr","text":"/tmp/ipykernel_32/276533376.py:19: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n model.fit(X_train, y_train)\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} -------------------------------------------------------------------------------- /66. Day 66 - SLR on Insurance Dataset/slr-notebook.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/66. Day 66 - SLR on Insurance Dataset/slr-notebook.pdf -------------------------------------------------------------------------------- /67. Day 67 - Linear Regression Salary Dataset/salary-dataset-of-busssiness.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/67. Day 67 - Linear Regression Salary Dataset/salary-dataset-of-busssiness.pdf -------------------------------------------------------------------------------- /68. Day 68 - EDA on Gym Exercise Dataset/gym-exercises-eda.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/68. Day 68 - EDA on Gym Exercise Dataset/gym-exercises-eda.pdf -------------------------------------------------------------------------------- /69. Day 69 - EDA on Life Expectations Dataset/life-expectancy-eda.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/69. Day 69 - EDA on Life Expectations Dataset/life-expectancy-eda.pdf -------------------------------------------------------------------------------- /70. Day 70 - EDA on Student Dropout/predict-student-s-drop.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/70. Day 70 - EDA on Student Dropout/predict-student-s-drop.pdf -------------------------------------------------------------------------------- /71. Day 71 - Intro to Clustering/Clustering Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/71. Day 71 - Intro to Clustering/Clustering Intro.pdf -------------------------------------------------------------------------------- /72. Day 72 - Clustering Algorithms/Clustering Algorithm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/72. Day 72 - Clustering Algorithms/Clustering Algorithm.pdf -------------------------------------------------------------------------------- /73. Day 73 - K-means Implementation/k-means-customer-clustering.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/73. Day 73 - K-means Implementation/k-means-customer-clustering.pdf -------------------------------------------------------------------------------- /74. Day 74 - K-Means Credit Card Clustering/k-means-credit-card-clustering.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/74. Day 74 - K-Means Credit Card Clustering/k-means-credit-card-clustering.pdf -------------------------------------------------------------------------------- /75. Day 75 - Visualize Clusters Exercise/results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/75. Day 75 - Visualize Clusters Exercise/results.png -------------------------------------------------------------------------------- /75. Day 75 - Visualize Clusters Exercise/visualize-clustering-exercises.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/75. Day 75 - Visualize Clusters Exercise/visualize-clustering-exercises.pdf -------------------------------------------------------------------------------- /76. Day 76 - Hierarchical Clustering/online-retail-k-means-hierarchical-clustering.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/76. Day 76 - Hierarchical Clustering/online-retail-k-means-hierarchical-clustering.pdf -------------------------------------------------------------------------------- /77. Day 77 - Hierarchical Clustering/Hierarchical clustering.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/77. Day 77 - Hierarchical Clustering/Hierarchical clustering.pdf -------------------------------------------------------------------------------- /data_science.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mankarsnehal/100-Days-of-Code-Data-Science/1b86fd3b2b385ef6b007ca4943af18655360c5bf/data_science.jpg --------------------------------------------------------------------------------