Machine Learning Using Python Notes
Machine Learning Using Python Notes
Machine Learning
Using Python
Summary
Featuring Inside:
• In-Depth Theory & Concepts
• 30+ Long-Form Q&A
• 12+ Detailed Exam-Style Case Studies
• Python Code Implementations
2
Contents
1
Chapter 1
• Automation of Tasks: ML can automate repetitive, data-heavy tasks, saving human time.
• Continuous Improvement: As ML algorithms process more data, they become more ac-
curate. They learn from their mistakes.
2
• Discovering Hidden Patterns: It can find trends that are not immediately obvious to hu-
man analysts.
• Data Quality: ”Garbage in, garbage out.” If the data is messy, incomplete, or biased, the
ML model will make bad predictions.
• Time and Resources: Training complex models requires a lot of time and powerful com-
puters (GPUs).
• Overfitting and Underfitting: Overfitting happens when a model learns the training data
*too* well (memorizes it) but fails on new data. Underfitting happens when the model is
too simple to learn anything useful.
• Interpretability: Some complex models (like Deep Neural Networks) act like ”black boxes.”
It is hard to explain *why* they made a certain decision.
3
Module 1 Summary Report
• Cons: Heavy reliance on high-quality data, computational costs, and the risk of over-
fitting.
Q4: What role does Data Quality play in the success of an ML model?
Answer: Data Quality is the most critical factor. ML models learn purely based on the data
fed into them. If the data is biased, contains missing values, or has incorrect labels (”Garbage
In”), the resulting model will naturally produce inaccurate, biased, and unreliable predictions
(”Garbage Out”), regardless of how advanced the mathematical algorithm is.
Q5: Explain why Machine Learning has seen a massive surge in popularity in the last
decade compared to earlier years.
Answer: The surge is driven by three converging factors: 1) Big Data: The internet boom cre-
ated massive datasets required to train accurate models. 2) Computing Power: The advent of
affordable, high-performance GPUs allowed computers to process parallel matrix math quickly.
3) Algorithmic Advancements: Open-source libraries (like Scikit-Learn and TensorFlow) made
advanced algorithms highly accessible.
Q6: Is Machine Learning the optimal solution for all software engineering problems?
Justify your answer.
Answer: No. ML is resource-heavy, probabilistic (not 100% certain), and complex. For systems
with clear, deterministic, and static mathematical rules (like calculating standard income tax,
4
sorting a database, or running a payroll system), traditional programming is significantly faster,
cheaper, and 100% reliable. ML should be reserved for pattern recognition and complex predic-
tive tasks.
Q8: What is meant by the ”Interpretability” challenge (The Black Box problem) in ML?
Answer: Interpretability refers to the ability to explain *why* an ML model made a specific
decision. For complex algorithms like Deep Neural Networks, the math involves millions of
hidden calculations. If an AI denies a user a loan or misdiagnoses a patient, it is incredibly
difficult for engineers to open the ”black box” and explain the exact logic behind that failure.
5
Module 1: Exam-Style Case Studies (5-8 Marks)
Scenario: A major national bank currently relies on 50 human loan officers to manually
review applicant data (Income, Credit Score, Years Employed, Existing Debt) to decide
whether to ’Approve’ or ’Reject’ personal loan applications. The process is slow and in-
consistent. The bank’s IT director wants to replace this manual review with a Machine
Learning system trained on 10 years of historical banking data.
Questions:
(a) Identify the specific type of Machine Learning problem this represents (Supervised
vs. Unsupervised) and justify your choice. (2 Marks)
(b) Identify the ’Features’ and the ’Target Label’ in this scenario. (2 Marks)
(c) If the historical data provided to the system contains a bias where officers unfairly
rejected applications from a specific postal code, what will happen to the ML model?
What is this challenge called? (4 Marks)
Detailed Answer:
(b) Features (Inputs): Income, Credit Score, Years Employed, and Existing Debt. Target
Label (Output): The final decision (’Approve’ or ’Reject’).
(c) If the training data contains human bias, the ML model will learn and replicate that
exact bias. It will automatically start rejecting perfectly qualified applicants simply
because they live in that postal code. This highlights the Data Quality Challenge
(”Garbage In, Garbage Out”), proving that models are not inherently objective; they
simply mirror the flaws in their training data.
(b) What specific Machine Learning approach and sub-category must be used here to
help the marketing team? Explain how it will work. (4 Marks)
Detailed Answer:
(a) Supervised Learning is inappropriate because it requires a ”Target Label” (an answer
key) to train on. The startup has raw user statistics but no pre-existing categories or
labels defining what type of customer each user is.
6
(b) The startup must use Unsupervised Learning, specifically Clustering. Because
the algorithm is not given an answer key, it will autonomously analyze the multi-
dimensional data (click rates, time, cart value) and group users together based en-
tirely on mathematical similarities. For example, it might naturally cluster users into
”High-spending quick shoppers” and ”Low-spending slow browsers,” allowing the
marketing team to target them effectively.
Scenario: A software engineer builds an ML model to filter out Spam emails. To train the
model quickly, the engineer downloads a dataset containing 9,900 examples of malicious
Spam emails and only 100 examples of normal, safe emails. The model is deployed to a
corporate office.
Questions:
(a) When deployed to the corporate office, what critical error is this model likely to make
repeatedly? (3 Marks)
(b) Relate this failure to a specific Machine Learning challenge discussed in Module 1.
(3 Marks)
Detailed Answer:
(a) The model is highly likely to suffer from an extreme rate of False Positives—it will
incorrectly flag and delete highly important, safe corporate emails, sending them to
the Spam folder.
(b) This failure is a classic example of poor Data Quality and Imbalance. Because 99%
of its training data was spam, the model effectively learned that ”almost everything
is spam.” It did not see enough diverse examples of normal emails to learn their
patterns. To fix this, the engineer must retrain the model with a balanced dataset
(e.g., 5,000 Spam and 5,000 Normal emails).
Scenario: Zillow wants to create a ”Zestimate” tool. When a user uploads a new house
listing with its Square Footage, Number of Bathrooms, and Age of the Property, the ML
tool instantly provides an estimated final selling price (e.g., $452,500).
Questions:
(a) Is this a Classification task or a Regression task? Provide a detailed technical justifi-
cation for your answer. (5 Marks)
Detailed Answer:
(a) This is strictly a Regression task. In Machine Learning, Classification is used when
the desired output is a discrete category or class (e.g., categorizing the house as
simply ”Cheap”, ”Average”, or ”Expensive”). Regression is used when the desired
output is a continuous numerical value. Since the Zestimate tool must output an
exact, continuous dollar amount (like $452,500) from an infinite range of possible
numbers, it utilizes Supervised Regression algorithms.
7
Chapter 2
8
Package Primary Use Case
NumPy Stands for Numerical Python. Used for fast mathematical operations on multi-
dimensional arrays and matrices.
Pandas The go-to library for data manipulation. It provides ’DataFrames’ (like Excel
tables in code) to easily read, filter, and modify data.
Matplotlib Used for creating static, animated, and interactive data visualizations (charts,
graphs).
Scikit-Learn The main library for classical Machine Learning algorithms (regression, classi-
fication, clustering).
2. Encoding Categorical Data: ML models only understand numbers. We must convert text
categories (like ”Red”, ”Green”, ”Blue”) into numerical columns using pd.get_dummies().
# 1. Load Data
df = pd. read_csv ('dataset .csv ')
# 2. Treat Missing Values (Fill empty age fields with average age)
df['Age ']. fillna (df['Age ']. mean (), inplace =True)
2.5 Classification in ML
Classification is a predictive modeling task where the goal is to predict a discrete category or class
for a given input. It is one of the most common applications of Machine Learning.
• Binary Classification: Predicting between exactly two categories (e.g., predicting if an
Email is ’Spam’ or ’Not Spam’).
9
• Centroid-based Clustering: Organizes data into non-hierarchical clusters around central
points (e.g., K-Means).
• Density-based Clustering: Connects areas of high data density into clusters, ignoring
outliers (e.g., DBSCAN).
2. Regression: Predicting a continuous numerical value (e.g., predicting the exact price of a
house).
2. Dimensionality Reduction: Reducing the number of variables to simplify data while re-
taining essential information (e.g., Principal Component Analysis - PCA).
10
Module 2 Summary Report
• Ecosystem: Python is dominant due to powerful libraries like Pandas (data manip-
ulation), NumPy (math), and Scikit-Learn (algorithms).
• Data Prep & Treatment: Raw data must be prepared conceptually and treated prac-
tically (handling missing values, encoding text to numbers) before modeling.
• Learning Types:
– Supervised: Uses labeled data (includes Classification for categories and Regres-
sion for continuous numbers).
– Unsupervised: Uses unlabeled data to find hidden patterns (includes Clustering
to group data).
Q3: Why is dealing with Missing Values a mandatory step in Data Treatment?
Answer: Standard ML algorithms in Scikit-Learn rely on complete mathematical matrices to
calculate gradients and distances. If a dataset contains blank spaces or NaN (Not a Number)
values, the algorithm cannot compute the equations and will throw a fatal error.
Q7: Classify the following problem: Predicting whether an applicant will default on a
11
credit card (Yes/No).
Answer: This is a Supervised Binary Classification problem. It is supervised because histori-
cal default statuses are required, and it is binary classification because the target variable has
exactly two discrete outcomes.
12
Module 2: Exam-Style Case Studies (5-8 Marks)
Scenario: You are tasked with building a breast cancer prediction model. You load a hos-
pital CSV file into a Pandas DataFrame. Upon running [Link](), you discover that out
of 50,000 patient records, 10,000 are missing the ”Tumor Size” numerical value. Further-
more, the ”Hospital Branch” column contains text strings (”North”, ”South”, ”East”).
Questions:
(a) Explain the risk of using [Link]() to handle the missing ”Tumor Size” values in
this specific scenario. What Pandas method is safer? (4 Marks)
(b) Describe the exact Pandas treatment required for the ”Hospital Branch” column be-
fore feeding the data to a Scikit-Learn algorithm. (4 Marks)
Detailed Answer:
(a) If you use [Link](), you will instantly delete 10,000 patient records (20% of your
dataset). This is a massive loss of valuable information; those 10,000 rows still con-
tain vital data like age, genetics, and cancer outcomes. A safer method is Impu-
tation using df['Tumor Size'].fillna(df['Tumor Size'].mean()), which fills the
blanks with the average size, preserving the rows.
(b) Scikit-Learn algorithms rely on matrix mathematics and cannot process text strings
like ”North”. The ”Hospital Branch” column must undergo Categorical Encod-
ing. You would use the Pandas pd.get_dummies() function to perform One-Hot En-
coding, which deletes the text column and creates three new numerical columns
(Branch_North, Branch_South, Branch_East) containing binary 0s and 1s.
Scenario: A university student builds a Decision Tree model to classify whether images
contain a cat or a dog. The dataset consists of 5,000 images. The student writes the
code: [Link](X, y) using all 5,000 images, and then evaluates the accuracy using
[Link](X) on those exact same 5,000 images. The model reports an incredible
99.8% accuracy. The student deploys the app, but users complain it guesses incorrectly
50% of the time.
Questions:
(a) What fundamental Data Preparation step did the student omit from their Python
pipeline? (3 Marks)
(b) Explain technically why the model reported 99.8% accuracy in the lab but failed in
the real world. (4 Marks)
Detailed Answer:
(a) The student critically omitted Data Splitting using the Scikit-Learn
train_test_split function. They should have separated the data into a train-
ing set (e.g., 4,000 images) and a testing set (1,000 images).
(b) Because the student evaluated the model on the exact same data it was trained on,
the model suffered from extreme Overfitting. A Decision Tree has high variance
and essentially memorized the pixel patterns of those specific 5,000 images. The
13
99.8% accuracy was a false positive. Because the model memorized the data rather
than learning generalized features (like ear shape or fur texture), it completely failed
when exposed to new, unseen images uploaded by users.
Scenario: A global supermarket chain wants to optimize its physical store layouts. They
have a massive database of 10 million receipt transactions showing exactly which items
were bought together (e.g., Transaction 1: Bread, Milk, Diapers). They want to redesign
the aisles to place frequently co-purchased items next to each other. They have no labels
defining what constitutes a ”good” layout.
Questions:
(a) Should the data scientists use Supervised or Unsupervised learning to solve this
problem? Justify your answer. (3 Marks)
Detailed Answer:
(a) They must use Unsupervised Learning. Supervised learning requires a target la-
bel (a right answer) to train on, but the receipt data is purely raw input showing
transactions; there is no target variable indicating layout success.
(b) The applicable category is Clustering (or Association Rule Learning). The goal of
the algorithm is to autonomously scan the unlabelled transactions and find hidden
structures and natural groupings based purely on statistical frequency, discovering
clusters like ”Customers who buy diapers are 80% likely to also buy baby wipes.”
14
Chapter 3
As per the syllabus, students must select a case project and evaluate it using the methods
learned in Modules 1 and 2.
15
Module 3 Summary Report
This module synthesizes the theoretical foundations (Module 1) and Python practical skills
(Module 2) into a cohesive project workflow.
• Evaluation Focus: The true success of an ML project isn’t just writing the Python
code; it’s proving that the model generalizes well to new data through rigorous train-
ing/testing evaluation and appropriate metric selection.
Q2: Name two reputable sources for finding Data Collections for academic ML projects.
Answer: 1) Kaggle (a data science community platform with thousands of CSVs). 2) The UCI
Machine Learning Repository (a classic academic repository containing standard datasets like
the Iris or Heart Disease datasets).
Q3: During Model Selection, why might a Data Scientist choose a simple Logistic Re-
gression over a complex Deep Neural Network for a medical project?
Answer: The primary reason is Interpretability. While a Neural Network might be slightly
more accurate, it is a ”Black Box.” Logistic Regression is highly interpretable; doctors can look at
the math and understand exactly *why* the algorithm diagnosed the patient with the disease.
Q4: What is a Confusion Matrix, and what phase of the pipeline uses it?
Answer: A Confusion Matrix is an evaluation tool used in the final ”Training and Evaluation”
phase. It is a 2x2 grid that breaks down classification predictions into True Positives, True Neg-
atives, False Positives, and False Negatives, giving a much deeper insight into model perfor-
mance than raw accuracy.
Q5: Explain the danger of skipping Step 3 (Data Preparation) and moving directly from
Data Collection to Model Selection.
Answer: Skipping preparation results in fatal Python errors. Raw datasets almost always con-
tain NaN values and text strings. If these are not cleaned and encoded using Pandas, the Scikit-
Learn algorithms (which require pure numerical matrices) will crash immediately upon calling
the fit() function.
Q7: What is the purpose of the random_state parameter when splitting data in an ML
project?
16
Answer: The train_test_split function shuffles data randomly. Setting a random_state (e.g.,
42) locks the random number generator so that the data is split the exact same way every time
the script is run. This ensures the project evaluation is reproducible.
Q8: If your project evaluation shows excellent training accuracy but terrible testing
accuracy, what adjustment should you make to the pipeline?
Answer: The model is Overfitting. You should return to the Model Selection/Training phase and
either choose a simpler algorithm, increase the amount of training data, or apply regularization
techniques to stop the model from memorizing noise.
Q10: Why is ”Accuracy” sometimes a deeply misleading evaluation metric for ML projects?
Answer: In highly imbalanced datasets, accuracy is useless. If an anti-fraud project dataset has
99,000 normal transactions and 1,000 fraud cases, a broken model that just guesses ”Normal”
for everything will still score 99% Accuracy, despite failing its entire purpose of finding fraud.
17
Module 3: Exam-Style Case Studies (5-8 Marks)
Scenario: A fintech startup completes an ML project pipeline to detect credit card fraud.
Out of 100,000 transactions in their dataset, only 50 are fraudulent. The engineering team
trains a Logistic Regression model. During the Evaluation phase, they calculate the raw
”Accuracy Score” using Scikit-Learn, which outputs 99.95%. The CEO is thrilled and wants
to deploy it immediately.
Questions:
(a) Explain technically why the CEO should NOT be thrilled, and why 99.95% accuracy is
a highly misleading metric for this specific problem. (4 Marks)
(b) What specific evaluation tool and alternative metrics should the team use in Step 5
(Evaluation) to get a true picture of the model’s success? (3 Marks)
Detailed Answer:
(a) The CEO should not be thrilled because the dataset is extremely imbalanced (99,950
normal vs. 50 fraud). An ML model could achieve 99.95% accuracy simply by being
lazy and guessing ”Not Fraud” for every single transaction it ever sees. While tech-
nically accurate, the model is completely useless at its actual job of finding the 50
fraudulent transactions.
(b) Instead of raw accuracy, the team must generate a Confusion Matrix. This will
allow them to see the exact number of False Negatives (fraudulent transactions the
model missed). They should evaluate the project based on Recall (the percentage of
actual fraud cases the model successfully caught) and the F1-Score, which are built
for imbalanced data.
Scenario: A student team is building a project to predict whether a website visitor will
purchase a product. They define the problem, download a raw Kaggle dataset, isolate the
features (Browser Type, Time on Site, Click Count), and import a DecisionTreeClassifier.
They immediately run [Link](X_train, y_train), but the Python execution instantly
halts with a ValueError: could not convert string to float: 'Chrome'.
Questions:
(a) Identify the exact pipeline step the team completely skipped. (2 Marks)
(b) What is causing the specific Python ValueError, and what two Pandas actions must
the team perform to fix it? (5 Marks)
Detailed Answer:
(a) The team completely skipped Step 3: Data Preparation and Treatment.
(b) The ValueError is caused because Scikit-Learn algorithms are purely mathematical;
they cannot process text strings like ”Chrome” or ”Safari” present in the ”Browser
Type” feature. To fix this, the team must use Pandas to perform Categorical Encod-
ing. Specifically, they must use pd.get_dummies(df) to convert the browser strings
into binary numerical columns. Additionally, they must ensure they use [Link]()
or [Link]() to handle any missing values in the raw dataset before passing it to
the model.
18
Appendix A
19
A.2 Program Syntax Templates
1. Standard ML Pipeline Syntax:
# 1. Import libraries
import pandas as pd
from sklearn . model_selection import train_test_split
from sklearn . algorithm_name import AlgorithmClass
# 3. Split Data
X_train , X_test , y_train , y_test = train_test_split (X, y, test_size =0.2)
# 5. Predict
predictions = model. predict ( X_test )
20
A.3 Example Programs (Solved)
Example 1: Classification using Decision Tree Goal: Predict if a student passes based on hours
studied.
import pandas as pd
from sklearn .tree import DecisionTreeClassifier
# Train Model
classifier = DecisionTreeClassifier ()
classifier .fit(X, y)
Example 2: Unsupervised Clustering using K-Means Goal: Group customers based on age
and spending score.
import pandas as pd
from sklearn . cluster import KMeans
# Mock Data
data = {'Age ': [25, 26, 60, 65],
'Spending_Score ': [80, 85, 20, 15]}
df = pd. DataFrame (data)
# Create 2 clusters
kmeans = KMeans ( n_clusters =2, random_state =0)
kmeans .fit(X)
Example 3: Linear Regression (Predicting continuous values) Goal: Predict house price
based on square footage.
import pandas as pd
from sklearn . linear_model import LinearRegression
# Mock Data
data = {'SqFt ': [1000 , 1500 , 2000 , 2500] ,
'Price ': [150000 , 220000 , 310000 , 400000]}
df = pd. DataFrame (data)
21
X = df[[ 'SqFt ']]
y = df['Price ']
# Train Model
regressor = LinearRegression ()
regressor .fit(X, y)
22
Example 4: Logistic Regression (Binary Classification) Goal: Predict if a customer buys a
product based on Age and Salary.
import pandas as pd
from sklearn . linear_model import LogisticRegression
# Mock Data
data = {'Age ': [22, 25, 47, 52, 46],
'Salary ': [20000 , 30000 , 80000 , 90000 , 85000] ,
'Purchased ': [0, 0, 1, 1, 1]} # 0 = No , 1 = Yes
df = pd. DataFrame (data)
# Train Model
model = LogisticRegression ()
[Link](X, y)
Example 5: Full Evaluation with Accuracy Score Goal: Train and check the accuracy of a
Random Forest.
import pandas as pd
from sklearn . ensemble import RandomForestClassifier
from sklearn . model_selection import train_test_split
from sklearn . metrics import accuracy_score
# Mock Data
data = {'Feature1 ': [1, 2, 3, 4, 5, 6, 7, 8],
'Feature2 ': [10, 20, 10, 20, 10, 20, 10, 20],
'Target ': [0, 0, 0, 0, 1, 1, 1, 1]}
df = pd. DataFrame (data)
# Check Accuracy
preds = model. predict ( X_test )
accuracy = accuracy_score (y_test , preds)
print (" Model Accuracy :", accuracy * 100, "%")
Example 6: Data Cleaning Pipeline Goal: Clean missing data and encode text to numbers.
import pandas as pd
import numpy as np
23
# Mock Messy Data
data = {'Name ': ['Alice ', 'Bob ', 'Charlie ', 'David '],
'Age ': [25, [Link] , 35, 40],
'City ': ['NY', 'LA', 'NY ', 'SF ']}
df = pd. DataFrame (data)
print (" --- Raw Data ---\n", df)
24
A.4 Unsolved Case Studies for Practice (10)
Problem Statement: You are a data analyst preparing a dataset for an HR prediction
model. You load a dataset named [Link] into a Pandas DataFrame df. Upon
inspection, you realize the ’Salary’ column has several blank entries that will crash your
model.
Task: Write the exact Python/Pandas code required to find all missing values in the ’Salary’
column and replace them with the median salary of the dataset, ensuring the changes are
saved to the DataFrame permanently.
Problem Statement: A hospital wants to deploy a simple diagnostic tool. You are pro-
vided with a clean DataFrame df containing patient features ['Age', 'Weight'] and a
binary target column ['Diabetes'] (where 1 indicates disease, 0 indicates healthy).
Task: Write the complete Scikit-Learn code to isolate the features and target, initialize a
LogisticRegression model, fit it to the data, and predict the diabetes status for a new
patient who is 45 years old and weighs 80kg.
Problem Statement: A retail mall has provided you with a dataset [Link] tracking
’Annual_Income’ and ’Spending_Score’. Because there are no predefined categories, you
must use unsupervised learning to find natural marketing segments.
Task: Write the code to extract the features, initialize the KMeans clustering algorithm to
create exactly 4 customer clusters, fit the algorithm to the data, and print the assigned
cluster labels for each customer.
Problem Statement: You are building a complex spam filter. You have a clean dataset
[Link]. The input features are ['WordCount', 'LinkCount'] and the target label is
['IsSpam']. You want to use an ensemble decision tree method for higher accuracy.
Task: Write the code to import, initialize, and train a RandomForestClassifier on the pro-
vided data.
25
Practice Case Study 6: Aggressive Row Deletion
Problem Statement: You load medical_scans.csv into a Pandas DataFrame df. The
dataset has thousands of rows, but some imaging files were corrupted, resulting in NaN
values across various columns. Imputing medical data is deemed too risky for this spe-
cific project.
Task: Write the single Pandas command required to aggressively delete every single row
in the entire DataFrame that contains at least one missing (NaN) value, updating the
DataFrame in place.
Problem Statement: You are analyzing a web traffic DataFrame df. It contains a text
column called DeviceType with categorical string values like ”Mobile”, ”Desktop”, and
”Tablet”. Scikit-Learn throws an error when trying to process these strings.
Task: Write the Pandas code to perform One-Hot Encoding, converting the DeviceType
text column into distinct numerical dummy variables.
Problem Statement: You are working with a pre-split financial dataset with features X
(CreditScore, Debt) and target y (LoanApproved).
Task: Write the Python syntax to import a DecisionTreeClassifier, train it on the existing
X and y variables, and make a prediction for a new applicant with a CreditScore of 700 and
Debt of 5000. Print the result.
Problem Statement: As a data scientist, the very first step upon loading a new dataset
[Link] into a DataFrame df is to understand its structure and cleanliness.
Task: Write the two Pandas commands you would execute sequentially to: 1) display the
first 5 rows of the dataset to verify column headers, and 2) print a sum count of all missing
values present in every column.
Problem Statement: You have successfully navigated the ML pipeline. You trained
a model on X_train and generated an array of guesses called preds by running
[Link](X_test). You now possess the model’s guesses (preds) and the actual true
answers (y_test).
Task: Write the code to import the standard classification evaluation metric from Scikit-
Learn, compare your preds against y_test, and print the final accuracy percentage of your
model.
26
A.5 Answer Key for Unsolved Case Studies
Answer Key 1: Missing Data Imputation
import pandas as pd
df = pd. read_csv ('employees .csv ')
# Calculate median and fill
median_sal = df['Salary ']. median ()
df['Salary ']. fillna (median_sal , inplace =True)
model = LogisticRegression ()
[Link](X, y)
prediction = model. predict ([[45 , 80]])
print ( prediction )
27
Answer Key 7: Categorical ’Dummy’ Encoding
import pandas as pd
28