From 1b27a5419e9b0603bd9bb18da3a6dd0d0fa47c93 Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Fri, 26 Oct 2018 17:48:47 +0000 Subject: [PATCH 1/4] 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..12ee77d 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') -# 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 58bffb019906e4bb85de363c2232f08c4c4148a5 Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Fri, 26 Oct 2018 18:04:07 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..e0048b0 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,26 @@ -# 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 = dataframe) + plt.subplot(122) + sns.boxplot(facet, num_cols[i+1],data = dataframe) + plt.tight_layout() + plt.show() + + else: + sns.boxplot(facet, num_cols[i],data = dataframe) + + -# Write your code here: From aee036c7f05c5c47acbe37a67fdc04ce87abb8aa Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Fri, 26 Oct 2018 18:20:30 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..6b7ea4c 100644 --- a/q03_regression_plot/build.py +++ b/q03_regression_plot/build.py @@ -1,15 +1,18 @@ -# 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') +dataframe = pd.read_csv('data/house_prices_multivariate.csv') + +def regression_plot(v1, v2): + v1, v2 = 'GrLivArea', 'SalePrice' + sns.lmplot(v1, v2, data=dataframe, fit_reg=True) + plt.show(); + + -# Write your code here From 69fcc406ce26d9f2aa01d7391d0dd16293d3122e Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Fri, 26 Oct 2018 18:24:27 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..4df49ef 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,17 @@ -# 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=(12,8)) + sns.heatmap(data.corr(), cmap='viridis') + plt.show(); + + + + + -# Write your code here