This repository contains the code for an interactive web application that allows users to explore the history of the Olympic Games. The application is built using Streamlit, a Python library for creating interactive web apps. The data used in the application is from the Kaggle dataset.
To run this application, you will need the following:
- Python 3.6 or later
- Streamlit
- Pandas
- Numpy
- Matplotlib
- Seaborn
- plotly
You can install these dependencies using pip:
pip install streamlit pandas numpy matplotlib seaborn plotly
To run the application, clone this repository and then run the following command:
streamlit run app.py
The application will then be available at http://localhost:8501.
The code for the application is contained in the app.py
file. The code is divided into the following sections:
- Imports
- Data Loading and Preprocessing
- Sidebar
- Main Content
The first section of the code imports the necessary libraries.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import streamlit as st
import helper
import plotly.express as px
import plotly.figure_factory as ff
import plotly.graph_objects as go
The second section of the code loads the data from the CSV files and then preprocesses it.
dataset1 = pd.read_csv('athlete_events.csv')
dataset2 = pd.read_csv('noc_regions.csv')
dataset = helper.preprocess(dataset1,dataset2)
The preprocess()
function drops the duplicate rows from the dataset and then merges the two datasets on the NOC
column.
The third section of the code creates the sidebar for the application. The sidebar allows users to select the data they want to explore.
sidebar_data = st.sidebar.radio(
'Select an Option',
('Medal Tally','Overall Analysis','Countrywise Analysis
Generated by [BlackboxAI](https://www.useblackbox.ai)