Data and Math
vdataframe
Tabular data as a list of rows, each row a map of named columns.
Released v1.0.0 · 2026-09-28use "stdlib/dataframe.ven"
Build a frame from columns, pull a column out, filter, group and join rows.
cols = new_map()
map_set(cols, "name", ["Ada", "Grace"])
frame = dataframe_from_columns(cols)
print dataframe_column(frame, "name")
:: ["Ada", "Grace"]
Reference (12 functions)
API reference
dataframe_from_rows(rows)
Wraps an existing List of row maps as a DataFrame.
row = new_map()
map_set(row, "name", "Ada")
map_set(row, "age", 36)
dataframe_row_count(dataframe_from_rows([row]))
:: 1dataframe_from_columns(columns)
Builds a DataFrame from a Map of column name to a List of column values.
cols = new_map()
map_set(cols, "name", ["Ada", "Grace"])
map_set(cols, "age", [36, 85])
dataframe_to_csv_text(dataframe_from_columns(cols))
:: name,age
:: Ada,36
:: Grace,85dataframe_column(df, name)
Gives back one column's values as a plain List, in row order.
cols = new_map()
map_set(cols, "name", ["Ada", "Grace"])
dataframe_column(dataframe_from_columns(cols), "name")
:: ["Ada", "Grace"]dataframe_select_columns(df, names)
Gives back a new DataFrame keeping only the named columns.
cols = new_map()
map_set(cols, "name", ["Ada"])
map_set(cols, "age", [36])
dataframe_to_csv_text(dataframe_select_columns(dataframe_from_columns(cols), ["name"]))
:: name
:: Adadataframe_filter_rows(df, predicate)
Gives back a new DataFrame keeping only the rows predicate accepts.
cols = new_map()
map_set(cols, "age", [36, 85])
dataframe_to_csv_text(dataframe_filter_rows(dataframe_from_columns(cols), make(row) give map_get(row, "age") > 40))
:: age
:: 85dataframe_sort_by_column(df, name, descending)
Gives back a new DataFrame with rows sorted by one column's value.
cols = new_map()
map_set(cols, "name", ["Ada", "Grace"])
map_set(cols, "age", [36, 85])
dataframe_to_csv_text(dataframe_sort_by_column(dataframe_from_columns(cols), "age", yes))
:: name,age
:: Grace,85
:: Ada,36dataframe_group_by_column(df, name)
Groups a DataFrame's rows into one DataFrame per key, keyed by one column's value.
cols = new_map()
map_set(cols, "team", ["red", "blue", "red"])
map_keys(dataframe_group_by_column(dataframe_from_columns(cols), "team"))
:: ["red", "blue"]dataframe_aggregate(df, column, operation)
Reduces one numeric column of a DataFrame to a single value.
cols = new_map()
map_set(cols, "score", [1, 2, 3])
dataframe_aggregate(dataframe_from_columns(cols), "score", "mean")
:: 2.0dataframe_join(left, right, on_column, kind)
Joins two DataFrames on a shared column value.
lc = new_map()
map_set(lc, "id", [1, 2])
map_set(lc, "name", ["Ada", "Grace"])
rc = new_map()
map_set(rc, "id", [1])
map_set(rc, "age", [36])
dataframe_to_csv_text(dataframe_join(dataframe_from_columns(lc), dataframe_from_columns(rc), "id", "left"))
:: id,name,age
:: 1,Ada,36
:: 2,Grace,nothingdataframe_row_count(df)
Gives back how many rows a DataFrame has.
r1 = new_map()
map_set(r1, "a", 1)
r2 = new_map()
map_set(r2, "a", 2)
dataframe_row_count(dataframe_from_rows([r1, r2]))
:: 2dataframe_to_csv_text(df)
Renders a DataFrame as CSV Text.
cols = new_map()
map_set(cols, "name", ["Ada", "Grace"])
map_set(cols, "age", [36, 85])
dataframe_to_csv_text(dataframe_from_columns(cols))
:: name,age
:: Ada,36
:: Grace,85dataframe_describe(df)
Computes mean, min, max, and count for every all-numeric column.
cols = new_map()
map_set(cols, "score", [1, 2, 3])
dataframe_describe(dataframe_from_columns(cols))
:: {"score": {"mean": 2.0, "min": 1, "max": 3, "count": 3}}