This challenge write-up first appeared on PyBites.
Life is about facing new challenges - Kostya Tszyu
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.
Analyse statistics of Olympic Games in a CSV file that you can find on Kaggle.
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.
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
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.
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.
Last but not least: there is no best solution, only learning more and better Python. Good luck!
At PyBites you get to master Python through Code Challenges:
Subscribe to our blog (sidebar) to get a new PyBites Code Challenge (PCC) in your inbox every week.
Apart from this blog code challenge we have a growing collection of 50+, check them out on our platform.
Prefer coding bite-sized Python exercises in the comfort of your browser? Try our growing collection of Bites of Py.
Keep Calm and Code in Python!