From 67331ea45b830d6be5a7d0f29f8af9f88dce07a1 Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Thu, 25 Oct 2018 09:49:26 +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..0d2ab2a 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 +dataframe = pd.read_csv('data/house_prices_multivariate.csv') +num_cols = ['LotArea' ,'GarageArea', 'OpenPorchSF','SalePrice'] +# 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(dataframe[num_cols[i]], kde=False) + plt.subplot(122) + sns.distplot(dataframe[num_cols[i+1]], kde=False) + plt.tight_layout() + plt.show() + else: + sns.distplot(dataframe[num_cols[i]], kde=False) + + + -data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') -# Write your code here : From ecc15494a756433eea7c90ddbcbb3ed40a88b36b Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Thu, 25 Oct 2018 09:53:17 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..ae612fb 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,28 @@ +# %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') - +dataframe = pd.read_csv('data/house_prices_multivariate.csv') +num_cols = [ 'LotArea' ,'GarageArea', 'OpenPorchSF','SalePrice'] # 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 = 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) + + +plot(num_cols) + From 2791c2b88ff6a4698856495e785d6ea997640b6f Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Thu, 25 Oct 2018 10:04:19 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..bbe859a 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 @@ -5,11 +6,17 @@ 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') +variable1 = 'GrLivArea' +variable2 = 'SalePrice' # Write your code here +def regression_plot(variable1,variable2): + sns.lmplot(variable1,variable2, data=dataframe, fit_reg=True) + plt.show() + + + From ee8b6fac9a04d94b17785dbd75aef5a277e556c6 Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Thu, 25 Oct 2018 10:09:48 +0000 Subject: [PATCH 4/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..64b6f1e 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() + + + + +