Last active
October 14, 2020 15:37
-
-
Save esmitt/81d3db8564a21eccb8d603d8216efef8 to your computer and use it in GitHub Desktop.
Prints statistics over an array of numbers using describe function from scipy and numpy range of values function (ptp)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.stats import describe | |
import numpy as np | |
# arr_values is a numpy array | |
def print_stats(arr_values: np.array) -> None: | |
stats = describe(arr_values) | |
print(f'min: {stats.minmax[0]:.5f}, max: {stats.minmax[1]:.4f}') | |
print(f'mean: {stats.mean:.5f}') | |
print(f'standard: {np.std(arr_values):.5f}') | |
print(f'variance: {stats.variance:.5f}') | |
print(f'skewness: {stats.skewness:.5f}') | |
print(f'kurtosis: {stats.kurtosis:.5f}') | |
print(f'range: {np.ptp(arr_values):.4f}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment