ortidy¶
OR (operations research) on tidy dataframes — a backend-agnostic dataframe façade over Google OR-Tools.
Pass a dataframe in, get a dataframe back. Built on
Narwhals, so pandas in → pandas out,
Polars in → Polars out. Every solver returns a SolveResult
carrying the result frame, a status, the objective, and solve metadata.
pip install ortidy
import pandas as pd
import ortidy
items = pd.DataFrame({"value": [60, 100, 120], "weight": [10, 20, 30]})
result = ortidy.knapsack(items, capacity=50)
result.objective # 220
result.frame # items + an isIncluded column
Getting started
Solver guide
API reference
Try the examples on Binder: