From 585cdba8fcfb1ab29c397acd54acf8e6b992da7f Mon Sep 17 00:00:00 2001 From: vivekshingate Date: Mon, 26 Nov 2018 06:15:29 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..75121a2 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') +data = pd.read_csv('data/house_prices_multivariate.csv') + +# Write your code here: +plot_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]], hist=True, kde=True) + plt.subplot(122) + sns.distplot(data[num_cols[i+1]], hist=True, kde=True) + plt.tight_layout() + plt.show() +plot(plot_cols) + -# Write your code here : From eebf3119840965f04a6a6abb3fd90028ff441075 Mon Sep 17 00:00:00 2001 From: vivekshingate Date: Mon, 26 Nov 2018 06:36:21 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..f6c8f8e 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') - +df = pd.read_csv('data/house_prices_multivariate.csv') +#plt.switch_backend('agg') # Write your code here: +plot_cols = ['LotArea', 'GarageArea', 'OpenPorchSF', 'SalePrice'] + +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 = df) + plt.subplot(122) + sns.boxplot(facet, num_cols[i+1],data = df) + plt.tight_layout() + plt.show() + + +plot(plot_cols) + + From c5249336b4bb05b23a27710e90d479aa9e4d3e79 Mon Sep 17 00:00:00 2001 From: vivekshingate Date: Tue, 27 Nov 2018 18:38:32 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..960478a 100644 --- a/q03_regression_plot/build.py +++ b/q03_regression_plot/build.py @@ -1,16 +1,20 @@ +# %load q03_regression_plot/build.py # Default imports import pandas as pd import seaborn as sns import matplotlib.pyplot as plt +# plt.switch_backend('agg') - -data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') +df = pd.read_csv('data/house_prices_multivariate.csv') # Write your code here +def regression_plot(feature1,feature2): + sns.jointplot(feature1, feature2, data=df, kind='reg') + plt.show() + - +regression_plot('GrLivArea','SalePrice') From 44921c133a02a99c59984e817b421ef392d82f10 Mon Sep 17 00:00:00 2001 From: vivekshingate Date: Tue, 27 Nov 2018 18:52:33 +0000 Subject: [PATCH 4/4] Done --- q04_cor/build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/q04_cor/build.py b/q04_cor/build.py index f3fae50..04b4f82 100644 --- a/q04_cor/build.py +++ b/q04_cor/build.py @@ -1,10 +1,21 @@ +# %load q04_cor/build.py # Default imports import pandas as pd import matplotlib.pyplot as plt import seaborn as sns +plt.switch_backend('agg') data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') # Write your code here +def cor(df): + plt.figure(figsize = (8,5)) + sns.heatmap(df.corr(),cmap='viridis') + plt.show() + + + +cor(data) + +