describe
Builtin index · Collections & strings
result = describe(df)
Input: df · Output: result
What it is
df is a Table. Pandas-style describe(): returns a Table with one row per summary statistic (count, mean, std, min, 25%, 50%, 75%, max) and one column per NUMERIC column of df (text columns are skipped).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = describe(df) | df Tablenot documented yet | result Table | Returns a Table, 8 rows by however many numeric columns df has. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
function add(a, b)
return a + b
end function
print("add(2,3) = {add(2,3)}")
square(x) := x^2
print("square(5) = {square(5)}")
function describe(x: num)
return "num: {x}"
end function
function describe(x: str)
return "str: {x}"
end function
print(describe(5))
print(describe("hi"))
add(2,3) = 5 square(5) = 25 num: 5 str: hi
from tour
df = DataFrame(x=[1, 2, 3, 4, 5], y=[10, 20, 30, 40, 50], label="sample")
print(nrow(df)) # 5
print(ncol(df)) # 3
tall = filter(df, df.x > 2)
xy = select(tall, "x", "y")
print(xy)
print(describe(df))
5
3
x y
- --
3 30
4 40
5 50
stat x y
----- -------- ---------
count 5 5
mean 3 30
std 1.581139 15.811388
min 1 10
25% 2 20
... 3 more linesfrom collections-strings
measurements = table(
x = [-1.5, 0.5, 2.0, -0.25, 3.75],
sensor = ["a", "b", "a", "c", "b"]
)
write_csv(measurements, "measurements.csv")
df = read_csv("measurements.csv")
print(nrow(df))
print(describe(df))
write_csv(filter(df, df.x > 0), "positive_only.csv")
print(read_all_text("positive_only.csv"))
5
stat x
----- -------
count 5
mean 0.9
std 2.03562
min -1.5
25% -0.25
50% 0.5
75% 2
max 3.75
x,sensor
0.5,b
2,a
... 1 more linesfrom file-io
How it works
describe(df) — pandas' DataFrame.describe(): one row per summary statistic (count, mean, std, min, 25%, 50%, 75%, max), one column per NUMERIC column of df (text columns are skipped, same filter corr_heatmap already applies — a mean/quantile of a text column isn't meaningful). Returned as a genuine Value::Table (not a Model handle): a table-of-stats reads and prints naturally with the existing table machinery (head, select, print, ...) and keeps the per-column layout pandas users expect, whereas a Model handle's flat named fields would force one field per column instead of one row-labeled table. Every number is computed via the existing free std_dev/quantile_of helpers (the same ones std/quantile themselves call) — no separate statistics implementation.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.