Skip to content

Commit f73ead1

Browse files
mmckyHumphreyYang
andauthored
Update lectures/polars.md
Co-authored-by: Humphrey Yang <[email protected]>
1 parent 7c3e1ed commit f73ead1

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
@@ -354,9 +354,9 @@ We can use complex filtering conditions with boolean logic:
354354

355355
```{code-cell} ipython3
356356
complex_condition = (
357-
pl.when(pl.col('country').is_in(['Argentina', 'India', 'South Africa'])) # for the countries that match those in the list
358-
.then(pl.col('POP') > 40000) # mark True if population is > 40,000
359-
.otherwise(pl.col('POP') < 20000) # otherwise False if population is < 20,000
357+
pl.when(pl.col('country').is_in(['Argentina', 'India', 'South Africa']))
358+
.then(pl.col('POP') > 40000)
359+
.otherwise(pl.col('POP') < 20000)
360360
)
361361
362362
df.filter(complex_condition).select(['country', 'year', 'POP', 'XRAT', 'tcgdp'])

0 commit comments

Comments
 (0)