Ciaren

Filter Paid Orders with Two Conditions

You want the orders that are paid and worth at least 100. A Filter Rows node tests one condition; Filter by Expression tests both in one expression and keeps a row only when the whole expression is true.

You'll use: File Input → Filter by Expression → File Output.

  1. 1Input
    File Input
    orders.csv
  2. 2Clean
    Filter by Expression
    amount ≥ 100 and status paid
  3. 3Output
    File Output
    paid_orders

Sample data

Save this as orders.csv. It has one unpaid order and paid orders below, at and above 100.

csv
order_id,amount,status
ORD-1001,250.00,pending
ORD-1002,99.99,paid
ORD-1003,100.00,paid
ORD-1004,180.50,paid

Steps

  1. On Datasets, upload orders.csv.

  2. In a new flow, add File Input. Set File type to CSV and Dataset to orders.csv.

  3. Add Filter by Expression and type this into Expression:

    amount >= 100 and status == 'paid'

    You can also build it with Build condition: pick amount, ≥ greater or equal and 100, click Use condition, then pick status, = equals and paid, and click AND.

  4. Add File Output. Set File type to CSV (.csv) and Dataset name to paid_orders. Connect the nodes in order and click Run.

Result

order_idamountstatus
ORD-1003100.00paid
ORD-1004180.50paid

Each order is checked against amount >= 100 and status == 'paid'; ORD-1001 fails the status test, ORD-1002 fails the amount test, and ORD-1003 and ORD-1004 pass both

ORD-1003 stays because >= includes 100. ORD-1001 is worth 250 but is not paid, so and drops it.

Check the result

Save the flow, click Preview, select the Filter by Expression node and click Run preview. You should see exactly ORD-1003 and ORD-1004. If ORD-1001 appears, the expression uses or instead of and. If ORD-1003 is missing, it uses > instead of >=.

Pitfalls

  • Use == and quote text. status == 'paid' compares with a text value; with a single = the node fails.
  • Text must match exactly. Paid or paid with a trailing space does not equal 'paid', so those orders are dropped. Clean the column first, see Clean Messy Text.
  • Missing values fail the test. An order with an empty amount or status is dropped, because a comparison with null is false.
  • Use amount > 100 if an order of exactly 100 should not count.

Exported Python

Click Export in the editor toolbar. The pandas and polars tabs show this code for the flow. It reads orders.csv from the script's folder and writes paid_orders.csv.

python
import pandas as pd

df_orders = pd.read_csv('orders.csv')
df_orders = df_orders.query("amount >= 100 and status == 'paid'").reset_index(drop=True)
df_orders.to_csv('paid_orders.csv', index=False)

The expression uses pandas syntax on both engines. The Polars script therefore converts the frame with to_pandas() to evaluate it, which needs pandas and PyArrow installed next to Polars.

See also