Home / Challenges / Compute Column Average with Pandas

Compute Column Average with Pandas

Easy
You are given a list of dictionaries representing rows of data, e.g. [{"name": "Alice", "score": 80}, {"name": "Bob", "score": 90}]. Write a function average_score(data) that builds a Pandas DataFrame from this data and returns the average of the "score" column.

Input

A list of dicts, each with "name" and "score" keys.

Output

A float representing the average score.

Example

Input
[{"name": "Alice", "score": 80}, {"name": "Bob", "score": 90}, {"name": "Carl", "score": 70}]
Output
80.0
10 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.