Skip to content

Commit 914364f

Browse files
mmckyHumphreyYang
andauthored
Update lectures/polars.md
Co-authored-by: Humphrey Yang <[email protected]>
1 parent 77982bf commit 914364f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lectures/polars.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,13 @@ Polars also provides us with convenient methods to replace missing values.
443443

444444
For example, we can use forward fill, backward fill, or interpolation
445445

446+
Here we fill `null` values with the column means
447+
446448
```{code-cell} ipython3
447-
# Fill with column means for numeric columns
448449
cols = ["cc", "tcgdp", "POP", "XRAT"]
449450
df_with_nulls.with_columns([
450-
pl.col(cols).fill_null(pl.col(cols).mean()) # fill null values with the column mean
451+
pl.col(cols).fill_null(pl.col(cols).mean())
451452
])
452-
```
453453
454454
Missing value imputation is a big area in data science involving various machine learning techniques.
455455

0 commit comments

Comments
 (0)