Low-Stock Alert

Easy
Filtering

Low-Stock Alert

The inventory table stores current stock and the reorder level for each product.

Return every product whose stock is at or below its reorder level, with columns product_id, product_name, stock, reorder_level. Sort by product_id ascending.

Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

1 DataFrame

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

df.inventory6 rows
product_id (int)product_name (string)stock (int)reorder_level (int)
1001Espresso Beans812
1002Paper Cups4025
1003Oat Milk510
1004Vanilla Syrup1414
1005Cocoa Powder36
1006Cold Brew3020

Return these columns

product_id(int)
product_name(string)
stock(int)
reorder_level(int)

Column names and order must match. Sort order is specified in the question.

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.