<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")<jupyter_output><empty_output><jupyter_text>1. In how many cities Summer Olympics is held so far?<jupyter_code>print ("Number of cities :" ,len(df['City'].unique()))
for city in df['City'].unique() :
  print(city)<jupyter_output>('Number of cities :', 22)
Athens
Paris
St Louis
London
Stockholm
Antwerp
Amsterdam
Los Angeles
Berlin
Helsinki
Melbourne / Stockholm
Rome
Tokyo
Mexico
Munich
Montreal
Moscow
Seoul
Barcelona
Atlanta
Sydney
Beijing<jupyter_text>2. Which sport is having most number of Gold Medals so far? (Top 5)<jupyter_code>da = df[df['Medal']  == 'Gold']

data = []

for sport in da['Sport'].unique():
    data.append([sport , len(da[da['Sport']  == sport])])

pd.DataFrame(data,columns = ['Sport','Number of Golds']).sort_values(by='Number of Golds', ascending=False).head().plot(x = 'Sport', y = 'Number of Golds', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output><jupyter_text>3. Which sport is having most number of medals so far? (Top 5)<jupyter_code>DataSports = []

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

pd.DataFrame(DataSports,columns = ['Sport','Number of Medals']).sort_values(by='Number of Medals', ascending=False).head().plot(x = 'Sport', y = 'Number of Medals', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output><jupyter_text>4. Which player has won most number of medals? (Top 5)<jupyter_code>DataPlayer = []

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

pd.DataFrame(DataPlayer,columns = ['Athlete','Number of Medals']).sort_values(by='Number of Medals', ascending=False).head().plot(x = 'Athlete', y = 'Number of Medals', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output><jupyter_text>5. Which player has won most number Gold Medals of medals? (Top 5)<jupyter_code>DataPlayerGold = []

for athlete in da['Athlete'].unique():
    DataPlayerGold.append([athlete , len(da[da['Athlete']  == athlete])])

pd.DataFrame(DataPlayerGold,columns = ['Athlete','Number of Golds']).sort_values(by='Number of Golds', ascending=False).head().plot(x = 'Athlete', y = 'Number of Golds', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output><jupyter_text>6. In which year India won first Gold Medal in Summer Olympics?<jupyter_code>Ind = da[da['Country'] == 'IND']
Ind.head(1)<jupyter_output><empty_output><jupyter_text>7. Which event is most popular in terms on number of players? (Top 5)<jupyter_code>DataEvent = []

for player in df['Event'].unique():
    DataEvent.append([player , len(df[df['Event']  == player])])

pd.DataFrame(DataEvent,columns = ['Event','Number of Players']).sort_values(by='Number of Players', ascending=False).head().plot(x = 'Event', y = 'Number of Players', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output><jupyter_text>8. Which sport is having most female Gold Medalists? (Top 5)<jupyter_code>dfemale = da[da['Gender'] == 'Women']

DataFemaleGold = []

for athlete in dfemale['Athlete'].unique():
    DataFemaleGold.append([athlete , len(dfemale[dfemale['Athlete']  == athlete])])

pd.DataFrame(DataFemaleGold,columns = ['Athlete','Number of Golds']).sort_values(by='Number of Golds', ascending=False).head().plot(x = 'Athlete', y = 'Number of Golds', kind = 'bar', figsize = (10,5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16751845542305507, 'fraction_numerical': 0.009937535491198184, 'mean_word_length': 6.708971553610503, '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': '495598', 'license': 'Apache-2.0', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1207, 'n_words': 293, 'path': 'Summer Olympics/Summer.ipynb', 'repo_name': 'ayush-sultania/Skill-India-AI-ML-Scholarship', 'size': '3522'}