info_practices_Investigatory Report(shri.m12A) (2)
info_practices_Investigatory Report(shri.m12A) (2)
VIDYALAYA
SRI VIJAYA PURAM
SESSION: 2025-26
1 Certificate 1
2 Acknowledgement 2
3 Introduction 3-4
System Implementation
9 Bibliography 27
CERTIFICATE
2025-2026.
ACKNOWLEDGEMENT
1
In the accomplishment of this project successfully,
INTRODUCTION
MENU SYSTEM
Upon execution, the program presents a user-friendly, menu-driven interface
allowing the user to explore and analyse the Olympic Games Paris 2024
Medals Dataset. The system is divided into three main modules:
Main Menu:
2. Modification 4. Exit..
1. Display Information:
3
View the complete dataset List top-performing countries
by total medals
Search for a specific country's
medal tally Explore sport/event-wise
medal distribution
2. Modification:
This module enables the user to modify the dataset (if implemented), including:
3. Visualization:
VISUALIZATION MENU
Sub-options
4. Bronze Medals
This menu system offers a structured and interactive approach for users to
explore the data analytically and visually, making the project more practical and
user-centric.
OBJECTIVE AND SCOPE OF A PROJECT
4
OBJECTIVES:
The primary objectives of this project titled “Olympic Games Paris 2024
Medals Analysis” are as follows:
SCOPE
Data Handling: The project uses Olympic 2024 medal data stored in a
CSV file, which is read and processed through Python using pandas. The
data includes fields such as Country, Sport/Event, Medal Type, and more.
THEORITICAL BACKGROUND
PYTHON 5
CSV
6
A CSV (Comma-Separated Values) file is a plain text
file that stores data in a tabular format, where values are
separated by commas. It's a simple and widely used
format for exporting and importing data between
different software programs and databases.
Analysis:
To solve the above problems, the project follows a systematic approach using
Python and CSV files with the help of libraries like pandas and matplotlib.
The entire functionality is broken down into the following analytical modules:
10
SYSTEM DESIGN & DEVELOPMENT
DATABASE DESIGN
NOTE
The Olympic 2024 medals data used in this project
contains a total of 1,045 records. Due to space
limitations, only the first few entries (1 to 92) are shown
below for reference
P.T.O
11
Figure 1
Figure 3
Figure 4
13
CODING
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as mcolors
def n_colors(n):
lst_colors=[]
cmap=plt.get_cmap('tab20',n)
for i in range(n):
lst_colors.append(mcolors.to_hex(cmap(i)))
return lst_colors
def display_menu():
print('-' * 50)
print('\tOLYMPIC GAMES PARIS 2024 MEDALS ANALYSIS')
print('-' * 50)
print('*' * 70)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 130)
df=pd.read_csv('medals.csv')
# Main Program Loop
while True:
display_menu()
try:
ch = int(input("Enter Your Choice: "))
except ValueError:
print("Please enter a valid number.")
continue
if ch == 1:
print("\n\t\t\t\tDISPLAY OF ALL INFORMATION")
while True:
print("\nYour Choices are:")
print("\t\t1. Show Records of Olympic Games 2024")
print("\t\t2. Show the country wise Medals")
print("\t\t3. Show the country with Large number of Total
Medals(Top 5)")
print("\t\t4. Show the countries with Least number of Total
Medals")
print("\t\t5. Show medal details for specific country")
print("\t\t6. Show medal details for specific country medal
wise")
print("\t\t7. Exit..")
try:
sub_ch = int(input("\nYour choice: "))
except ValueError:
14
print("Please enter a valid number.")
continue
if sub_ch == 1:
print(df.head(20))
elif sub_ch == 2:
print(df.groupby("Country")["Medal"].count())
#max_medals = df.loc[df["Total number of
medals"].idxmax()]
#print(f"\nCountry with Most Medals: {max_medals['Name
of the Countries']} ({max_medals['Total number of medals']})")
elif sub_ch == 3:
cm=df.groupby("Country")["Medal"].count()
print(cm.sort_values(ascending=False).head())
elif sub_ch == 4:
cm=df.groupby("Country")["Medal"].count()
country=cm[cm==1]
print(country)
elif sub_ch==5:
country=input("Enter the country name to display
records:")
print(df[df['Country']==country])
elif sub_ch==6:
country=input("Enter the country name to display
records:")
if country in df.Country.values:
cod=df[df['Country']==country]
print(cod.groupby('Medal')['Medal'].count())
else:
print("No Country Name Found....")
elif sub_ch == 7:
break
else:
print("Invalid choice! Please try again.")
elif ch == 2:
print("\n\t\t\t\tMODIFICATION")
while True:
print("\nYour Choices are:")
print("\t\t1. Add a Row")
print("\t\t2. Modify a Row")
print("\t\t3. Delete a Row")
print("\t\t4. Add a blank column")
print("\t\t5. Delete a column")
print("\t\t6. Exit from Modification")
try:
mod_ch = int(input("\nYour choice: "))
except ValueError:
print("Please enter a valid number.")
continue
if mod_ch == 1:
med=input("Enter Medal:")
name=input("Enter Name (Individual or Team):")
con=input("Enter Country Name:")
g=input("Enter Gender:")
dis=input("Enter Discipline:")
ev=input("Enter Event:")
et=input("Enter Event Type:")
15
df.loc[len(df)+1,:]=[med,name,g,dis,ev,et,con]
print("\nRow Added. Updated DataFrame:")
df.to_csv("medals.csv",index=False)
elif mod_ch == 2:
idx=int(input("Enter index to modify record:"))
med=input("Enter Medal:")
name=input("Enter Name (Individual or Team):")
con=input("Enter Country Name:")
g=input("Enter Gender:")
dis=input("Enter Discipline:")
ev=input("Enter Event:")
et=input("Enter Event Type:")
df.loc[idx,:]=[med,name,g,dis,ev,et,con]
print("\nRow Modified. Updated DataFrame:")
df.to_csv("medals.csv",index=False)
elif mod_ch == 3:
idx=int(input("Enter index to delete record:"))
df=df.drop(idx,axis=0)
print("\n Row Deleted....")
df.to_csv("medals.csv",index=False)
elif mod_ch==4:
c=input("Enter New Column Name to insert:")
pos=int(input("Enter Position where you want to add a
column:"))
df.insert(pos-1,c,None)
print("Column Inserted....")
df.to_csv("medals.csv",index=False)
elif mod_ch==5:
c=input("Enter column name to delete:")
df=df.drop(c,axis=1)
print('Column Deleted...')
df.to_csv("medals.csv",index=False)
elif mod_ch == 6:
break
else:
print("Invalid choice! Please try again.")
elif ch == 3:
print("\n\t\t\t\tVISUALIZATION")
while True:
print("\nYour Choices are:")
print("\t\t1. Line Chart")
print("\t\t2. Bar Graph")
print("\t\t3. Histogram")
print("\t\t4. Exit Visualization")
try:
vis_ch = int(input("\nYour choice: "))
except ValueError:
print("Please enter a valid number.")
continue
if vis_ch == 1:
print("\n\t\t\t\tLine Chart")
while True:
print("\nYour Choices are:")
print("\t\t1. Top 10 countries")
print("\t\t2. Gold Medal")
print("\t\t3. Silver Medals")
16
print("\t\t4. Bronze Medals")
print("\t\t5. Speciifc Country")
print("\t\t6. Event wise")
print("\t\t7. Exit")
try:
line_chart_ch = int(input("\nYour choice: "))
except ValueError:
print("Please enter a valid number.")
continue
if line_chart_ch==1:
medals_tot=df["Country"].value_counts().head(10)
plt.plot(medals_tot.index,medals_tot.values,marker='d',color='r',label=
'Medals')
plt.xlabel("Country")
plt.ylabel("Number of Medals")
plt.title("Total Medals by Country")
plt.legend()
plt.show()
elif line_chart_ch==2:
gold_medals=df[df["Medal"]=="Gold Medal"]
gold_medals_cnt=gold_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
gold_medals_cnt=gold_medals_cnt.head(dt)
plt.plot(gold_medals_cnt.index,gold_medals_cnt,marker='o',color='Gold',
label='Gold')
plt.xlabel("Country")
plt.ylabel("Gold Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif line_chart_ch==3:
silver_medals=df[df["Medal"]=="Silver Medal"]
silver_medals_cnt=silver_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
silver_medals_cnt=silver_medals_cnt.head(dt)
plt.plot(silver_medals_cnt.index,silver_medals_cnt,marker='x',color='Si
lver',label='Silver')
plt.xlabel("Country")
plt.ylabel("Gold Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif line_chart_ch==4:
bronze_medals=df[df["Medal"]=="Bronze Medal"]
bronze_medals_cnt=bronze_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
bronze_medals_cnt=bronze_medals_cnt.head(dt)
17
plt.plot(bronze_medals_cnt.index,bronze_medals_cnt,marker='x',color='k'
,label='Bronze')
plt.xlabel("Country")
plt.ylabel("Bronze Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif line_chart_ch==5:
c=input("Enter country to plot:")
medals=df[df["Country"]==c]
medals=medals.groupby("Medal").size()
plt.plot(medals.index,medals.values,marker='^',color='m',label='Medals'
)
plt.xlabel(c)
plt.ylabel("Number of Medals")
plt.title("Total Medals by Country")
plt.legend()
plt.show()
elif line_chart_ch==6:
medals=df.groupby("Event_type").size()
medals.plot(kind='line',marker='>',color='m',label='Medals')
plt.xlabel("Event Type")
plt.ylabel("Number of Medals")
plt.title("Medals by Event")
plt.legend()
plt.show()
elif line_chart_ch==7:
break
else:
print("Invalid Choice:")
elif vis_ch == 2:
print("\nYour Choices are:")
print("\t\t1. Top 10 countries")
print("\t\t2. Gold Medal")
print("\t\t3. Silver Medals")
print("\t\t4. Bronze Medals")
print("\t\t5. Speciifc Country")
print("\t\t6. Event wise")
print("\t\t7. Exit")
try:
bar_chart_ch = int(input("\nYour choice: "))
except ValueError:
print("Please enter a valid number.")
continue
if bar_chart_ch==1:
medals_tot=df["Country"].value_counts().head(10)
colors = ["blue", "red", "green", "purple",
"orange","cyan", "magenta", "yellow", "pink", "brown"]
plt.bar(medals_tot.index,medals_tot.values,color=colors,label='Medals')
plt.xlabel("Country")
plt.ylabel("Number of Medals")
plt.title("Total Medals by Country")
plt.legend()
18
plt.show()
elif bar_chart_ch==2:
gold_medals=df[df["Medal"]=="Gold Medal"]
gold_medals_cnt=gold_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
clrs=n_colors(dt)
gold_medals_cnt=gold_medals_cnt.head(dt)
plt.bar(gold_medals_cnt.index,gold_medals_cnt,color=clrs,label='Gold')
plt.xlabel("Country")
plt.ylabel("Gold Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif bar_chart_ch==3:
silver_medals=df[df["Medal"]=="Silver Medal"]
silver_medals_cnt=silver_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
clrs=n_colors(dt)
silver_medals_cnt=silver_medals_cnt.head(dt)
plt.bar(silver_medals_cnt.index,silver_medals_cnt,color=clrs,label='Sil
ver')
plt.xlabel("Country")
plt.ylabel("Gold Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif bar_chart_ch==4:
bronze_medals=df[df["Medal"]=="Bronze Medal"]
bronze_medals_cnt=bronze_medals["Country"].value_counts()
dt=int(input("Enter no. of records you want to
plot:"))
clrs=n_colors(dt)
bronze_medals_cnt=bronze_medals_cnt.head(dt)
plt.bar(bronze_medals_cnt.index,bronze_medals_cnt,color=clrs,label='Bro
nze')
plt.xlabel("Country")
plt.ylabel("Bronze Medals")
plt.title("Total Gold Medals by Country")
plt.legend()
plt.show()
elif bar_chart_ch==5:
c=input("Enter country to plot:")
medals=df[df["Country"]==c]
medals=medals.groupby("Medal").size()
plt.bar(medals.index,medals.values,color=['b','gold','silver'],label='M
edals')
plt.xlabel(c)
plt.ylabel("Number of Medals")
plt.title("Total Medals by Country")
19
plt.legend()
plt.show()
elif bar_chart_ch==6:
medals=df.groupby("Event_type").size()
medals.plot(kind='bar',label='Medals')
plt.xlabel("Event Type")
plt.ylabel("Number of Medals")
plt.title("Medals by Event")
plt.legend()
plt.show()
elif bar_chart_ch==7:
break
elif vis_ch==3:
medal_cnt=df["Medal"].value_counts()
plt.hist(medal_cnt.values, bins=len(medal_cnt),
color='skyblue', edgecolor='black', cumulative=True)
plt.show()
elif vis_ch == 4:
break
else:
print("Invalid choice! Please try again.")
elif ch == 4:
print("Thank you for using the program!")
break
else:
print("Invalid choice! Please try again.")
OUTPUT
20
runfile('C:/Users/ASUS/untitled1.py', wdir='C:/Users/ASUS')
--------------------------------------------------
--------------------------------------------------
**********************************************************************
1. Display Information
2. Modification
3. Visualization
4. Exit..
VISUALIZATION
1. Line Chart
2. Bar Graph
3. Histogram
4. Exit Visualization
Your choice: 1
Line Chart
1. Top 10 countries
2. Gold Medal
3. Silver Medals
4. Bronze Medals
5. Speciifc Country
6. Event wise
7. Exit
Your choice: 1
21
Your Choices are:
1. Top 10 countries
2. Gold Medal
3. Silver Medals
4. Bronze Medals
5. Speciifc Country
6. Event wise
7. Exit
Your choice: 2
22
Your Choices are:
1. Top 10 countries
2. Gold Medal
3. Silver Medals
4. Bronze Medals
5. Speciifc Country
6. Event wise
7. Exit
Your choice: 7
1. Line Chart
2. Bar Graph
3. Histogram
4. Exit Visualization
Your choice: 2
Your Choices are:
1. Top 10 countries
2. Gold Medal
3. Silver Medals 23
4. Bronze Medals
5. Speciifc Country
6. Event wise
7. Exit
Your choice: 4
1. Line Chart
2. Bar Graph
3. Histogram
4. Exit Visualization
Your choice: 4
25
SYSTEM IMPLEMENTATION
26
BIBLIOGRAPHY
1. https://www.python.org/doc/
2. https://pandas.pydata.org/docs/
3. https://matplotlib.org/stable/index.html
4. https://www.kaggle.com
5. Olympics Paris 2024 – Official Website. Retrieved from
https://olympics.com/en/olympic-games/paris-2024
6. https://www.w3schools.com/python/python_file_handling.asp
7. NCERT. Informatics Practices – Class XII Textbook. National Council of Educational
Research and Training, New Delhi.
8. Real Python. (2024). Working with CSV Files in Python. Retrieved from
https://realpython.com/python-csv/
27