From 4e34c288aec25cd2f13c02304011e70d8f41121d Mon Sep 17 00:00:00 2001 From: Zizhe Wang <26437093+PaperPlaneDeemo@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:11:49 +0800 Subject: [PATCH] Update pandas.md Fix: Handled missing values in numeric columns by using numeric_only=True in mean() to avoid errors from non-numeric columns. --- chapter_preliminaries/pandas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter_preliminaries/pandas.md b/chapter_preliminaries/pandas.md index 49e006295..9ab3784fa 100644 --- a/chapter_preliminaries/pandas.md +++ b/chapter_preliminaries/pandas.md @@ -55,7 +55,7 @@ print(data) ```{.python .input} #@tab all inputs, outputs = data.iloc[:, 0:2], data.iloc[:, 2] -inputs = inputs.fillna(inputs.mean()) +inputs = inputs.fillna(inputs.mean(numeric_only=1)) print(inputs) ```