Reputation: 185
I have a data set with 100+ columns and half million rows. For column Z
, some of the values are missing. I am going to first group the data by 2 columns (A,B)
, then for each group, I get the median (skip those nans), then I want to fill the nans in Z
by those median for the corresponding group.
I could
df.groupby(["A","B"]).Z.median()
But it also has nans in some of the group and I am not sure how to proceed to really fill those nans in Z
by the group median...
Upvotes: 2
Views: 1544