<jupyter_start><jupyter_text>Basic Statistics I:  Averages An **average** is the central value of a set of numbers.  The **arithmetic mean** is the sum of the elements divided by the number of elements.<jupyter_code>import numpy as np
# Make an array of rank 1
arr = np.array([1, 2, 3, 4, 5])<jupyter_output><empty_output><jupyter_text>Let's manually calculate the average of array arr.<jupyter_code># Manually calculate the average<jupyter_output><empty_output><jupyter_text>Now, to make our life easier, let's use the built-in method mean to calculate the average.<jupyter_code># Calculate the average using the built-in method mean<jupyter_output><empty_output><jupyter_text>We can also calculate averages on arrays of rank 2.<jupyter_code># Make an array of rank 2
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
# Determine the mean of the array of rank 2
# Determine the mean of each column
# Determine the mean of each row<jupyter_output><empty_output><jupyter_text>We have been practicing on simulated data, so let's now work with a real-work dataset by using the iris dataset.<jupyter_code># Import the load_iris method 
from sklearn.datasets import load_iris
# Import pandas, so that we can work with the data frame version of the iris data
import pandas as pd
# Load the iris data
iris = load_iris()
# Convert the iris data to a data frame format, so that it's easier to view
# and process
iris_df = pd.DataFrame(iris['data'], columns = iris['feature_names'])
iris_df
# Determine the mean of each feature<jupyter_output><empty_output><jupyter_text>So we can determine the averages by row, but should we do this? Why or why not?<jupyter_code># Determine the mean of each row<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08506944444444445, 'fraction_numerical': 0.013888888888888888, 'mean_word_length': 5.624521072796935, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '127826', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 578, 'n_tokens_neox': 542, 'n_words': 231, 'path': 'Lessons/Lesson21_Basic_Stats_I_Averages.ipynb', 'repo_name': 'lechten/curriculum-notebooks', 'size': '1728'}