

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Polars
incomplete
2: Basic Operations
incomplete
3: Polars vs. Pandas
incomplete
4: Expression-Based Operations
incomplete
5: Lazy vs. Eager Execution
incomplete
6: No Index
incomplete
7: Filtering With No Index
incomplete
8: Index Alternatives
incomplete
9: Sorting
incomplete
10: Sorting Footguns
incomplete
11: Time-Based Operations
incomplete
12: Parquet
incomplete
13: Parquet With Polars
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Both Pandas and Polars sort in ascending order by default... but the parameters are named in opposite ways.
Pandas' sort_values() method has an ascending parameter that's True by default. Polars' sort() method has a descending parameter that's False by default. Don't mix them up.
Polars generally refers to missing values as nulls. It can also contain floating-point NaN values, but null and NaN are different things in Polars.
Pandas is looser with its terminology. You'll see "missing values," "NA values," "nulls," and NaNs used around missing data.
The trickiest footgun here is that, by default, Pandas' sort_values() places missing values at the end of the sorted output, while Polars' sort() places null values at the beginning. This is a common source of bugs when migrating between libraries!
Both libraries let you control this behavior, but the default is different.
sort_values(..., na_position="last")sort(..., nulls_last=False)To make Polars match Pandas' default, use sort(..., nulls_last=True).
The SnackStack support team reviews devices that have gone quiet. Devices that have been offline the longest should appear first, but unknown offline times should not jump to the top of the queue.
Complete the build_offline_review_queue function. It accepts a Polars DataFrame of device status rows and returns a new DataFrame for review.