Pandas Hacks for the Friday Nighters
Pandas Hacks for the Friday Nighters
import pandas as pd
data = {
'Name': ['Dillon', 'Noor', 'Steven', 'Lucas', 'Harsha', 'Varalu', 'Ryan', 'Emaad'],
'Age': [24, 31, 42, 27, 29, 26, 90, 15],
'Gender': ['M', 'M', 'M', 'M', 'F', 'F', 'F', 'F'],
'Grade': ['A', 'B', 'A', 'D', 'C', 'F', 'B', 'A']
}
df = pd.DataFrame(data)
print(df)
print()
print()
# Data Analysis 1
print("THE AVERAGE AGE OF THE BOYS IS...")
print(df['Age'].mean())
# Data Analysis 2
print()
print()
print("THE MEDIAN AGE OF THE BOYS IS...")
print(df['Age'].median())
print()
print()
# Data Analysis 3
print("SOME STATISTICS ABOUT THE BOYS HEIGHTS:")
print(df.describe())