0

For example, if I got a data frame for high school students with "Age" and "Grade" columns. I would like to replace all null values in "Age" column with the average age for each Grade.

MoSai
  • 1
  • 2
    `df["Age"].fillna(df["Age"].mean())` – Jyr Feb 23 '22 at 16:46
  • 1
    @MoSai : Sample input and expected output would help here. May be it is already answered by Jyr's comment above! – Manjunath K Mayya Feb 23 '22 at 16:57
  • Does this answer your question? [Pandas: filling missing values by mean in each group](https://stackoverflow.com/questions/19966018/pandas-filling-missing-values-by-mean-in-each-group) – aaossa Feb 23 '22 at 20:21

0 Answers0