Liking cljdoc? Tell your friends :D

tablecloth.time.api.slice


parse-datetime-strcljmultimethod

source

sliceclj

(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:

  • result-type - return results as dataset (:as-dataset, default) or a row of indexes (:as-indexes).

Example data:

:A:B
19700
19711
19722
19733

Example:

(-> data (index-by :A) (slice "1972" "1973"))

;; => _unnamed [2 2]:

:A:B
19722
19733
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 |
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close