<jupyter_start><jupyter_text>medal_count=pd.read_excel('Medals.xlsx')<jupyter_code>!pip install openpyxl
medal_count.head()
medal_count['Total'].mean()
#Weighted mean takes all values including the ouliers in the data
np.average(medal_count['Gold'],weights=medal_count['Total'])
#Trimmed mean does not consider the outliers avoids the extreme regions of values
trim_mean(medal_count['Gold'],0.1)
medal_count[['Total']].median()
def weighted_median(df,median_col,weight_col):
    df_sorted=df.sort_values(median_col)
    cumsum=df_sorted[weight_col].cumsum()
    cutoff=df_sorted[weight_col].sum()/2.
    return df_sorted[cumsum>=cutoff][median_col].iloc[0]
weighted_median(medal_count,'Total','Gold')
np.percentile(medal_count['Gold'],75)
medal_count.describe()
##estimates of variability(Dispersion Metrics)
from statistics import variance,stdev
variance(medal_count['Gold'])
stdev(medal_count['Gold'])
q3,q1=np.percentile(medal_count['Gold'],[75,25])
iqr=q3-q1
iqr,q3,q1
#Exploring the Data Distribution
medal_count.boxplot(column='Gold')
frequency_table=medal_count.copy()
frequency_table['Freq']=pd.cut(medal_count['Gold'],10)
frequency_table.groupby('Freq')['Rank'].count().reset_index()
plt.hist(x=medal_count['Gold'],bins='auto',color='#0504aa',alpha=0.7,rwidth=0.85)
#Density Plots
ax=medal_count['Gold'].plot.hist(density=True,xlim=[0,12],bins=range(1,12))
medal_count['Gold'].plot.density(ax=ax)
#Exploring Binary and Categorical Data

#Mode
medal_count['Gold'].mode()
ax=medal_count.iloc[:10].plot.bar(x='Team/NOC',y='Gold',figsize=(10,7))
ax.set_xlabel('Country')
ax.set_ylabel('Gold_Count')
medal_count.corr()
medal_count.plot.scatter(x='Gold',y='Silver')
medal_count.plot.scatter(x='Rank',y='Gold')
medal_count.plot.hexbin(x='Gold',y='Silver',gridsize=30,sharex=False)
ax=sns.kdeplot(medal_count['Gold'],medal_count['Silver'])
sns.heatmap(medal_count.corr())
crosstab=medal_count[['Silver','Gold']].pivot_table(index='Silver',columns='Gold',aggfunc=lambda x:len(x),margins=True)
crosstab.fillna(0)
sns.violinplot(x=medal_count['Gold'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18037518037518038, 'fraction_numerical': 0.019721019721019722, 'mean_word_length': 12.419354838709678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '477837', 'license': 'Apache-2.0', 'n_tokens_mistral': 854, 'n_tokens_neox': 807, 'n_words': 88, 'path': 'Tokyo_Olympics2021/Untitled.ipynb', 'repo_name': 'keithferns98/Visualization-EDA', 'size': '2079'}