From 29b756c603ec472c9d3235e5ba70fbaf05d0788c Mon Sep 17 00:00:00 2001 From: shehzaan07 Date: Fri, 30 Nov 2018 10:36:04 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..06a3831 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,24 @@ +# %load q01_plot/build.py +# Default imports import matplotlib.pyplot as plt import seaborn as sns import pandas as pd data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') -# Write your code here : +# Write your code here: +def plot(num_cols): + for i in range(0,len(num_cols),2): + if len(num_cols) > i+1: + plt.figure(figsize=(10,4)) + plt.subplot(121) + sns.distplot(data[num_cols[i]], kde=False) + plt.subplot(122) + sns.distplot(data[num_cols[i+1]], kde=False) + plt.tight_layout() + plt.show() + else: + sns.distplot(data[num_cols[i]], kde=False) + + + From 21b737862edb7e5465afa0a3dbd447eb6376f7e2 Mon Sep 17 00:00:00 2001 From: shehzaan07 Date: Fri, 30 Nov 2018 10:39:08 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..720df8b 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,29 @@ +# %load q02_plot/build.py # Default imports import pandas as pd import matplotlib.pyplot as plt import seaborn as sns - -data = pd.read_csv('data/house_prices_multivariate.csv') plt.switch_backend('agg') +data = pd.read_csv('data/house_prices_multivariate.csv') +dataframe = pd.read_csv('data/house_prices_multivariate.csv') # Write your code here: +def plot(a): + num_cols = ['LotArea' ,'GarageArea', 'OpenPorchSF','SalePrice'] + facet = None + for i in range(0,len(num_cols),2): + if len(num_cols) > i+1: + plt.figure(figsize=(10,4)) + plt.subplot(121) + sns.boxplot(facet, num_cols[i],data = a) + plt.subplot(122) + sns.boxplot(facet, num_cols[i+1],data = a) + plt.tight_layout() + plt.show() + else: + sns.boxplot(facet, num_cols[i],data = a) +plot(dataframe) + + From 8172f77841743893b581541b506f5b652e02c3c9 Mon Sep 17 00:00:00 2001 From: shehzaan07 Date: Fri, 30 Nov 2018 10:41:37 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..135fb4d 100644 --- a/q03_regression_plot/build.py +++ b/q03_regression_plot/build.py @@ -1,3 +1,4 @@ +# %load q03_regression_plot/build.py # Default imports import pandas as pd @@ -8,8 +9,12 @@ data = pd.read_csv('data/house_prices_multivariate.csv') plt.switch_backend('agg') - # Write your code here +def regression_plot(a,b): + sns.lmplot(a, b, data = data, fit_reg=True) +regression_plot('GrLivArea','SalePrice') + + From 6bc34603f1a7496e0ff07351c191ec5712c3dc59 Mon Sep 17 00:00:00 2001 From: shehzaan07 Date: Fri, 30 Nov 2018 10:43:28 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..73def22 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,3 +1,4 @@ +# %load q04_cor/build.py # Default imports import pandas as pd import matplotlib.pyplot as plt @@ -6,5 +7,11 @@ data = pd.read_csv('data/house_prices_multivariate.csv') plt.switch_backend('agg') - # Write your code here +def cor(a): + sns.heatmap(a.corr()) +cor(data) + + + +