From 4fc22788a342dd086854c96e28bace614c4ba116 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Wed, 16 Jan 2019 04:44:30 +0000 Subject: [PATCH 1/4] Done --- q01_plot/build.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/q01_plot/build.py b/q01_plot/build.py index 0425964..ec4db4d 100644 --- a/q01_plot/build.py +++ b/q01_plot/build.py @@ -1,8 +1,29 @@ +# %load q01_plot/build.py +# Default imports import matplotlib.pyplot as plt +plt.switch_backend('agg') 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): + fig, axes = plt.subplots(2, 2,) + axes[0, 0].hist(data.LotArea,) + axes[0, 1].hist(data.GarageArea) + axes[1, 0].hist(data.OpenPorchSF) + axes[1, 1].hist(data.SalePrice) + plt.show() +plt.hist(data.GarageArea,bins=20) +fig, axes = plt.subplots(2, 2,) +axes[0, 0].hist(data.LotArea,) +axes[0, 1].hist(data.GarageArea) +axes[1, 0].hist(data.OpenPorchSF) +axes[1, 1].hist(data.SalePrice) +plt.show() +from inspect import getfullargspec +getfullargspec(plot) + + From 24665f60582409ee21cfcd0117d1deee687f5ff4 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Wed, 16 Jan 2019 04:53:13 +0000 Subject: [PATCH 2/4] Done --- q02_plot/build.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/q02_plot/build.py b/q02_plot/build.py index 67b4924..9622b7a 100644 --- a/q02_plot/build.py +++ b/q02_plot/build.py @@ -1,11 +1,36 @@ +# %load q02_plot/build.py # Default imports import pandas as pd import matplotlib.pyplot as plt +plt.switch_backend('agg') 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): + _, args=plt.subplots(2,2) + if num_cols>0: + args[0,0].boxplot(data.LotArea) + if num_cols>1: + args[0,1].boxplot(data.GarageArea) + if num_cols>2: + args[1,0].boxplot(data.OpenPorchSF) + if num_cols>3: + args[1,1].boxplot(data.SalePrice) + +plt.boxplot(data.GarageArea) +num_cols=10 +_, args=plt.subplots(2,2) +if num_cols>0: + args[0,0].boxplot(data.LotArea) +if num_cols>1: + args[0,1].boxplot(data.GarageArea) +if num_cols>2: + args[1,0].boxplot(data.OpenPorchSF) +if num_cols>3: + args[1,1].boxplot(data.SalePrice) +plot(5) + From d7c3a55e3d1e0cdf580d155fa1485bd2b4809e17 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Wed, 16 Jan 2019 04:58:57 +0000 Subject: [PATCH 3/4] Done --- q03_regression_plot/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q03_regression_plot/build.py b/q03_regression_plot/build.py index 2aaf8f6..6cf8528 100644 --- a/q03_regression_plot/build.py +++ b/q03_regression_plot/build.py @@ -1,16 +1,23 @@ +# %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') # Write your code here +def regression_plot(var1,var2): + sns.lmplot(x=var1,y=var2,data=data) + + +sns.lmplot(x='SalePrice',y='GrLivArea',data=data) +regression_plot('SalePrice','GrLivArea') From 2e4a98cef1d839a2d8c10a73b4c48f9116cca95e Mon Sep 17 00:00:00 2001 From: iampa1 Date: Wed, 16 Jan 2019 05:02:53 +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..a9e247c 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 +plt.switch_backend('agg') import seaborn as sns data = pd.read_csv('data/house_prices_multivariate.csv') -plt.switch_backend('agg') # Write your code here +def cor(data): + sns.heatmap(data.corr()) + + +data.corr() +sns.heatmap(data.corr()) + +