From 6b798fa8a6132ed17f15c9943571830216d926bb Mon Sep 17 00:00:00 2001 From: aksmungekar Date: Thu, 6 Dec 2018 11:47:22 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..62dffa8 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') +num_cols=['LotArea','GarageArea','OpenPorchSF','SalePrice'] plt.switch_backend('agg') -# 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() + +plot(num_cols) + + From 4c6a54d8e01b46a2df6645336e9d40ba2512f31a Mon Sep 17 00:00:00 2001 From: aksmungekar Date: Thu, 6 Dec 2018 11:52:58 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..d150ea4 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,24 @@ +# %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') +num_cols = ['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice'] +facet = None +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(facet, num_cols[i],data = data) + plt.subplot(122) + sns.boxplot(facet, num_cols[i+1],data = data) + plt.tight_layout() + plt.show() +plot(num_cols) -# Write your code here: From 48c319027b9d6e4d1fd0f26ea1759a3657a33636 Mon Sep 17 00:00:00 2001 From: aksmungekar Date: Thu, 6 Dec 2018 12:01:52 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..e9e82d3 100644 --- a/q03_regression_plot/build.py +++ b/q03_regression_plot/build.py @@ -1,16 +1,18 @@ +# %load q03_regression_plot/build.py # Default imports import pandas as pd import seaborn as sns import matplotlib.pyplot as plt - -data = pd.read_csv('data/house_prices_multivariate.csv') plt.switch_backend('agg') +data = pd.read_csv('data/house_prices_multivariate.csv') -# Write your code here - +def regression_plot(variable1,variable2): + sns.lmplot(variable1, variable2, data=data, fit_reg=True) + plt.show() +regression_plot('GrLivArea','SalePrice') From dd65e1b952002d377baf6b7dd465bc50ee7466bd Mon Sep 17 00:00:00 2001 From: aksmungekar Date: Thu, 6 Dec 2018 12:06:27 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..e771ff3 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(data): + plt.figure(figsize = (8,5)) + sns.heatmap(data.corr(),cmap='viridis') + plt.show() -# Write your code here