Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file added q01_missing_value/__pycache__/build.cpython-36.pyc
Binary file not shown.
13 changes: 12 additions & 1 deletion q01_missing_value/build.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# %load q01_missing_value/build.py
# Default imports
import pandas as pd

import numpy as np
import statistics
# Data loading
ny_housing = pd.read_csv('data/train.csv')
# Selecting 4 most relevant variables along with target variable from the dataset fot the Cleaning and Preprocessing.
housing_data = ny_housing[['MasVnrArea', 'GrLivArea', 'LotShape', 'GarageType', 'SalePrice']]


# Write your code here:
def imputation(dataset):
categoricals = housing_data.select_dtypes(exclude=[np.number])
categoricals['GarageType'].fillna(statistics.mode(categoricals['GarageType'].values), inplace = True)

numericals = housing_data.select_dtypes(include=[np.number])
numericals.fillna(numericals.mean(),inplace=True)
return numericals,categoricals


Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added q02_outlier_removal/__pycache__/build.cpython-36.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions q02_outlier_removal/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q02_outlier_removal/build.py
# Default imports
import pandas as pd

Expand All @@ -8,3 +9,11 @@


# Write your code here:
def outlier_removal(dataset):
q1=housing_data.quantile(0.95)
df =housing_data.drop(housing_data[(housing_data['GrLivArea']>2466.1)].index)
df1=df.drop(df[(df['MasVnrArea']>456.0)].index)
df2=df1.drop(df1[(df1['SalePrice']>326099.99999999994)].index)
return df2


Binary file not shown.
Binary file not shown.
Binary file added q03_skewness_log/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added q03_skewness_log/__pycache__/build.cpython-36.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions q03_skewness_log/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q03_skewness_log/build.py
from scipy.stats import skew
import pandas as pd
import numpy as np
Expand All @@ -6,3 +7,11 @@


# Write code here:
def skewness_log(data):
s1=np.log(data['GrLivArea'])
skw1=skew(s1)
s2=np.log(data['SalePrice'])
skw2=skew(s2)
return skw1,skw2


Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added q03_skewness_sqrt/__pycache__/build.cpython-36.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions q03_skewness_sqrt/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q03_skewness_sqrt/build.py
# Default imports
from scipy.stats import skew
import pandas as pd
Expand All @@ -7,4 +8,12 @@


# Write your Solution Here:
def skewness_sqrt(data):
s1=np.sqrt(data['GrLivArea'])
skw1=skew(s1)
s2=np.sqrt(data['SalePrice'])
skw2=skew(s2)
return skw1,skw2



Binary file not shown.
Binary file not shown.
Binary file added q04_encoding/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added q04_encoding/__pycache__/build.cpython-36.pyc
Binary file not shown.
12 changes: 12 additions & 0 deletions q04_encoding/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q04_encoding/build.py
# Default imports
import pandas as pd
from sklearn.preprocessing import LabelEncoder
Expand All @@ -7,4 +8,15 @@


# Write your code here:
def encoding(dataset):
lablel_encoder = LabelEncoder()
housing_data['LotShape_Label'] = lablel_encoder.fit_transform(housing_data['LotShape'])

dummies=pd.get_dummies(housing_data['GarageType'])
new_data=pd.concat([housing_data, dummies], axis = 1)
new_data=new_data.drop('GarageType',axis=1)
return new_data




Binary file not shown.
Binary file not shown.