(adjust-interval dataset
index-column-name
keys
->new-time-converter
new-column-name)
Adjusts the interval of the dataset by adding a new column new-column-name
whose values are the result of applying time-converter
to the column specified
by index-column-name
, and then performing a group-by
operation on that column
and any columns specified by keys
.
Adjusts the interval of the dataset by adding a new column `new-column-name` whose values are the result of applying `time-converter` to the column specified by `index-column-name`, and then performing a `group-by` operation on that column and any columns specified by `keys`.
(down-to-nearest interval chrono-unit)
(down-to-nearest interval chrono-unit datetime)
(slice dataset from to)
(slice dataset from to {:keys [result-type] :or {result-type :as-dataset}})
Returns a subset of dataset's rows (or row indexes) as specified by from and to, inclusively.
from
and to
are either strings or datetime type literals (e.g. #time/local-date "1970-01-01").
The dataset must have been indexed, and the time unit of the index must match the unit of time
by which you are attempting to slice.
Options are:
:as-dataset
, default) or a row of indexes (:as-indexes
).Example data:
:A | :B |
---|---|
1970 | 0 |
1971 | 1 |
1972 | 2 |
1973 | 3 |
Example:
(-> data (index-by :A) (slice "1972" "1973"))
;; => _unnamed [2 2]:
:A | :B |
---|---|
1972 | 2 |
1973 | 3 |
Returns a subset of dataset's rows (or row indexes) as specified by from and to, inclusively. `from` and `to` are either strings or datetime type literals (e.g. #time/local-date "1970-01-01"). The dataset must have been indexed, and the time unit of the index must match the unit of time by which you are attempting to slice. Options are: - result-type - return results as dataset (`:as-dataset`, default) or a row of indexes (`:as-indexes`). Example data: | :A | :B | |------|----| | 1970 | 0 | | 1971 | 1 | | 1972 | 2 | | 1973 | 3 | Example: (-> data (index-by :A) (slice "1972" "1973")) ;; => _unnamed [2 2]: | :A | :B | |------|----| | 1972 | 2 | | 1973 | 3 |
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close