sciPy stats.gmean() function | Python Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report scipy.stats.gmean(array, axis=0, dtype=None) calculates the geometric mean of the array elements along the specified axis of the array (list in python). It's formula - Parameters : array: Input array or object having the elements to calculate the geometric mean. axis: Axis along which the mean is to be computed. By default axis = 0 dtype: It sets the type of returned element.Returns : Geometric mean of the array elements based on the set parameters.Code #1: Python3 # Geometric Mean from scipy.stats.mstats import gmean arr1 = gmean([1, 3, 27]) print("Geometric Mean is :", arr1) OutputGeometric Mean is : 4.32674871092 Code #2: With multi-dimensional data Python3 # Geometric Mean from scipy.stats.mstats import gmean arr1 = [[1, 3, 27], [3, 4, 6], [7, 6, 3], [3, 6, 8]] print("Geometric Mean is :", gmean(arr1)) # using axis = 0 print("\nGeometric Mean is with default axis = 0 : \n", gmean(arr1, axis = 0)) # using axis = 1 print("\nGeometric Mean is with default axis = 1 : \n", gmean(arr1, axis = 1)) OutputGeometric Mean is : [ 2.81731325 4.55901411 7.89644408] Geometric Mean is with default axis = 0 : [ 2.81731325 4.55901411 7.89644408] Geometric Mean is with default axis = 1 : [ 4.32674871 4.16016765 5.01329793 5.24148279] Comment More infoAdvertise with us Next Article scipy stats.moment() function | Python V vishal3096 Follow Improve Article Tags : Python Python-scipy Python scipy-stats-functions Practice Tags : python Similar Reads sciPy stats.mean() function | Python scipy.stats.mean(array, axis=0) function calculates the arithmetic mean of the array elements along the specified axis of the array (list in python). It's formula - Parameters : array: Input array or object having the elements to calculate the arithmetic mean. axis: Axis along which the mean is to b 1 min read scipy stats.moment() function | Python scipy.stats.moment(array, axis=0) function calculates the nth moment about the mean for a sample i.e. array elements along the specified axis of the array (list in python). Its formula - Parameters : array : Input array or object having the elements to calculate the moment. axis : Axis along which t 2 min read scipy stats.normaltest() function | Python scipy.stats.normaltest(array, axis=0) function test whether the sample is different from the normal distribution. This function tests the null hypothesis of the population that the sample was drawn from. Parameters : array : Input array or object having the elements. axis : Axis along which the norm 1 min read sciPy stats.sem() function | Python scipy.stats.sem(arr, axis=0, ddof=0) function is used to compute the standard error of the mean of the input data. Parameters : arr : [array_like]Input array or object having the elements to calculate the standard error. axis : Axis along which the mean is to be computed. By default axis = 0. ddof : 1 min read sciPy stats.tsem() function | Python scipy.stats.tsem(array, limits=None, inclusive=(True, True)) calculates the trimmed standard error of the mean of array elements along the specified axis of the array. Its formula :- Parameters : array: Input array or object having the elements to calculate the trimmed standard error of the mean. ax 2 min read sciPy stats.hmean() | Python scipy.stats.hmean(array, axis=0, dtype=None) calculates the harmonic mean of the array elements along the specified axis of the array (list in python). It's formula - Parameters : array: Input array or object having the elements to calculate the harmonic mean. axis: Axis along which the mean is to b 2 min read Like