Welcome to Datajure!
One function. Seven keywords. Two expression modes.
Datajure is a Clojure data manipulation library built on tech.ml.dataset, developed at HKU Business School. It provides one composable query function, dt, for filtering, transforming, grouping, and aggregating tabular data.
(require '[datajure.core :refer [dt nrow asc desc]])
;; Filter, group, aggregate: one call
(dt prices
:where #dt/e (> :price 100)
:by [:sym]
:agg {:n nrow :avg-price #dt/e (mn :price)})
;; Window functions: same keywords
(dt prices
:by [:sym]
:within-order [(asc :date)]
:set {:ret #dt/e (- (win/ratio :price) 1)})
;; Thread for multi-step pipelines
(-> prices
(dt :set {:value #dt/e (* :price :volume)})
(dt :by [:sym] :agg {:total #dt/e (sm :value)})
(dt :order-by [(desc :total)]))
Datajure is a syntax layer, not an engine. It compiles #dt/e expressions to vectorized operations and leaves all computation to tech.ml.dataset, so every result is a standard dataset that works with tablecloth, Clerk, Clay, and the rest of the Scicloj ecosystem.
To get started, go through the quick start, read the docs and try the examples. The complete reference is the README, with API docs on cljdoc.
Why Datajure
Datajure borrows from whichever library got a given idea right:
- R's data.table:
DT[i, j, by]maps onto(dt ds :where i :set-or-agg j :by by), without in-place mutation. - Python's Polars: expressions are first-class values, and comparisons with missing values are safe.
- q/kdb+: time-series primitives such as
win/ratio,win/mavg,win/ema,win/fillsandxbar, plus as-of and window joins. - Julia's DataFramesMeta.jl:
#dt/eplays the role of@transformand@subset, using Clojure's reader tags.
Datajure v1
Datajure v2 (March 2026) is a rewrite. Datajure v1 (1.x) was a query syntax that routed to several backends: tech.ml.dataset, tablecloth, Clojask and Geni. Its code is on the v1 branch, its documentation is in this site's history, and posts from that time describe its design. Thanks to YANG Ming-Tian for the original v1 implementation.
Report Bugs
If you find a bug, please open an issue.
Datajure is distributed under the Apache License, Version 2.0.