From ea1354b6965e26deadb58c985d25f4225e0c68d2 Mon Sep 17 00:00:00 2001 From: soham009 Date: Thu, 27 Dec 2018 12:46:35 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..e2a2bba 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,26 @@ +# %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]], hist=True, kde=True) + plt.subplot(122) + sns.distplot(data[num_cols[i+1]], hist=True, kde=True) + plt.tight_layout() + plt.show() + else: + sns.distplot(data[num_cols[i]], hist=True, kde=True) + +#plot(['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice']) + + From 5f06b8c378391fb18f4959da223dca2d53eb3124 Mon Sep 17 00:00:00 2001 From: soham009 Date: Thu, 27 Dec 2018 13:18:26 +0000 Subject: [PATCH 2/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..724148d 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,16 @@ data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') - # Write your code here +def regression_plot(variable1,variable2): + sns.lmplot(variable1, variable2, data=data, fit_reg=True) + plt.show() + + + + From fe9b9f6afe8160268ff34ba1fa487543effc821f Mon Sep 17 00:00:00 2001 From: soham009 Date: Thu, 27 Dec 2018 13:19:49 +0000 Subject: [PATCH 3/4] Done --- q04_cor/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..d1f03f6 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,19 @@ +# %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): + plt.figure(figsize=(12,8)) + sns.heatmap(data.corr(), cmap='viridis') + plt.show() + + + + From ba01e1509d0f8c9bcfffd6aacc27dac91de9ac4f Mon Sep 17 00:00:00 2001 From: soham009 Date: Thu, 27 Dec 2018 13:21:07 +0000 Subject: [PATCH 4/4] Done --- q02_plot/build.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..403abf9 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,30 @@ +# %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): + 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) + +# plot(['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice']) + + + +