<jupyter_start><jupyter_text>Summer Olympics Data Analysis Assignment<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df= pd.read_csv('summer.csv')
df.head(10)<jupyter_output><empty_output><jupyter_text>**1. In how many cities Summer Olympics is held so far?**<jupyter_code>unique_cities= len(df['City'].unique())

print('In {} cities the Summer Olympics has been held so far.'.format(unique_cities),end='\n\n')
df['City'].unique()<jupyter_output>In 22 cities the Summer Olympics has been held so far.<jupyter_text>**2. Which sport is having most number of Gold Medals so far? (Top 5)**<jupyter_code>df1= df[df['Medal']=='Gold']
data=[]
for sport in df1['Sport'].unique():
  data.append([sport,len(df1[df1['Sport']==sport])])

data=pd.DataFrame(data,columns = ['Sports','Golds won']).sort_values(by='Golds won', ascending=False).head()
data

data.plot(x = 'Sports',y = 'Golds won', kind = 'bar', figsize = (10,5), color='lightblue')<jupyter_output><empty_output><jupyter_text>**3. Which sport is having most number of medals so far? (Top 5)**<jupyter_code>data1=[]

for sport in df['Sport'].unique():
  data1.append([sport,len(df[df["Sport"]==sport])])

data1=pd.DataFrame(data1,columns=["Sports","Medals won"]).sort_values(by="Medals won",ascending=False).head()

data1
data1.plot(x = "Sports", y = "Medals won", kind='bar', figsize= (10,5), color="darkviolet")<jupyter_output><empty_output><jupyter_text>**4. Which player has won most number of medals? (Top 5)**<jupyter_code>data2=[]

for player in df["Athlete"].unique():
    data2.append([player,len(df[df["Athlete"]==player])])

data2=pd.DataFrame(data2,columns=["Athlete","Medals Won"]).sort_values(by="Medals Won",ascending=False).head()
data2
data2.plot(x = "Athlete", y = 'Medals Won', figsize = (12,5), kind = "bar", color = "purple")<jupyter_output><empty_output><jupyter_text>**5. Which player has won most number Gold Medals of medals? (Top 5**<jupyter_code>data3=[]

for player in df1["Athlete"].unique():
    data3.append([player,len(df1[df1["Athlete"]==player])])

data3=pd.DataFrame(data3,columns=["Athlete","Gold Wons"]).sort_values(by="Gold Wons",ascending=False).head()
data3
data3.plot(x = "Athlete", y = "Gold Wons", kind = 'bar', figsize = (10,5), color = "darkblue")<jupyter_output><empty_output><jupyter_text>**6. In which year India won first Gold Medal in Summer Olympics?**<jupyter_code>df2= df[ (df['Country']=='IND') & (df['Medal']=='Gold')]
df2.head(1).sort_values(by='Year',ascending=True)<jupyter_output><empty_output><jupyter_text>**7. Which event is most popular in terms on number of players? (Top 5)**<jupyter_code>data4=[]

for Event in df["Event"].unique():
    data4.append([Event,len(df[df["Event"]==Event])])


data4 = pd.DataFrame(data4,columns=["Events","No. of Players"]).sort_values(by="No. of Players",ascending=False).head()
data4
data4.plot(x = "Events", y = "No. of Players", kind = "bar", figsize = (12,5),color = "lightgreen")<jupyter_output><empty_output><jupyter_text>**8. Which sport is having most female Gold Medalists? (Top 5)**<jupyter_code>df3=df[ (df["Medal"]=="Gold") & (df['Gender']!='Men')]
df3
data5=[]
for sport in df3["Sport"].unique():
    data5.append([sport,len(df3[df3["Sport"]==sport])])
    
data5=pd.DataFrame(data5,columns=["Sport","Female(Wons Gold)"]).sort_values(by="Female(Wons Gold)",ascending=False).head()
data5
data5.plot(x = "Sport", y = "Female(Wons Gold)", kind = 'bar', figsize = (10,5), color='lime')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1993725042783799, 'fraction_numerical': 0.023103251568739304, 'mean_word_length': 7.969309462915601, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '33519', 'license': 'MIT', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1301, 'n_words': 262, 'path': 'ETG_summer_olympics.ipynb', 'repo_name': 'Wsahil/ETG-Summer-Olympics', 'size': '3506'}