Sample statistics (Python)
A runnable Python Code node embedded in the docs: press Run to route it to the py/python-kernel worker; the output lands directly below the code (with no worker connected, the run reports the failure in the same output pane).
- Code: import statistics # `Inputs` carries caller-supplied parameters, exactly like the C# kernel's Inputs global. samples = Inputs.get("samples", [3, 1, 4, 1, 5, 9, 2, 6]) print(f"n = {len(samples)}") # A trailing expression is the node's return value (shown in the Output pane). {"mean": statistics.mean(samples), "median": statistics.median(samples), "max": max(samples)}
- Is executable: yes