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 new PyBites Code Challenges (PCCs) in your inbox.
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!
Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.
"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H
"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B
"This is now my favourite first Python go-to reference." - Anthony L
"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S