I want to replace NaNs in a Pandas DataFrame column with non-NaN values from within the same group. In my case these are geo coordinates where for some reason some data points the lookup failed. e.g.:
df.groupby('place')
looks like
place| lat | lng
-----------------
foo  | NaN | NaN
foo  | 1   | 4
foo  | 1   | 4
foo  | NaN | NaN
bar  | 5   | 7
bar  | 5   | 7
bar  | NaN | NaN
bar  | NaN | NaN
bar  | 5   | 7
==> what I want:
foo  | 1   | 4
foo  | 1   | 4
foo  | 1   | 4
foo  | 1   | 4
bar  | 5   | 7
bar  | 5   | 7
bar  | 5   | 7
bar  | 5   | 7
bar  | 5   | 7
In my case the lat/lng values within the same 'place' grouping are constant, so picking any non-NaN value would work. I'm also curious how I could do a fill with e.g. mean/majority count.
 
     
     
    