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 : 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]) + + + 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) + + 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') + + + + +