Created
May 25, 2020 17:58
-
-
Save theyesils/7fad6ce8d28f594f77b3f1ce6de579ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the libraries we need | |
import numpy as np | |
import pandas as pd | |
from scipy import stats | |
#download the dataset | |
data=pd.read_csv("mafs.csv") | |
data.info() | |
#select the age variable using iloc[] function | |
age=data.iloc[:,4:5].values | |
type(data.iloc[:,4:5].values) | |
#mean | |
np.mean(age) | |
#median | |
np.median(age) | |
#mode | |
mode=stats.mode(age) | |
print('mode is :',mode[0]) | |
#quartiles | |
np.percentile(age,[25,50,75]) | |
#converting numpy to DataFrame | |
ages=pd.DataFrame(age) | |
#describe function for summary of central tendency | |
ages.describe() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment