(adjust-frequency dataset converter)
(adjust-frequency dataset
converter
{:keys [include-columns ungroup? rename-index-to]
:or {ungroup? false}})
Adjusts the frequency of the time index column by applying the
converter
function to the values in the time index. Returns a
grouped dataset that can be used with tablecloth.api.aggregate
,
for example.
Options are:
Adjusts the frequency of the time index column by applying the `converter` function to the values in the time index. Returns a grouped dataset that can be used with `tablecloth.api.aggregate`, for example. Options are: - rename-index-to - Rename the index column name - ungroup? - Set to true if you want the function to return a grouped dataset. Default: false - include-columns - Additional columns to include when adjusting when grouping at a new frequency.
(anytime->milliseconds str-or-datetime)
(anytime->milliseconds str-or-datetime timezone)
Converts any time unit type to milliseconds.
Converts any time unit type to milliseconds.
(convert-to datetime datetime-type)
Convert time to different type as specified by datetime-type
.
Convert time to different type as specified by `datetime-type`.
Extracts the day of the month from any datetime.
Extracts the day of the month from any datetime.
Extract the day of week from any datetime.
Extract the day of week from any datetime.
Extracts year (as number) from any datetime.
Extracts year (as number) from any datetime.
(down-to-nearest interval chrono-unit)
(down-to-nearest interval chrono-unit datetime)
(hour datetime)
Extracts the hour from any datetime.
Extracts the hour from any datetime.
(index-by dataset index-column-name)
Identifies the column that should be used as the index for the dataset. Useful when functions that use the index to perform their operations, cannot auto-detect the index column. This can happen if there are more than one time-based column; or, if it is not clear that any column contains time data.
Identifies the column that should be used as the index for the dataset. Useful when functions that use the index to perform their operations, cannot auto-detect the index column. This can happen if there are more than one time-based column; or, if it is not clear that any column contains time data.
(milliseconds->anytime millis datetime-type)
(milliseconds->anytime millis datetime-type timezone)
Convert milliseconds to any time unit as specified by datetime-type
.
Convert milliseconds to any time unit as specified by `datetime-type`.
(minute datetime)
Extracts the minute of hour (number) from any datetime.
Extracts the minute of hour (number) from any datetime.
(rename-index dataset new-index-name)
Renames the index column if it can be identified.
Renames the index column if it can be identified.
(rolling-window ds column-name len)
rolling-window dataset
rolling-window dataset
(secnd datetime)
Extracts the second of minute from any datetime.
Extracts the second of minute from any 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 |
(string->time str)
Given an identifiable time, returns the correct datetime object. Optionally, you can specify a target type to also convert to a different type in one step.
TODO: How do we define what an 'identifiable' string means?
Given an identifiable time, returns the correct datetime object. Optionally, you can specify a target type to also convert to a different type in one step. TODO: How do we define what an 'identifiable' string means?
Extracts year (as number) from any datetime.
Extracts year (as number) from any datetime.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close