I have a basic table of values:
import pandas as pd
import numpy as np
test = pd.read_csv('mean_test.csv')
test.replace('n/a',np.nan)
test
value1 value2 value3
1 9 5
5 NaN 4
9 55 NaN
NaN 4 9
I want to work out the average of the three values, ignoring NaN, so for the second row it would be (5+4)/2. Therefore I can't use the .replace function to put a zero in NaN's place. I have searched through some other questions, but can't find anything that covers this. Am I missing something obvious?