scipy.stats.describe on a simple numeric array?from scipy.stats import describe import numpy as np arr = np.array([1, 2, 3, 4, 5]) result = describe(arr) print(result)
The describe function returns a named tuple with statistics. For the array [1,2,3,4,5], the variance is 2.5 (sample variance), skewness is 0 (symmetrical data), and kurtosis is -1.3 (platykurtic).
nobs) reported by scipy.stats.describe when applied along axis=1?from scipy.stats import describe import numpy as np arr = np.array([[1, 2, 3], [4, 5, 6]]) result = [describe(row).nobs for row in arr] print(result)
When applying describe to each row, the number of observations is the length of that row, which is 3 for both rows.
scipy.stats.describe on a list with mixed types?from scipy.stats import describe mixed_list = [1, 'two', 3] describe(mixed_list)
The describe function attempts to compute variance and mean, which involves subtraction. Since 'two' is a string, subtracting it from an int causes a TypeError.
scipy.stats.describe?The describe function returns excess kurtosis, which is kurtosis minus 3. A value of 0 means the distribution has the same kurtosis as a normal distribution.
scipy.stats.describe on a dataset: DescribeResult(nobs=4, minmax=(2, 10), mean=6.5, variance=12.33, skewness=1.2, kurtosis=0.5). What does the skewness value tell you about the data distribution?A skewness value greater than 0 means the distribution has a longer or fatter tail on the right side (higher values). This indicates right skewness.