Liking cljdoc? Tell your friends :D
Clojure only.

datajure.join

Join functions for datajure. Wraps tech.v3.dataset.join/pd-merge for regular joins and datajure.asof for as-of and window joins.

Join functions for datajure. Wraps tech.v3.dataset.join/pd-merge for
regular joins and datajure.asof for as-of and window joins.
raw docstring

joinclj

(join left
      right
      &
      {:keys [on left-on right-on how validate report direction tolerance window
              agg]
       :or {how :inner report false direction :backward}})

Join two datasets. Returns a dataset.

Options (keyword args): :on — column keyword or vector of keywords (same name in both datasets) :left-on — column keyword(s) for left dataset (use with :right-on) :right-on — column keyword(s) for right dataset (use with :left-on) :how — join type: :inner (default), :left, :right, :outer, :asof, :window :validate — cardinality check: :1:1, :1:m, :m:1, :m:m (not for :window) :report — if true, print merge diagnostics (not for :window) :direction — (asof only) :backward (default), :forward, or :nearest. :backward = last right where right-key <= left-key. :forward = first right where right-key >= left-key. :nearest = closest by abs distance; ties prefer :backward. :tolerance — (asof only) numeric max abs distance; matches exceeding it produce nil. Requires a numeric asof key. nil = unbounded. :window — (window only) window spec relative to each left row's asof-key. Formats: [lo hi], [lo hi unit], or [lo unit hi]. E.g. [-5 0 :minutes] = 5-minute lookback (inclusive). Units: :seconds, :minutes, :hours, :days, :weeks. :agg — (window only) map of {output-col agg-fn}. agg-fn can be a #dt/e expression or a plain fn receiving the matched sub-dataset. Empty windows return nil for #dt/e exprs; plain fns receive a 0-row sub-dataset and return their natural result (e.g. nrow -> 0).

Must provide either :on or both :left-on and :right-on.

As-of join (:how :asof): The last column in :on (or :left-on/:right-on) is the asof column; preceding columns are exact-match keys. All left rows are preserved; unmatched or out-of-tolerance rows get nil for right columns.

Window join (:how :window): The last column in :on is the asof column; preceding columns are exact-match keys. For each left row, ALL right rows within the window are collected and aggregated via :agg. All left rows are preserved; empty windows produce nil (or 0 for plain-fn count aggs) for each agg column.

Join two datasets. Returns a dataset.

Options (keyword args):
  :on        — column keyword or vector of keywords (same name in both datasets)
  :left-on   — column keyword(s) for left dataset (use with :right-on)
  :right-on  — column keyword(s) for right dataset (use with :left-on)
  :how       — join type: :inner (default), :left, :right, :outer, :asof, :window
  :validate  — cardinality check: :1:1, :1:m, :m:1, :m:m (not for :window)
  :report    — if true, print merge diagnostics (not for :window)
  :direction — (asof only) :backward (default), :forward, or :nearest.
               :backward = last right where right-key <= left-key.
               :forward  = first right where right-key >= left-key.
               :nearest  = closest by abs distance; ties prefer :backward.
  :tolerance — (asof only) numeric max abs distance; matches exceeding it
               produce nil. Requires a numeric asof key. nil = unbounded.
  :window    — (window only) window spec relative to each left row's asof-key.
               Formats: [lo hi], [lo hi unit], or [lo unit hi].
               E.g. [-5 0 :minutes] = 5-minute lookback (inclusive).
               Units: :seconds, :minutes, :hours, :days, :weeks.
  :agg       — (window only) map of {output-col agg-fn}. agg-fn can be a
               #dt/e expression or a plain fn receiving the matched sub-dataset.
               Empty windows return nil for #dt/e exprs; plain fns receive a
               0-row sub-dataset and return their natural result (e.g. nrow -> 0).

Must provide either :on or both :left-on and :right-on.

As-of join (:how :asof):
  The last column in :on (or :left-on/:right-on) is the asof column;
  preceding columns are exact-match keys. All left rows are preserved;
  unmatched or out-of-tolerance rows get nil for right columns.

Window join (:how :window):
  The last column in :on is the asof column; preceding columns are exact-match
  keys. For each left row, ALL right rows within the window are collected and
  aggregated via :agg. All left rows are preserved; empty windows produce nil
  (or 0 for plain-fn count aggs) for each agg column.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close