Summarize data with sum(), mean(), min(), max(), std(), var(), and ptp().
Aggregate functions reduce an entire array or dimension down into summary statistics like total sum, average mean, minimum, maximum, and standard deviation.
Aggregating is like squeezing a sponge of numbers: all individual droplets condense into one or two essential metrics like total volume (sum) or average flow (mean).
You can call either `arr.sum()` as a method or `np.sum(arr)` as a top-level function. Both produce identical results.
total = arr.sum(); avg = arr.mean()sum(data) # Python built-in sum (slower on ndarrays)data.sum() # or np.sum(data)Python's built-in `sum()` does not take advantage of NumPy's contiguous memory layout.
Solve the objective below using NumPy vectorized syntax
Create `arr = np.array([10, 20, 30, 40, 50])`, calculate its mean using `.mean()`, and print.
30.0