Code Challenge 57 - Analyze Olympic Games Data With Pandas

Andrea Mammoliti, Tue 30 October 2018, Challenge

Anaconda, challenges, code challenge, csv, Jupyter, Kaggle, matplotlib, Olympic Games, Pandas, Plotly, Seaborn, statistics

Life is about facing new challenges - Kostya Tszyu

Hey Pythonistas,

A new week, a new Python code challenge!

This week you can use Python, Pandas and all the libraries you need to analyze the data of Olympic Games and find out interesting things and present them to everyone with Matpolib, Seaborn and/or Plotly.

The Challenge

Basic/ required

Analyse statistics of Olympic Games in a CSV file that you can find on Kaggle.

  1. Find out the (male and female) athlete who won most medals in all the Summer Olympic Games (1896-2014). The answer will be Michael Phelps for the men and Larisa Latynina for the women.

  2. Display the first 10 countries that won most medals:

    • The order for men will be: USA, RUS, GBR, GER, FRA, ITA, SWE, HUN, AUS, JPN

    • The order for women will be: USA, RUS, GER, CHN, AUS, NED, ROU, GBR, JPN, HUN

  3. Use matplotlib to build line plots of the 10 most awarded countries for time span 1896-2012. Use the 10 most popular summer Olympics disciplines where most popular you can define yourself.

One requirement: use pandas to create a dataframe you can work on.

For the data visualization part, you can try matplotlib or Seaborn if you want to try a heatmap and different kind of visualizatios. You can install Jupyter (Anaconda) to work in an interactive notebook.

Don't be shy

Create a barplot which shows the total medals won for each sport during the summer Olympics.


To take this even further you could create a map and choose colors for each Country, pointing out the ones which won most medals. To get started on this, you can try plotly library, and specifically Choropleth Maps in Python.

Ideas and feedback

If you have ideas for a future challenge or find any issues, open a GH Issue or reach out directly.

Last but not least: there is no best solution, only learning more and better Python. Good luck!

Become a Python Ninja

At PyBites you get to master Python through Code Challenges:

Keep Calm and Code in Python!

-- Andrea