draftply Download

Training Log: CSV Import & Pace Stats

← All samples

training-log-csv.dplyEditor
1---
2version: 0.1.0
3precision: 2
4---
5# draftply Pro — Training Log: CSV Import & Pace Stats
6# "Is my pace actually improving?" Import your own log, or read the worked
7# example below with sample numbers.
8
9# ── Your own log ─────────────────────────────────
10# A CSV with two columns: distance_km, time_min. Click the load button next
11# to either line to pick a file — until then this returns an empty list.
12my_distance = csv("training_log", "distance_km")
13my_time = csv("training_log", "time_min")
14
15# ── Worked example (sample data, 9 runs) ────────
16dist_km = [5.0, 5.2, 6.0, 5.5, 7.0, 6.5, 8.0, 7.5, 8.2]
17time_m = [32.1, 32.8, 37.0, 33.0, 41.5, 38.0, 46.0, 42.0, 45.0]
18
19total_km = sum(dist_km)
20total_min = sum(time_m)
21avg_pace = total_min / total_km
22
23"Total distance (km)": total_km
24"Total time (min)": total_min
25"Overall average pace (min/km)": avg_pace
26
27# Pace of each individual run.
28paces = []
29for i in 0..len(dist_km) - 1:
30 paces = push(paces, time_m[i] / dist_km[i])
31
32"Best pace (min/km)": min(paces)
33"Pace, std deviation": std(paces)
34
35bar(paces, "Pace per run", "run #", "min/km")
36
37# ── Export the stats ─────────────────────────────
38csvwrite(paces, "paces")
39