DeveloperBreeze

Calculate Mean and Standard Deviation of NumPy Array

The following Python code demonstrates how to calculate the mean and standard deviation of an array using NumPy:

import numpy as np

# Create an array
arr = np.array([10, 20, 30, 40, 50])

# Calculate and print the mean
mean = np.mean(arr)
print('Mean:', mean)

# Calculate and print the standard deviation
std_dev = np.std(arr)
print('Standard Deviation:', std_dev)

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!