ScrollTable
lib/scroll/scroll_table.march — Show tabular data as an interactive table.
ScrollTable.csv("data/orders.csv") -- a CSV file (first row = header)
ScrollTable.json("report.json") -- a JSON array of objects
ScrollTable.json_at("report.json", ["models"]) -- an array inside an object
ScrollTable.rows(["day", "orders"], [["1", "96"], ["2", "102"]])
ScrollTable.data_frame(df) -- a stdlib DataFrameEach prints one __SCROLL_BLOB__ block of type application/vnd.scroll.table+json, which the notebook renders as a sortable, filterable table with each column's inferred type and its number of missing values. The summary covers every row; at most max_rows() rows are sent to the browser, and the table says how many it is showing.
Payload (one line of JSON): {"columns":[{"name":"orders","type":"int","missing":0}, ...], "rows":[["96", ...], ...], "total": 21, "source": "data/orders.csv"} A missing cell is null; every other cell is its text.
Functions
Show a CSV file. The first row is the header. A file that cannot be read or parsed prints why instead.
Show a stdlib DataFrame.
The type of a column from its non-missing cells: int, float, bool, date or text (an all-missing column is text).
True for a cell that holds no value: empty (after trimming) or one of the usual placeholders NA, N/A, NaN, nan, null, NULL, None.
Show a JSON file holding an array (see json_value).
Show the array found by following keys from the top of a JSON file, e.g. json_at("report.json", ["models"]).
A JSON value as one table cell; arrays and objects are summarized.
Show a JSON array: an array of objects becomes one row per object (columns are every key, in first-seen order); any other array is one value column.
True for true/false in any case.
True for a value starting with an ISO date, YYYY-MM-DD.
True for a decimal number: an integer, a decimal point, an exponent.
True for an optionally signed run of decimal digits.
The sentinel block that displays payload (for tests and composition).
The most rows sent to the browser for one table.
The MIME type the notebook renders as a table.
A JSON number as table text: integral values without a decimal point.
The table payload for header and rows, as one line of JSON. A row shorter than the header is padded with missing cells; extra cells are dropped. source names where the data came from ("" for none).
Show rows of text cells under header.