Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_calculate_statistics/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_calculate_statistics/__pycache__/build.cpython-36.pyc
Binary file not shown.
21 changes: 18 additions & 3 deletions q01_calculate_statistics/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# %load q01_calculate_statistics/build.py
# Default Imports
import numpy as np
import pandas as pd

data = pd.read_csv('data/house_prices_multivariate.csv')
sale_price = data.loc[:, "SalePrice"]


# Return mean,median & mode for the SalePrice Column
# Write your code here
def calculate_statistics():

data = pd.read_csv('data/house_prices_multivariate.csv')
sale_price = data.loc[:, 'SalePrice']

mean = sale_price.mean()
median = sale_price.median()
mode = sale_price.mode()[0]

return mean,median,mode

calculate_statistics()






Binary file not shown.
Binary file not shown.
Binary file modified q02_plot/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_plot/__pycache__/build.cpython-36.pyc
Binary file not shown.
28 changes: 25 additions & 3 deletions q02_plot/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
# %load q02_plot/build.py
# Default Imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from greyatomlib.descriptive_stats.q01_calculate_statistics.build import calculate_statistics

plt.switch_backend('agg')
dataframe = pd.read_csv('data/house_prices_multivariate.csv')
sale_price = dataframe.loc[:, 'SalePrice']
#To be uncommented while test case check
#plt.switch_backend('agg')



# Draw the plot for the mean, median and mode for the dataset
def plot():

dataframe = pd.read_csv('data/house_prices_multivariate.csv')
sale_price = dataframe.loc[:, 'SalePrice']

plt.hist(sale_price, bins=60)

plt.axvline(x=sale_price.mean(),color='red',linestyle='--',label='Mean')
plt.axvline(x=sale_price.median(),color='black',linestyle='--',label='Median')
plt.axvline(x=sale_price.mode()[0],color='orange',linestyle='--',label='Mode')

plt.legend(loc=0)

plt.show()

plot()





Binary file modified q02_plot/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_plot/tests/__pycache__/test_q02_plot.cpython-36.pyc
Binary file not shown.
Binary file modified q03_pearson_correlation/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q03_pearson_correlation/__pycache__/build.cpython-36.pyc
Binary file not shown.
19 changes: 15 additions & 4 deletions q03_pearson_correlation/build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# %load q03_pearson_correlation/build.py
# Default Imports
import pandas as pd

dataframe_1 = pd.read_csv('data/house_prices_multivariate.csv')
dataframe_2 = pd.read_csv('data/house_prices_copy.csv')

from scipy.stats.stats import pearsonr

# Return the correlation value between the SalePrice column for the two loaded datasets
# Your code here
def correlation():

dataframe_1 = pd.read_csv('data/house_prices_multivariate.csv')
dataframe_2 = pd.read_csv('data/house_prices_copy.csv')

return pearsonr(dataframe_1.SalePrice, dataframe_2.SalePrice)[0]


#Call to the function
correlation()



Binary file not shown.
Binary file not shown.
Binary file modified q04_spearman_correlation/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q04_spearman_correlation/__pycache__/build.cpython-36.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions q04_spearman_correlation/build.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# %load q04_spearman_correlation/build.py
# Default Import
import pandas as pd
from scipy.stats import spearmanr

dataframe_1 = pd.read_csv('data/house_prices_multivariate.csv')
dataframe_2 = pd.read_csv('data/house_prices_copy.csv')

# Your code here
def spearman_correlation():
return spearmanr(dataframe_1.SalePrice,dataframe_2.SalePrice)[0]

#Call to the function
spearman_correlation()


Binary file not shown.
Binary file not shown.