From 1e99fba0b8a85e2204e3a4f7c5daad85a55f4cb4 Mon Sep 17 00:00:00 2001 From: ramakrishnasonakam Date: Mon, 3 Dec 2018 17:06:29 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..b737a8b 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,23 @@ 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): + 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 cdb75b89ff763ddfc8ca355b55e81ec87abfbc6e Mon Sep 17 00:00:00 2001 From: ramakrishnasonakam Date: Thu, 13 Dec 2018 16:04:53 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..7d91b43 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') # Write your code here: +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) + + + From 19ce2a2e30d5bb661897f1461454b6013ff52ed6 Mon Sep 17 00:00:00 2001 From: ramakrishnasonakam Date: Thu, 13 Dec 2018 16:16:34 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..636b53e 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,10 +7,15 @@ data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') - +variable1 = data['GrLivArea'] +variable2 = data['SalePrice'] # Write your code here +def regression_plot(variable1, variable2): + sns.scatterplot(variable1, variable2, data = data) + sns.lmplot(variable1, variable2, data= data, fit_reg=True) + + From 2ecb477c7114a0ea9550f495709afb9b3043690b Mon Sep 17 00:00:00 2001 From: ramakrishnasonakam Date: Thu, 13 Dec 2018 16:23:03 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..6593274 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,18 @@ +# %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') # Write your code here +def cor(data): + cm = data.corr() + plt.figure(figsize=(10,6)) + sns.heatmap(cm, annot=True) + + + +