I have a sample dataframe as follow:
data = pd.DataFrame({'Date':[20210101,20210102,20210103,20210104,20210105],'coef1':[1,2,5,4,3],'coef2':[1,1,2,6,3],'coef3':[1,1,1,1,1]})
I would like to have mean over 'coef1' ,'coef2' and 'coef3' if these values does not equal to 1.
My desired dataframe should be like bellow:

I wrote a function and apply it on my datframe and got my desired output,however I want a pythonic way to achieve this.
def final_coef(x):
coef_list = []
if x['coef1'] == 1:
pass
else:
coef_list.append(x['coef1'])
if x['coef2'] == 1:
pass
else:
coef_list.append(x['coef2'])
if x['coef3'] == 1:
pass
else:
coef_list.append(x['coef3'])
return np.mean(coef_list)
data['Final_coef'] = data.apply(lambda row: final_coef(row),axis = 1)
