From 2f411851825c5a48a18bfd3ca1ffc968e61c9f6e Mon Sep 17 00:00:00 2001 From: sannidh Date: Sun, 21 Oct 2018 17:34:55 +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..f3b4b15 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 : +def plot(num_cols): + num_cols=['LotArea' ,'GarageArea', 'OpenPorchSF', 'SalePrice'] + 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]], hist=True, kde=False) + plt.subplot(122) + sns.distplot(data[num_cols[i+1]], hist=True, kde=False) + plt.tight_layout() + plt.show() + else: + sns.distplot(data[num_cols[i]], hist=True, kde=False) + + + From 77aeff6ce9cb7b9783e4e889b1b126cc13dd24fc Mon Sep 17 00:00:00 2001 From: sannidh Date: Sun, 21 Oct 2018 17:40:02 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..563d474 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,25 @@ +# %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') + +def plot(num_cols): + 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=data) + plt.subplot(122) + sns.boxplot(facet,num_cols[i+1],data=data) + plt.tight_layout() + plt.show() + else: + sns.boxplot(facet,num_cols[i],data=data) -# Write your code here: From dd32a369a279ee094fdfea96a8599d145300148e Mon Sep 17 00:00:00 2001 From: sannidh Date: Sun, 21 Oct 2018 17:46:35 +0000 Subject: [PATCH 3/4] 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..06ec44f 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): + var1, var2='GrLivArea', 'SalePrice' + sns.lmplot(var1, var2, data=data, fit_reg=True) + plt.show(); From f63e7e8510b2db1efd6481dcd6d77d0caf56b23c Mon Sep 17 00:00:00 2001 From: sannidh Date: Sun, 21 Oct 2018 17:51:31 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..98b3f68 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,15 @@ +# %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(df): + df=data + sns.heatmap(df.corr(), cmap='plasma',annot=True) + plt.show(); + -# Write your code here