In [1]:
# declare a list tasks whose products you want to use as inputs
upstream = ['1-get']
product = None
In [2]:
# Parameters
upstream = {
    "1-get": {
        "nb": "/home/runner/work/introduction-to-ploomber/introduction-to-ploomber/output/1-get.ipynb",
        "data": "/home/runner/work/introduction-to-ploomber/introduction-to-ploomber/output/cereal.csv",
    }
}
product = "/home/runner/work/introduction-to-ploomber/introduction-to-ploomber/output/sugar.html"
In [3]:
import csv
with open(upstream['1-get']['data'], 'r') as cereals_file:
    lines = cereals_file.read().split("\n")
    cereals = [row for row in csv.DictReader(lines)]

    sorted_by_sugar = sorted(cereals, key=lambda cereal: cereal["sugars"])
    print(f'{sorted_by_sugar[-1]["name"]} is the sugariest cereal')
Nut&Honey Crunch is the sugariest cereal