I have the following dataframe.
enter image description here The data comes from Refinitiv
print(stats.gmean(df4.loc[:,'Price Close'])) I am trying to calculate the geometric mean from this data. However, I get the following error message:
When I create the following dataframe, I do not get an error message
test = pd.DataFrame({ 'open':[24, 19, 58, 32, 93, 63, 91, 28, 41, 6], 'close':[2339.42, 1198.09, 2525.13, 514.43, 172.33, 2381.69, 2008.74, 1561.23, 2693.69, 2237.18] })
print(stats.gmean(df.loc[:,'close']))
Can someone explain to me why in the dataframe at the top does not work? What is the difference? What can I do to solve the problem?
Many thanks.