<jupyter_start><jupyter_text>Mean vs. Median Let's create some fake income data, centered around 27,000 with a normal distribution and standard deviation of 15,000, with 10,000 data points.Then, compute the mean (average) - it should be closed to 27,0000:<jupyter_code>import numpy as np

incomes = np.random.normal(27000, 15000, 10000)
np.mean(incomes)<jupyter_output><empty_output><jupyter_text>We can segment the income data into 50 buckets, and plot it as a histogram:<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
plt.hist(incomes, 50)
plt.show()
np.median(incomes)<jupyter_output><empty_output><jupyter_text>Let's add <NAME> into the mix with the his crazzy income<jupyter_code>incomes = np.append(incomes, [1000000000])<jupyter_output><empty_output><jupyter_text>The median won't change much, but the mean does because it is sensitive to outliers: If in our data we do have some outliers, then the median will give more inforltaion tha the mean<jupyter_code>np.median(incomes)
np.mean(incomes)<jupyter_output><empty_output><jupyter_text>ModeNext, let's generate some fake age data for 500 people:<jupyter_code>ages = np.random.randint(18, high=90, size=500)
ages
from scipy import stats
stats.mode(ages)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09141494435612083, 'fraction_numerical': 0.04769475357710652, 'mean_word_length': 7.337748344370861, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '269549', 'license': 'MIT', 'n_tokens_mistral': 486, 'n_tokens_neox': 418, 'n_words': 130, 'path': 'notebooks/statistics/MeanMedianMode.ipynb', 'repo_name': 'ericarnaudmakita/machine_learning_projects', 'size': '1262'}