Exercise

# Computing fraction of medals per Olympic edition

In this exercise, you'll start with the DataFrames `editions`

, `medals`

, & `medal_counts`

from prior exercises.

You can extract a Series with the total number of medals awarded in each Olympic edition.

The DataFrame `medal_counts`

can be divided row-wise by the total number of medals awarded each edition; the method `.divide()`

performs the broadcast as you require.

This gives you a normalized indication of each country's performance in each edition.

Instructions

**100 XP**

- Set the index of the DataFrame
`editions`

to be`'Edition'`

(using the method`.set_index()`

). Save the result as`totals`

. - Extract the
`'Grand Total'`

column from`totals`

and assign the result back to`totals`

. - Divide the DataFrame
`medal_counts`

by`totals`

along each row. You will have to use the`.divide()`

method with the option`axis='rows'`

. Assign the result to`fractions`

. - Print first & last 5 rows of the DataFrame
`fractions`

. This has been done for you, so hit 'Submit Answer' to see the results!