import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
np.random.seed(0)
data = np.random.randint(10, 60, size=100)
data_series = pd.Series(data)
mean_value = data_series.mean()
median_value = data_series.median()
mode_value = data_series.mode()[0] # Get the first mode
print(f"Mean: {mean_value}")
print(f"Median: {median_value}")
print(f"Mode: {mode_value}")
plt.figure(figsize=(10, 6))
plt.hist(data_series, bins=15, color='lightblue', alpha=0.7, edgecolor='black')
# Correcting the f-string syntax by keeping it on a single line
plt.axvline(mean_value, color='red', linestyle='dashed', linewidth=2, label=f'Mean: {mean_value:.2f}')
plt.axvline(median_value, color='green', linestyle='dashed', linewidth=2, label=f'Median: {median_value:.2f}')
plt.axvline(mode_value, color='blue', linestyle='dashed', linewidth=2, label=f'Mode: {mode_value:.2f}')
plt.title('Histogram of Ages with Mean, Median, and Mode')
plt.xlabel('Age')
plt.ylabel('Frequency')
plt.legend()
plt.grid(axis='y', alpha=0.75)
plt.show()
aW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBwYW5kYXMgYXMgcGQKaW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdApmcm9tIHNjaXB5IGltcG9ydCBzdGF0cwoKbnAucmFuZG9tLnNlZWQoMCkKZGF0YSA9IG5wLnJhbmRvbS5yYW5kaW50KDEwLCA2MCwgc2l6ZT0xMDApCmRhdGFfc2VyaWVzID0gcGQuU2VyaWVzKGRhdGEpCgptZWFuX3ZhbHVlID0gZGF0YV9zZXJpZXMubWVhbigpCm1lZGlhbl92YWx1ZSA9IGRhdGFfc2VyaWVzLm1lZGlhbigpCm1vZGVfdmFsdWUgPSBkYXRhX3Nlcmllcy5tb2RlKClbMF0gICMgR2V0IHRoZSBmaXJzdCBtb2RlCgpwcmludChmIk1lYW46IHttZWFuX3ZhbHVlfSIpCnByaW50KGYiTWVkaWFuOiB7bWVkaWFuX3ZhbHVlfSIpCnByaW50KGYiTW9kZToge21vZGVfdmFsdWV9IikKCnBsdC5maWd1cmUoZmln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