From a2e8f4905d91b87000c666839ed00cb463c2d568 Mon Sep 17 00:00:00 2001 From: preetiail Date: Thu, 8 Nov 2018 13:39:44 +0000 Subject: [PATCH 1/5] Done --- q01_plot/build.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..c9433a8 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,25 @@ +# %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') +num_cols = ['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice'] + +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() + return(plt) + + + -# Write your code here : From 2917e4f26f3e1dc8986f874503b3b869a415aaa1 Mon Sep 17 00:00:00 2001 From: preetiail Date: Thu, 8 Nov 2018 13:47:56 +0000 Subject: [PATCH 2/5] Done --- q01_plot/build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index c9433a8..d559348 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -19,7 +19,9 @@ def plot(num_cols): plt.tight_layout() plt.show() return(plt) + else: + sns.distplot(dataframe[num_cols[i]], kde=False) - +plot(num_cols) From 697c0c1f9de0f4f0c1bfcf615bffc0a5c05eaada Mon Sep 17 00:00:00 2001 From: preetiail Date: Sat, 10 Nov 2018 05:06:36 +0000 Subject: [PATCH 3/5] Done --- q02_plot/build.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..82a1fc8 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,22 @@ +# %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') +num_cols=['LotArea' ,'GarageArea', 'OpenPorchSF','SalePrice'] + +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.boxplot(x=data[num_cols[i]]) + plt.subplot(122) + sns.boxplot(x=data[num_cols[i+1]]) + plt.show() + return plot(plt) -# Write your code here: From 74f85be7b1591598f221be18f7d6263d604461d6 Mon Sep 17 00:00:00 2001 From: preetiail Date: Sat, 10 Nov 2018 05:50:37 +0000 Subject: [PATCH 4/5] Done --- q03_regression_plot/build.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..d3e3329 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 @@ -6,11 +7,11 @@ data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') - - -# Write your code here +def regression_plot(var1,var2): + sns.lmplot('GrLivArea','SalePrice', data=data, fit_reg=True) + plt.show() + return(plt) From 79e433c0e388130c323c0afeecd7c2c7f5432a81 Mon Sep 17 00:00:00 2001 From: preetiail Date: Sat, 10 Nov 2018 06:04:57 +0000 Subject: [PATCH 5/5] Done --- q04_cor/build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..af1cc7c 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,16 @@ +# %load q04_cor/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') +def cor(data): + sns.pairplot(data) + plt.show() + return(plt) + + + -# Write your code here