k8s-hpc-demo/demos/pandas/avg_house_pop.py
2019-05-02 12:25:06 -05:00

12 lines
358 B
Python

import pandas
data = pandas.read_csv('2010census.csv')
average_per_home = data['Total Population'] / data['Total Households']
calc_average = average_per_home.mean()
real_average = data['Average Household Size'].mean()
print("Real average is:", real_average)
print("Calculated average is:", calc_average)
print("Error is:", abs(calc_average-real_average))