Olympics Data Analysis Using Python
In this article, we are going to see the Olympics analysis using Python. The modern Olympic Games or Olympics are leading international sports events featuring summer and winter sports competitions in which thousands of athletes from around the world participate in a variety of competitions. The Olympic Games are considered the world’s foremost sports competition with more than 200 nations participating.
The total number of events in the Olympics is 339 in 33 sports. And for every event there are winners. Therefore various data is generated. So, by using Python we will analyze this data.
- Pandas: It is used for analyzing the data,
- NumPy: NumPy is a general-purpose array-processing package.
- Matplotlib: It is a numerical mathematics extension NumPy
- seaborn: It is used for visualization statistical graphics plotting in Python
Model architecture :
Step 1: Importing libraries
Step 2: Understanding database
When dealing with Olympic data, we have two CSV files. One containing outturn sports-related costs of the Olympic Games of all years. And other is containing the information about athletes of all years when they participated with information.
CSV data file can be download from here: Datasets
Step 3: Data cleaning and formatting
We imported both the datasets using the .read_csv() method into a dataframe using pandas and displayed the first 5 rows of each dataset.
Step 4: Merging two DataFrame
Here we are going to merge two dataframe using pandas.merge() in python.
Data analysis of Olympics
Data is now available now using pandas and matplotlib lets see some examples
Data analysis of Gold medalists
Creating a new data frame including only gold medalists.
Gold medalist in respect of age:
Here we are going to create a graph of the number of gold medals with respect to age. For this, we will create countplot for graph representation which shows the X-axis as the age of the players and the Y-axis represent the number of medals.
Print the number of athletes who are gold medalists and whose age is greater than 50 with their info.
Create a new dataframe called masterDisciplines in which we will insert this new set of people and then create a visualization with it
Women who can play in summer
Display all women athletes who have played in the summer season and it show the increase in women athletes after a long period via graphical representation.
Top 5 countries who won the most medals
Here we are going to print the top 5 countries and show them in the graph with catplot.
Players weight Analysis
Here we are going to see how weight over year for Male Lifters via graphical representation using pointplot.
Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the Machine Learning Foundation Course at a student-friendly price and become industry ready.