<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
# cleaning data 1
checking_null=df.isnull()
total_null=checking_null.sum()
total_null # finding total null vales in a dataset
# cleaning data 2
df.dropna() # removing rows with null values<jupyter_output><empty_output><jupyter_text>1. In how many cities Summer Olympics is held so far?<jupyter_code>df['City'].unique()<jupyter_output><empty_output><jupyter_text>2. Which sport is having most number of Gold Medals so far? (Top 5)<jupyter_code>for_gold=df[df['Medal']=='Gold']
most_gold=for_gold['Sport'].value_counts().head()
print(most_gold)
most_gold.plot(kind='bar')
plt.show()<jupyter_output>Aquatics      1421
Athletics     1215
Rowing         890
Gymnastics     820
Fencing        552
Name: Sport, dtype: int64<jupyter_text>3. Which sport is having most number of medals so far? (Top 5)<jupyter_code>most_medals=df['Sport'].value_counts().head()
print(most_medals)
most_medals.plot(kind='bar')
plt.show()<jupyter_output>Aquatics      4170
Athletics     3638
Rowing        2667
Gymnastics    2307
Fencing       1613
Name: Sport, dtype: int64<jupyter_text>4. Which player has won most number of medals? (Top 5)<jupyter_code>ath_med=df['Athlete'].value_counts().head()
print(ath_med)
ath_med.plot(kind='bar')
plt.show()<jupyter_output>PHELPS, Michael         22
LATYNINA, Larisa        18
ANDRIANOV, Nikolay      15
ONO, Takashi            13
MANGIAROTTI, Edoardo    13
Name: Athlete, dtype: int64<jupyter_text>5. Which player has won most number Gold Medals of medals? (Top 5)<jupyter_code>gold_players=df[df['Medal']=='Gold']['Athlete'].value_counts().head()
print(gold_players)
gold_players.plot(kind='bar')
plt.show()<jupyter_output><NAME>     18
SPITZ, Mark          9
LATYNINA, Larisa     9
<NAME>          9
NURMI, Paavo         9
Name: Athlete, dtype: int64<jupyter_text>6. In which year India won first Gold Medal in Summer Olympics?<jupyter_code>g_medal=df[df['Medal']=='Gold']
only_ind=g_medal[g_medal['Country']=='IND']
only_ind['Year'].min() # we can also use only_ind['Year'].sort_values(ascending=True)<jupyter_output><empty_output><jupyter_text>7. Which event is most popular in terms on number of players? (Top 5)<jupyter_code>most_pop=df['Event'].value_counts().head()
print(most_pop)
most_pop.plot(kind='bar')
plt.show()<jupyter_output>Football            1497
Hockey              1422
Team Competition    1147
Basketball          1012
Handball             973
Name: Event, dtype: int64<jupyter_text>8. Which sport is having most female Gold Medalists? (Top 5)<jupyter_code>for_women=df[df['Gender']=='Women']
for_gold=for_women[for_women['Medal']=='Gold']
most_fem=for_gold['Sport'].value_counts().head()
print(most_fem)
most_fem.plot(kind='bar')
plt.show()<jupyter_output>Aquatics      589
Athletics     389
Gymnastics    268
Rowing        217
Volleyball    166
Name: Sport, dtype: int64
{'fraction_non_alphanumeric': 0.12112112112112113, 'fraction_numerical': 0.03837170503837171, 'mean_word_length': 5.20703933747412, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '216881', 'license': 'MIT', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1084, 'n_words': 246, 'path': 'src/analysis.ipynb', 'repo_name': 'haaris272k/Summer-Olympics-data-analysis', 'size': '3011'}