python3 -c 'import numpy as np; print(np.mean([1,2,3,4]))'

Category: Data Science & Analysis

python3 -c 'import numpy as np; print(np.mean([1,2,3,4]))'

Compute a mean with NumPy

NumPy is Python's numeric array library, imported here as np. np.mean() averages the list [1,2,3,4] to 2.5 in one call. NumPy functions also operate on arrays and DataFrames with the same syntax. This is the minimal NumPy check that the library is installed and working.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.