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.
8 changes: 8 additions & 0 deletions q01_missing_value/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# %load q01_missing_value/build.py
# Default imports
import pandas as pd
from sklearn.preprocessing import Imputer

# Data loading
ny_housing = pd.read_csv('data/train.csv')
Expand All @@ -8,3 +10,9 @@


# Write your code here:
def imputation(dataset = housing_data):
housing_data['MasVnrArea'] = housing_data['MasVnrArea'].fillna(housing_data['MasVnrArea'].mean())
housing_data['GarageType'] = housing_data['GarageType'].fillna(housing_data['GarageType'].mode()[0])
return housing_data[['MasVnrArea']], housing_data[['GarageType']]


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.
11 changes: 11 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,13 @@


# Write your code here:

def outlier_removal(df):
a = dict(df.quantile(.95))
for item in a:
df = df.drop(df[df[item] > a[item]].index)
return df




Binary file not shown.
Binary file not shown.