So I am working on a code where I take values from the csv file and multiply them with some numbers. Some of the values in the data are infinity so when I am calculating the mean of that column it is giving me the answer in infinity which make sense. Is there a way I can avoid calculating the that cell that has infinity in it??
I tried using this but it didn't work. Can someone tell me if I am doing this correctly?
cop_average = df["COP"].replace('inf', np.nan).mean(skipna=True)
After running this I am still getting "inf" in the some cells!!