mask and then fillnan 23

Solutions on MaxInterview for mask and then fillnan 23 by the best coders in the world

showing results for - "mask and then fillnan 23"
Tania
28 Sep 2016
1a b c 
21 1 5.0
31 1 None
41 1 4.0
51 2 1.0
62 1 2.0
72 1 None
8
9mask = (df['a']==1) & (df['b']==1)
10mean = df.loc[mask, 'c'].mean()
11df.loc[mask, 'c'] = df.loc[mask, 'c'].fillna(mean)
12
similar questions
queries leading to this page
mask and then fillnan 23