def compute_statistics(age_and_salary_data):
histograms(age_and_salary_data)
age = age_and_salary_data.column("Age")
salary = age_and_salary_data.column("Salary")
return make_array(np.mean(age), np.mean(salary))
full_stats = compute_statistics(full_data)
full_stats
This code is to: Create a function called compute_statistics that takes a Table containing ages and salaries and:
Draws a histogram of ages Draws a histogram of salaries Return a two-element list containing the average age and average salary
CodePudding user response:
In Python, if you want to access a column, you can use brackets like age_and_salary_data["Age"] and age_and_salary_data["Salary"], this column function does not exist.
CodePudding user response:
alternatively to age_and_salary_data["Age"] you may use age_and_salary_data.Age