... cvxpy one: enter cvxpy


You can download the dataset here.

You can also pull it locally by running this on the terminal;

wget https://calmcode.io/datasets/stigler.csv

You need to install some tools before starting your notebook.

pip install cvxpy pandas

The notebook in this video contains the following code;

import cvxpy as cp
import pandas as pd

df = pd.read_csv("/path/to/stigler.csv")
price = df['price_cents'].values

x = cp.Variable(price.shape[0])
objective = cp.Minimize(cp.sum(price*x))
prob = cp.Problem(objective)

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider signing up for the newsletter.