NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship 🏆 Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release 🎉
Free Lesson
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See 🔥
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular 🔥 Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New 🎉 Generative AI for Finance New 🎉 Generative AI for Marketing New 🎉
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular 🔥 Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular 🔥 Data Science R: Machine Learning Designing and Implementing Production MLOps New 🎉 Natural Language Processing for Production (NLP) New 🎉
Find Inspiration
Get Course Recommendation Must Try 💎 An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release 🎉
Free Lessons
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See 🔥
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Student Works > Analysis of Olympic Games by web scraping

Analysis of Olympic Games by web scraping

shuo zhang
Posted on Aug 22, 2016

Contributed by Shuo Zhang. She is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between  July 5th  to September 23rd, 2016.

 

Introduction

I really like to watch the summer Olympics.  It’s simply breathtaking to watch the world's best athletes compete in the various sports!  I also love the Olympics because of the plethora of data available. From judging to timing to preliminary rounds to finals to the the various Olympic records, there is data for every sport and country at the Olympic Games. Most of it, especially more recent data, is free and easy to find. The Rio Olympics is almost over, but we can be confident of one thing:  the US, United Kingdom and China will top the medals table when it's all over. One question we might want to ask is why these countries are so successful. Has the Olympic games achieve gender equality in competitors?  Does age impact the number of medals the athletes can get? Data can help answer these questions.

 

Web Scraping

Past summer Olympics data can be found at: http://www.sports-reference.com/olympics/.

The overall website is organized and structured very well. I wrote a web scraper in Python using the package "Beautiful Soup" and extracted the following data for the further analysis:

  • Events of country medal leaders among 28 summer Olympics : 1188 in total
  • Events of country medal leaders of 3 sports among 28 summer Olympics: 1141 in total
  • Events of sports, athletes and medalists of 84 countries during 2012 Olympics: 9457 in total

Here's an example of the code used to do the scraping:
https://gist.github.com/shuozhang1985/388551d7417d5877219462e23ba39f44

 

Data Exploration and Modeling

What affects the total medals won by different countries?

Analyzing the number of Olympic medals won by geographic region by year reveals the true impact and extent of medal diversification.  For example, whilst more countries are winning Olympic medals, how many medals are they capturing compared to traditionally strong Olympic nations? Is their success fairly minor or more pronounced?  What are the possible contributing factors to their success in the Olympics? I listed the history of total medals won by the top 13 leading countries.

Rplot

This graph shows that since the first modern Olympic games, the landscape of medal-winning nations has markedly changed. Before World War II, Olympic success was dominated by the United States and Europe. Afterwards, more African and Asian countries begin to participate in the Olympics and the medal standings are marked by the arrival and growth of many regions including Japan, South Korea, China and Hungary. Here are three factors that affect medal standings revealed by analysis:

Past Olympic success: Medals won in the past can be seen as an indicator of a "sports culture".  The United States, for example, always perform quite well. Sporting prowess is important to them so  many people take part.

Host-country effect: The United States hosted the 1904 Olympics and won 231 medals compared to 48 at the previous games. The phenomena occurs again and again.  For instance,  China hosted the 2008 Olympics and collected 100 medals compared to 63 at the previous Olympics. This is a recognized pattern. Performing in front of a home crowd combined with extra investment in sport  gives the host country a medals boost.

Future-host effect: Australia won 27 medals in 1992 followed by 41 medals four years later. This was probably due to increased investment in sport in the run-up to the 2000 Sydney Games. The UK, as another example, increased its medal haul from 30 to 47 between 2004 and 2008, prior to hosting the 2012 Games.

2

This graph also illustrates some national indicators such as GDP, population, GDP growth and life expectancy also possibly play roles in the medal-winning battle of the Olympics:

Wealth: Countries with a high GDP, like Germany or the USA, can afford to invest in sports facilities and their populations have enough leisure time and money to take part in sports. This may not be the case in poorer countries.

Population: A big population means a big talent pool to choose athletes from - in China's case, 1.36 billion people.

Planned economies: These countries with a high GDP growth  tend to invest more in sport because they value the prestige that sporting success brings. China is a good example.

Health: Countries with a high life expectancy have a big healthy pool to choose athletes from such as Japan.

T0 take a closer look, I extracted the data from the 2012 Olympics - including the medal winning record of all the participating countries - and analyzed the relationship between total winning-medals won by each country and its population, GDP, GDP growth and life expectancy.

3

This correlation graph demonstrates the total winning-medals is primarily correlated with population and also other variables such as GDP and life expectancy affect the total winning-medals. And the scatterplots illustrates cluster pattern between the five variables. Thus, a K-means clustering model is applied to find the underlying pattern.

K-means clustering

K-Means clustering is an unsupervised learning algorithm that tries to cluster data based on their similarity. Unsupervised learning means that there is no outcome to be predicted, and the algorithm just tries to find patterns in the data. The key of K-means clustering is to determine the number of clusters, K. I used the average silhouette method to determine K.

4

The graph indicates that the optimal number of clusters is 5. I choose two dimensions that cover the most of data and plot the data to see the clusters.

5

The distribution of the 5 clusters by different variables is illustrated below and we can see cluster 5 has highest average total winning-medals, a relatively high average population, a relatively high average GDP per capita, a relatively low average GDP growth and a relatively long average life expectancy. Cluster 4 has the lowest average total winning-medals, a relatively small average population, the lowest average GDP per capita, the highest average GDP growth and the shortest average life expectancy. Which countries belong to these clusters?

8

To get a clear view of the country distribution, I only labeled the top 5 leading countries in the total medals standings in cluster 2, 3, 4 in the following graph.  We can see the K-means clustering well separates the countries to developing and developed countries. While developed countries win the most medals, China as a developing-country catches our eye for its successful performance in the Olympics.

7

By applying the same K-means clustering to the data of 2008 Olympics, we can see the same pattern in the below graph.

1

The analysis can be found in the following link:
https://gist.github.com/shuozhang1985/a646354e92dadd010f08cc63f0d70a78

 

Which countries dominate the 3 traditional sports: athletics, swimming and gymnastics?

I created a breakdown of which countries the data shows will excel in which sports by investigating its past performance in 28 summer Olympics, given the total medal values– where a gold medal is worth three points, silver two and bronze one.

athletics:

10

swimming:

11

gymnastics:

12

The three graphs shows that United States, Russia and Jamaica are likely to dominate the athletics events, the United States, Australia and China excel in swimming, and China, the United States and Russia athletes are good at gymnastics.

The analysis  can be found in the following link:

https://gist.github.com/shuozhang1985/df2bdcb3ee74827de0cd02e530072ddf

Does the Olympics show gender equality?

13

This graph shows that more women participate in the Olympics. My focus is on the popular Olympic sports. What differences remain between the ways that male and female athletes are involved in Olympic competitions? I analyze all of the men’s and women’s events at the London 2012 Olympics to identify gender differences in the structure and rules of the sports, and in the opportunities for male and female athletes.

14

There were 132 women’s events, and 162 men’s events at the London 2012 Olympics. Of these, 57 events on the program are gender exclusive (i.e. there were medal opportunities for men but not for women and vice versa): 42 events are open only to men (25.9% of men’s events); and 15 events are open only to women (11.4% of women’s events). Together, these exclusive events constituted 18.9% of the Olympic programs.

15

This graph shows sport distribution of these exclusive events. For example, there are more men's events than women's in the wrestling and canoeing sports, while there are more women's events than men's in synchronized swimming and rhythmic gymnastics.

16

This graph shows a total of 10,903 athletes competed in the 302 medal events – 6,068 men and 4,835 women, so there are 1,233 more men than women competing in London. And male athletes compete for 991 medals while female athletes compete for 872 medals. In conclusion, the data shows that there is still some way to go to achieve gender equality.

Does age impact the number of medals?

I wanted to dig a little deeper, so I created density plots of the distribution of athletes’ age by 4 types: all athletes, athletes who won gold medals, athletes who won silver medals, and athletes who won bronze medals.

17

You can see that very young medalists (early teens), and older medalists (late 30s-over 40) tend to win fewer medals than medalists within the “sweet spot” of late teens-early 30s.

19

Some sports, like equestrianism, have older athletes winning medals, whereas a sport like gymnastics has a peak age-range of early-to-late teens  and early 20s.

Which sports produce the most medals in 2012 Olympics?

20

We can see which sports produce the most medals.  Athletics is number one, followed by swimming, rowing, and football. So if you’re an aspiring Olympian,but you’re not quite sure what sport to train for, you’ll increase your chances of medaling if you choose athletics.

The analysis can be found in the following link:

https://gist.github.com/shuozhang1985/da03c78e983b56f305650c4ac628b719

Future work

If I had more time,  I would apply K-means clustering to all the data from 1960-2004 and investigate whether the same pattern exists, and, if there is difference, what is the reason for this difference.

 

 

 

 

 

 

 

 

 

About Author

shuo zhang

Shuo Zhang graduated from Columbia University with a Ph.D degree in Chemical Engineering and the focus of her academic research was to design a protocol to synthesize layer-by-layer polymer films on nano-surfaces, investigate dynamics and kinetics, construct quantitative...
View all posts by shuo zhang >

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    © 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application