From e5c8a7e6b3e6be1d7ea13c0d54362c99c172cea2 Mon Sep 17 00:00:00 2001 From: sahusaurabh65 Date: Mon, 22 Oct 2018 19:01:19 +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..0e5c75d 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,26 @@ +# %load q01_plot/build.py + 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: +num_cols = ['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice'] +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) + + + -# Write your code here : From 1ee37a5faa95f9c0225f89368fc59b10d5e70a3e Mon Sep 17 00:00:00 2001 From: sahusaurabh65 Date: Mon, 22 Oct 2018 19:04:29 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..19beb92 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,23 @@ +# %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') - +num_cols = ['LotArea','GarageArea','OpenPorchSF','SalePrice'] # Write your code here: +# %matplotlib inline + +def plot(num_cols): + + f, axs = plt.subplots(2, 2, figsize=(7, 7), sharex=False) + sns.boxplot(data['LotArea'],ax= axs[0,0]) + sns.boxplot(data['GarageArea'],ax=axs[0,1]) + sns.boxplot(data['OpenPorchSF'],ax=axs[1,0]) + sns.boxplot(data['SalePrice'],ax=axs[1,1]) + + + From aa7ec829707a993d472a74fddaf3b06b1d216267 Mon Sep 17 00:00:00 2001 From: sahusaurabh65 Date: Mon, 22 Oct 2018 19:07:48 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..647d6fa 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,13 @@ data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') # Write your code here +def regression_plot(variable1,variable2): + return sns.lmplot(variable1, variable2, data=data, fit_reg=True) + + From bc8f4e5d44dd0905e22b025f7fe6d32fbf9cdfb1 Mon Sep 17 00:00:00 2001 From: sahusaurabh65 Date: Mon, 22 Oct 2018 19:12:01 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..48d50da 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,17 @@ +# %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): + return sns.heatmap(data.corr(), cmap='viridis') + + + + +