# Import packages

import codecademylib

import numpy as np

import pandas as pd

from scipy import stats

# Import matplotlib pyplot

from matplotlib import pyplot as plt

# Read in transactions data

greatest_books = pd.read_csv(“top-hundred-books.csv”)

# Save transaction times to a separate numpy array

author_ages = greatest_books[‘Ages’]

# Calculate the average and median value of the author_ages array

average_age = np.average(author_ages)

median_age = np.median(author_ages)

mode_age = 38 # Here instead of value if I try to use stat.mode(author_ages) got error!

# Plot the figure

plt.hist(author_ages, range=(10, 80), bins=14, edgecolor=‘black’)

plt.title(“Author Ages at Publication”)

plt.xlabel(“Publication Age”)

plt.ylabel(“Count”)

plt.axvline(average_age, color=‘r’, linestyle=‘solid’, linewidth=3, label=“Mean”)

plt.axvline(median_age, color=‘y’, linestyle=‘dotted’, linewidth=3, label=“Median”)

plt.axvline(mode_age, color=‘orange’, linestyle=‘dashed’, linewidth=3, label=“Mode”)

plt.legend()

plt.show()

#ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The explanation provided in the stackoverflow is bit confusing for me to understand.

As newbie from the biological background, It is little hard to understand the concept. Please throw some light on the issue. Thanks in Advance