use context essentials2021 include shared-gdrive("dcic-2021", "1wyQZj_L0qqV9Ekgr9au6RX2iqt2Ga8Ep") # need for working with Google Sheets (later): include gdrive-sheets include data-source gradebook = table: name, semester, SNC, quiz1, quiz2 row: "Ursa", 3, false, 83, 56 row: "Isaias", 4, true, 92, 79 row: "Jackson", 8, true, 61, 0 row: "Isi", 7, false, 90, 87 row: "Thuy", 5, false, 85, 85 row: "Brigida", 5, false, 0, 0 end avg-gradebook = build-column( gradebook, "quiz-avg", lam(r): (r["quiz1"] + r["quiz2"]) / 2 end) low-averages = filter-with( avg-gradebook, lam(r): r["quiz-avg"] < 70 end) # ------------------------------------------------------# # from URL: https://docs.google.com/spreadsheets/d/1HS-8KVZ4vwsFQ3OS4COC_VfITeouhotIhk6seVx2_Oc/edit?usp=sharing ssid = "1HS-8KVZ4vwsFQ3OS4COC_VfITeouhotIhk6seVx2_Oc" #| event-data = load-table: name, email, tickcount, discount, delivery source: load-spreadsheet(ssid).sheet-by-name("Orig Data", true) end # redo the analysis from google-sheets -- do we get the same answers? fun filter-by-discount(events :: Table, d :: String) -> Table: doc: "filter table to rows with given discount" end total-tickets = sum(event-data, "tickcount") student-tickets = sum(filter-by-discount(event-data, "student"),"tickcount") full-fare-tickets = sum(filter-by-discount(event-data, ""), "tickcount") "total tickets is " + num-to-string(total-tickets) "student tickets is " + num-to-string(student-tickets) "full-fare tickets is " + num-to-string(full-fare-tickets) |#