Aditya_Pratap_Olympic_Analysis[1
Aditya_Pratap_Olympic_Analysis[1
Aditya_Pratap_Olympic_Analysis[1
Acknowledgement
It gives me immense pleasure in bringing out this synopsis of the
project entitled “BANK PROFILE MANGAEMENT SYSTEM”.
#DATAFRAME USED
####################################################
df=pd.read_csv('olymp_data.csv')
pd.set_option('display.max_columns',None)
def clear():
print("♦"*100)
for x in range(2):
print() def
menu():
ans=True
while ans:
print("""
****************************************************************
OLYMPICS GAMES ANALYSIS SYSTEM
****************************************************************
1- Data Visualisation
2- Data Analysis
3- Read CSV File
4- LINE CHART --> TOP 10 COUNTRIES VS TOTAL MEDALS
5- LINE CHART --> TOP 10 COUNTRIES VS TOTAL NO. OF TIMES PARTICIPATED (IN
SUMMER & WINTER)
6- BAR CHART --> TOP 10 COUNTRIES vs TOTAL NO. OF GOLD MEDALS
7- BAR CHART --> TOP 10 COUNTRIES VS TOTAL NO. OF SILVER MEDALS
8- BAR CHART --> TOP 10 COUNTRIES VS TOTAL NO. OF BRONZE MEDALS
9- PIE CHART --> TOP 5 COUNTRIES VS TOTAL MEDALS
10- Exit
""")
else:
print("\nInvalid choice. Try again")
continue
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦
# # OD ANALYSIS () # def
datavisual():
df = pd.read_csv('olymp_data.csv')
# Plotting Total Medals for the top 10 countries
df.sort_values(by='TotalMedal', ascending=False, inplace=True)
df_top10 = df.head(10) plt.figure(figsize=(10, 6))
plt.bar(df_top10['Country'], df_top10['TotalMedal'], color='blue')
plt.xlabel('Country') plt.ylabel('Total Medals')
plt.title('Top 10 Countries by Total Medals in the Olympics')
plt.xticks(rotation=45) plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
#2 # OD ANALYSIS () #
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦♦ def odanalysis(): print() print("♦"*80)
# Example analysis of country performance in the Olympics
df = pd.read_csv('olymp_data.csv')
print("\nStatistical Summary of Olympic Data:")
print(df.describe())
print("\nCountries with the Most Total Medals:")
top_countries = df[['Country', 'TotalMedal']].sort_values(by='TotalMedal',
ascending=False).head(5) print(top_countries)
# Additional analysis example
print("\nGold Medal Analysis (Top 5 Countries):")
top_gold = df[['Country', 'Goldmedal']].sort_values(by='Goldmedal',
ascending=False).head(5) print(top_gold)
print("♦"*80)
print()
print("Press any key.......")
wait=input()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
#3 # READ CSV EXCEL () #
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦ def read_csv_excel():
df = pd.read_csv("olymp_data.csv")
print(df)
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
# 4 TO PLOT LINE CHART --> TOP 10 COUNTRIES VS TOTAL MEDALS
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦ def line_chart1():
df=pd.read_csv('olymp_data.csv')
df.sort_values(by='TotalMedal', ascending=False, inplace=True)
df1=df.loc[:,['Country','TotalMedal']] df1=df1.head(10)
Countries=df1['Country'] Totalmedals=df1['TotalMedal']
plt.plot(Countries,Totalmedals,linestyle=':',color='green',marker='.')
x=np.arange(len(Countries)) plt.xticks(x,Countries,rotation=30)
plt.xlabel('Country~ ~ ~ ~ ~',fontsize=12,color='r')
plt.ylabel('Total Medals~ ~ ~ ~ ~',fontsize=12,color='r')
plt.title('TOTAL MEDALS WON BY TOP 10 COUNTRIES\n',color='blue',fontsize=18)
plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
# 5 TO PLOT LINE CHART --> TOP 10 COUNTRIES VS TOTAL NO. OF TIMES PARTICIPATED
(IN SUMMER & WINTER)
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
def line_chart2():
df=pd.read_csv('olymp_data.csv')
df.sort_values(by='TotalTimesPart', ascending=False, inplace=True)
df1=df.loc[:,['Country','SummerTimesPart','WinterTimesPart']]
df1=df1.head(10) Countries=df1['Country']
STotal=df1['SummerTimesPart'] Wtotal=df1['WinterTimesPart']
plt.plot(Countries,STotal,linestyle='dashed',color='orange',label='Summer',marker='+')
plt.plot(Countries,Wtotal,linestyle='dashed',color='dimgrey',label='Winter',marker='+')
x=np.arange(len(Countries)) plt.xticks(x,Countries,rotation=30)
plt.xlabel('Country~ ~ ~ ~ ~',fontsize=12,color='r')
plt.ylabel('No. of times participated~ ~ ~ ~ ~',fontsize=12,color='r')
plt.title('TOTAL NO. OF TIMES PARTICIPATED BY TOP 10
COUNTRIES\n',color='blue',fontsize=18)
plt.legend()
plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦
# 6 TO PLOT BAR CHART -->TOP 10 COUNTRIES vs TOTAL NO. OF GOLD MEDALS
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦ def bar_chart1():
df=pd.read_csv('olymp_data.csv')
df=df.sort_values('Tgoldmedal',ascending=False)
df1=df.head(10) x=np.arange(len(df1))
Countries=df1['Country']
totalgold=df1['Tgoldmedal']
plt.bar(x+0.25, totalgold,width=.6, label='Total No. of Gold Medals by Top 10
Countries',color='gold')
plt.xticks(x,Countries,rotation=45)
plt.title('Olympics Gold Medal Analysis of Top 10 Countries',color='blue',fontsize=16)
plt.xlabel('Countries~ ~ ~ ~ ~',fontsize=12,color='red') plt.ylabel('No. of Gold Medals~ ~ ~
~ ~',fontsize=12,color='red') plt.grid() plt.legend() plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦
#7 TO PLOT BAR CHART-->TOP 10 COUNTRIES VS TOTAL NO. OF SILVER MEDALS
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦♦ def bar_chart2(): df=pd.read_csv('olymp_data.csv')
df=df.sort_values('Tsilvermedal',ascending=False)
df1=df.head(n=10) x=np.arange(len(df1))
Countries=df1['Country']
totalsilver=df1['Tsilvermedal']
plt.bar(x+0.25,totalsilver,width=.6, label='Total No. of Silver Medals by Top 10
Countries',color='silver')
plt.xticks(x,Countries,rotation=30)
plt.title('Olympics Silver Medal Analysis of Top 10 Countries',color='blue',fontsize=16)
plt.xlabel('Countries ~ ~ ~ ~ ~',fontsize=12,color='red') plt.ylabel('No. of Silver Medals
~~~~~~~',fontsize=12,color='red') plt.grid() plt.legend() plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
#8 TO PLOT BAR CHART --> TOP 10 COUNTRIES VS TOTAL NO. OF BRONZE MEDALS
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def bar_chart3():
df=pd.read_csv('olymp_data.csv')
df=df.sort_values(['Tbronzemedal'],ascending= False)
df1=df.head(n=10) x=np.arange(len(df1))
Countries=df1['Country']
totalbronze=df1['Tbronzemedal']
plt.bar(x+0.25,totalbronze,width=.6,label='Total No. of Bronze Medals by Top 10
Countries',color='peru')
plt.xticks(x,Countries,rotation=30)
plt.title('Olympics Bronze Medal Analysis of Top 10 Countries',color='blue',fontsize=16)
plt.xlabel('Countries~~~~~~',fontsize=12,color='red')
plt.ylabel('No. of Bronze Medals~~~ ~~~',fontsize=12,color='red')
plt.grid() plt.legend() plt.show()
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
#9 PIE CHART --> TOP 5 COUNTRIES BY TOTAL MEDALS
#♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
♦♦♦♦♦♦♦♦
def pie_chart_top_countries():
# Sorting data to get the top 5 countries by total medals
df_sorted = df.sort_values(by='TotalMedal', ascending=False).head(5)
countries = df_sorted['Country']
total_medals = df_sorted['TotalMedal']
SOFTWARE REQUIREMENTS :
LIBRARIES INSTALLED
******************************