Python Module Project
Under Supervision of
Code bridge Organization
Prepared by:
- Kyrillos Kamel
- Bishoy Naseem
- Ziad Hamada
- Fares Hossam
- Ahmed Mohamed
[Link]
We received our data in Sun 8/3/2026, and our deadline in original was Wed
11/3/2026, then it has expanded to Thu 12/3/2026.
Once we received it we decided to make a video meeting on (Google meet) to start
understanding the data and start working immediately.
Then, we had to move quickly, that’s why we decided to divide our mission into
smaller tasks between the team members.
And it was like this:
After we all understanded and analyzed the data we came up with a vision of what
exactly the data is about and made a workplan of what exactly we should do.
-Work Plan:
Our workplan was divided into 3 major tasks: Cleaning, Visualization and
Documentation processes.
Cleaning (Bishoy Naseem & Ahmed Mohamed & Ziad Hamada)
This mission includes using Python and its Libraries (NumPy, Pandas, Matplotlib and Seaborn).
This mission was the mission of the members Bishoy & Ziad, they were responsible
for cleaning the data and preparing it for the visualization process.
Cleaning the data includes the following:
-Dropping useless data.
-Checking missed values.
-Filling the Null-entries.
-Check duplicated values and more..
Visualization (Kyrillos Kamel& Fares Hossam)
This mission includes using the libraries (Matplotlib and Seaborn) to make visual graphs and
charts represent different sides of the cleaned data.
We make the visualization process in purpose to see more details and hidden titles
in the data and sometimes to predict the future.
The Visualization process also helps concerned people to make right decisions and
maximizing their profit.
This mission was the mission of the members Kyrillos & Fares, they were
responsible for the data charts and getting the maximum addition from the data.
Documentation (Everyone)
This mission was planned to be prepared in the hands of every member in the
team.
Each member here was responsible for writing his own part of the documentation
explaining what exactly did he do, how and why, which is helpful to make everyone
totally aware of the work he did in purpose to be more prepared in other similar
situations in the future.
And as we believe that trust is the heart of any successful work between the team
members, everyone was always prepared and existing for everyone else and
provide advices, help and support, which was insanely positively affecting on our
productivity and it helped time-saving.
Also, we made sure that every member of the team be totally aware of what other
members are doing, how and why, so we can get the maximum profit of our project.
Now, let me explain what exactly happened..
II. Cleaning (Sunday-Tuesday)
Data cleaning is the process of identifying and fixing, removing or incomplete data
within a dataset to ensure accuracy, consistency, and usability, in purpose to get the
best result and predict future events.
Coming from that concept we started our work like that:
First: Importing Required Libraries
As we learned in Python Module, in purpose to start using Python and its libraries,
we needed to import them in the coded form:
Import pandas as pd (Pandas is used to load and manipulate datasets)
Import numpy as np (NumPy is used for numerical operations)
Import [Link] as plt (Matplotlib and Seaborn are used for data
visualization and exploring relationships between
Import seaborn as sns variables)
These libraries provide essential tools for working with data and performing analysis.
Second: Loading the Dataset
Next, we loaded the dataset into a Pandas Data Frame, so we can call and deal with
them as we wish using:
df = pd.read_csv ('[Link]')
[Link]()
pd.read_csv() loads the CSV dataset
The dataset is stored in a Data Frame named df.
Third: Exploring Dataset Structure
To understand the dataset structure and data types, we used the following
command:
[Link]()
[Link] calls the data in a form of entries and columns
[Link] provides important information about the data like:
Total number of rows and columns.
Data type of each column.
Number of non-null values in each column.
This step helps identify columns that contain missing values either.
Now, we simply know number of entries, number of columns, rows and got a
cleared vision of the data.
Forth: Detecting Missing Values
To analyze the missing values in the dataset, we calculated the number of missing
values in each column.
To calculate the number of missing data, we need to create a new data frame
named "Null_col" to determine the number of columns containing only null data.
Null_col=[Link]({"col":[Link],"nullnumber":[Link]().sum(),"type":[Link]
})
Null_col=Null_col[Null_col["null number"]>0]
Null_col=Null_col.sort_values(by="null number", ascending=False)
Null_col=Null_col.reset_index(drop=True)
Null_col
"Null_col" is a new data frame containing three columns:
"col" which contains the column names
"nullnumber" which contains the number of null data
"type" which displays the data type for each column.
However, using [Link]().sum()displays the number of null data in each
column. To get the columns containing null data that are not equal to zero, we used
Null_col=Null_col[Null_col["null number"]>0]
to display the columns containing null data that are not equal to zero
Sorting the results helped identify columns with the largest number of missing
values.
Fifth: Handling Missing Values
After identifying the columns with missing values, we handled them according to
their data types.
Categorical columns (string) → filled using mode.
Numerical columns → filled using median.
The median was used because it is less sensitive to outliers, which makes it more reliable than
the mean when extreme values are present.
First, we separated the columns based on their data types as follows:
String_Cols=['GarageQual','GarageCond','BsmtQual','BsmtCond','BsmtFinType1','
BsmtFinType2','GarageFinish','Electrical','BsmtExposure','GarageType']
numric_Cols=['MasVnrArea','GarageYrBlt','LotFrontage']
Explanation:
String_Cols contains columns with categorical data
numric_Cols contains columns with numerical data
This grouping allows us to apply the appropriate method for handling missing values.
Then, we filled the missing values with categorical columns as follows:
for col in String_Cols:
df[col]=df[col].fillna(df[col].mode()[0])
Explanation:
The loop iterates through all categorical columns.
mode() returns the most frequent value in the column.
fillna() replaces missing values with that most common value.
This method preserves the distribution of categorical values.
for col in numric_Cols:
df[col]=df[col].fillna(df[col].median().round(2))
Explanation:
The loop iterates through numerical columns.
median() calculates the middle value.
round(2) limits the value to two decimal places
fillna() replaces missing values with the median.
This helps reduce the impact of extreme values.
Sixth: Dropping Columns with Too Many Missing Values
Some columns contained more than 50% missing values, making them unreliable
for analysis. Therefore, we decided to remove them from the dataset using the
following command:
df=[Link](['PoolQC','MiscFeature','Alley','Fence','MasVnrType','FireplaceQu'
,"Id"],axis=1,
errors='ignore')
Explanation:
drop() removes unnecessary columns from the dataset.
axis=1 specifies that columns are being removed instead of rows.
Removing these columns improves the overall quality of the dataset.
Seventh: Verifying the Cleaning Process
Finally, we checked the dataset again to confirm that no missing values remained, no duplicated values
exists and we didn’t miss a thing using some commands:
[Link]().sum()
Explanation:
This command counts the remaining missing values in each column.
After completing the cleaning process, the result showed zero missing values, confirming that the dataset was
successfully cleaned.
[Link]().sum()
Explanation:
This command counts if there’s any duplicated values inside the columns.
After completing the cleaning process, the result showed zero duplicated values, confirming that the dataset was
successfully cleaned again.
Final Result:
After completing the data cleaning process:
Missing values were properly handled
Columns with excessive missing data were removed.
The dataset became clean and ready for further analysis.
The cleaned dataset are now totally prepared, checked and ready for data visualization or
machine learning models in the future.
III. Visualization (Tuesday-Thursday)
Visualization process is ready to be reality.
From the previous work, we have cleared data ready to be visualized.
In the beginning of the visualization process, we need to ensure the most important
relationships between data features, otherwise, we want to predict prices of the
houses, so we’ll look for the most correlated relationships with SalePrice.
-To find the most correlated relationships with SalePrice, we made a heatmap using
the following code:
[Link](figsize=(10, 6))
corr = [Link](numeric_only=True)
[Link](corr, cmap="coolwarm");
[Link]("Correlation Heatmap",fontweight='bold');
print("\nMost Correlated Features with SalePrice:")
Explanation:
[Link](figsize=(10, 6)) It creates a new plotting area and sets the size of the figure.
[Link](numeric_only=True) It calculates the correlation matrix between all numeric columns in the Data
Frame.
[Link](corr, cmap="coolwarm"); Draws a heatmap visualization of the correlation data.
[Link]("Correlation Heatmap",fontweight='bold'); Adds a title upper the graph.
-To print the most correlated relationships with SalePrice, we wrote the following
code:
print("\nMost Correlated Features with SalePrice:")
print(corr["SalePrice"].sort_values(ascending=False))
Explanation:
corr is the correlation function created using the corr() method from Pandas.
Now, we have the most correlated features with SalePrice printed in the console.
As we can notice some of the most correlations with SalePrice are:
-OverallQual (Overall Quality of the house)
-GrLivArea (Ground Living Area)
-1StFlrSF (First floor Area)
-GarageArea (Size of the garage)
-TotalBsmtSF (Total Basement Area foot^2)
-YearBuilt.
Also, we can notice that SalePrice has Positive relationship with some factors like:
OverallQual, GrLivArea, Garage Area, TotalBsmtSF,1stFlrSF and YearBuilt.
And negative relationship with others such as:
MSSubClass and KitchenAbvGr
Now, we can start visualizing our data.
1. The relationship between GrLivArea and SalePrice.
We saw that the best way to visualize the relationship between GrLivArea and
SalePrice is a scatterplot.
So, to visualize it we used the following code:
[Link](figsize=(14,6))
[Link](x=df["GrLivArea"],y=df["SalePrice"],data=df, scatter=False,
color="gray",ci=None,line_kws={"linewidth": 1});
[Link](x=df["GrLivArea"], y=df["SalePrice"], data=df, hue="SalePrice",
palette="coolwarm")
legend = [Link](loc='upper right', title='SalePrice')
[Link]('The relationship between GrLivArea and SalePrice',fontweight='bold');
This code made a scatterplot with some features and shows the relathionship
between GrLivArea and SalePrice, which is obviousely Positive.
The graph shows a strong positive correlation between GrLivArea and SalePrice, as
the living area increases, the SalePrice increases either.
- The majority of houses are located in the range between 1000-2000 foot^2, and
with price 100000$-300000$.
- There are some outliers high living area with low price, or medium living area with
expensive cost, It could be because of other factors like place, yearbuilt or
something else.
2. The relationship between OverallQual and SalePrice.
We saw that the best way to visualize the relationship between OverallQual and
SalePrice is a boxplot.
So, to visualize it we used the following code:
[Link](figsize=(14, 6))
[Link](x='OverallQual', y='SalePrice', data=df,hue="OverallQual",
palette="coolwarm")
[Link]('Relationship between Overall Quality and Sale
Price',fontweight='bold');
This code made a boxplot with some features and shows the relathionship between
OverallQual and SalePrice, which is Positive.
The graph shows a strong positive correlation between OverallQual and SalePrice,
as the whole quality increases, the SalePrice also increases significantly.
Also, the median line inside each box moves upward as quality increases, which
means, houses with better quality and comfortability are being sold for more
money, compared to the others.
Wan can notice either that the box size becomes larger for higher quality houses,
which means luxurious houses have more variety in prices than normal houses,
thanks to things like: Location, luxury levels or better view.
So, here we can say that a lot of people are ready to pay higher prices
just to get more of those extra benefits.
3. The relationship between 1stFlrSF and SalePrice.
We saw that the best way to visualize the relationship between GrLivArea and
SalePrice is a scatterplot.
So, to visualize it we used the following code:
[Link](figsize=(14,6))
[Link](x=df["1stFlrSF"],y=df["SalePrice"],data=df, scatter=False,
color="red",ci=None,line_kws={"linewidth": 1});
[Link](x=df["1stFlrSF"], y=df["SalePrice"], data=df, hue="SalePrice",
palette="coolwarm")
legend = [Link](loc='upper right', title='SalePrice')
[Link]('The relationship between 1stFlrSF and SalePrice',fontweight='bold',
fontsize=16);
This code made a scatterplot with some features and shows the relathionship
between 1stFlrSF and SalePrice, which is Positive.
- This scatter plot shows the relationship between 1st Floor Square Footage
(1stFlrSF) and SalePrice, and it’s obviousely positive.
- Also, the regression line shows the strong positive relationship here, which means
that houses with larger first-floor areas tend to have higher sale prices.
- As we notice, There are some outliers large first floor area with low price, or small
first floor area with expensive cost.
There’s something needs to be shown, 1stFlrSF is an important feature, but
house prices are also influenced by many other variables such as: place, yearbuilt
or overall quality.
4. The relationship between TotalBsmtSF and SalePrice.
We saw that the best way to visualize the relationship between TotalBsmtSF and
SalePrice is a hexbin.
So, to visualize it we used the following code:
[Link](figsize=(14, 7))
[Link](df['TotalBsmtSF'], df['SalePrice'], gridsize=30, cmap='Blues')
[Link](label='Number of houses')
[Link]('TotalBsmtSF')
[Link]('SalePrice')
grid_size = 60
[Link]('The relationship between SalePrice and TotalBsmtSF',fontweight='bold');
This code made a hexbin with some features and shows the relathionship between
TotalBsmtSF and SalePrice.
This hexbin graph shows the relationship between Total Basement Square Foot and
SalePrice.
The relationship here is positive and the hexbin shape here shows that the majority
of hoses sold is located in the range of 0 - 2000 foot^2 and 0 - 300000$.
So, we can notice that the Total BasementFS has a positive relationship but not a
really strong one, it affects the SalePrice but not as the other features.
5. The relationship between YearBuilt and SalePrice.
We saw that the best way to visualize the relationship between YearBuilt and
SalePrice is a barplot.
So, to visualize it we used the following code:
df['DecadeBuilt'] = (df['YearBuilt'] // 10) * 10
[Link](figsize=(14, 7))
[Link](x='DecadeBuilt',y='SalePrice',estimator=[Link],data=df,
palette='magma',hue='DecadeBuilt')
[Link]("Average Sale Price per Decade",fontweight='bold', fontsize=16)
[Link]("DecadeBuilt", fontsize=14)
[Link]("Price Average", fontsize=14)
[Link](axis='y', linestyle='--', alpha=0.7);
This code made a barplot with some features and shows the relathionship between
YearBuilt and SalePrice.
While there are about more than 200 years in the data, and there’s no way we put
every year in the graph, so we classified them into decades. (10 Years)
This barplot chart here shows a visual representation of how much the DecadeBuilt
of the house affects its Price.
As we can notice, the houses built in the decades (1980-2010) tend to have higher
average prices, thanks to a lot of affecting features such as inflation, technology, or
luxury equipment.
There is a huge variation in house prices from (1880-1900).
6. The relationship between GarageArea and SalePrice.
And finally, we saw that the best way to visualize the relationship between YearBuilt
and SalePrice is a relplot.
So, to visualize it we used the following code:
[Link](x="GarageArea", y="SalePrice", data=df, hue='GarageArea',
palette='coolwarm', height=6, aspect=1.5)
[Link]('GarageArea vs SalePrice colored by GarageArea', fontsize=16)
title = [Link]("The relationship between GarageArea and
SalePrice",fontweight='bold',color='black', fontsize=16)
#There'are outliers in the data here.
df=df[df["GarageArea"]<1200]
df=df[df["GarageArea"]>0]
df= [Link](df[df["GarageArea"]==0].index)
This code made a relplot with some features and shows the relathionship between
GarageArea and SalePrice.
As we would expect, there is a positive relationship here between GarageArea and
SalePrice.
This scatter chart here shows a visual representation of how much the Area of the
Garage in the house affects its Price.
As we can notice, the houses gets more expensive as the capacity of the Garage
increases, it happens because rich people are willing to pay more money in houses
contains large Garage capacity for Cars, as a sign of luxury.
Now, we do have:
cleared data,
understood,
visualized
and ready to allow people concerned to make the best decisions.
Thanks