(->array ds colname)
(->array ds colname datatype)
Convert numerical column(s) to java array
Convert numerical column(s) to java array
(add-column ds column-name column)
(add-column ds column-name column size-strategy)
Add or update (modify) column under column-name
.
column
can be sequence of values or generator function (which gets ds
as input).
Add or update (modify) column under `column-name`. `column` can be sequence of values or generator function (which gets `ds` as input).
(add-columns ds columns-map)
(add-columns ds columns-map size-strategy)
Add or updade (modify) columns defined in columns-map
(mapping: name -> column)
Add or updade (modify) columns defined in `columns-map` (mapping: name -> column)
(add-or-replace-column ds column-name column)
(add-or-replace-column ds column-name column size-strategy)
(add-or-replace-columns ds columns-map)
(add-or-replace-columns ds columns-map size-strategy)
(aggregate ds aggregator)
(aggregate ds
aggregator
{:keys [default-column-name-prefix ungroup? parallel?]
:or {default-column-name-prefix "summary" ungroup? true}
:as options})
Aggregate dataset by providing:
Aggregation functions can return:
Aggregate dataset by providing: - aggregation function - map with column names and functions - sequence of aggregation functions Aggregation functions can return: - single value - seq of values - map of values with column names
(aggregate-columns ds columns-selector column-aggregators)
(aggregate-columns ds columns-selector column-aggregators options)
Aggregates each column separately
Aggregates each column separately
(anti-join ds-left ds-right columns-selector)
(anti-join ds-left ds-right columns-selector options)
(as-regular-dataset ds)
Remove grouping tag
Remove grouping tag
(by-rank ds columns-selector rank-predicate)
(by-rank ds
columns-selector
rank-predicate
{:keys [desc? ties] :or {desc? true ties :dense}})
Select rows using rank
on a column, ties are resolved using :dense
method.
See R docs. Rank uses 0 based indexing.
Possible :ties
strategies: :average
, :first
, :last
, :random
, :min
, :max
, :dense
.
:dense
is the same as in data.table::frank
from R
:desc?
set to true (default) order descending before calculating rank
Select rows using `rank` on a column, ties are resolved using `:dense` method. See [R docs](https://www.rdocumentation.org/packages/base/versions/3.6.1/topics/rank). Rank uses 0 based indexing. Possible `:ties` strategies: `:average`, `:first`, `:last`, `:random`, `:min`, `:max`, `:dense`. `:dense` is the same as in `data.table::frank` from R `:desc?` set to true (default) order descending before calculating rank
(clone item)
Clone an object. Can clone anything convertible to a reader.
Clone an object. Can clone anything convertible to a reader.
(column-names ds)
(column-names ds columns-selector)
(column-names ds columns-selector meta-field)
(concat dataset & datasets)
Concatenate datasets in place. See also concat-copying as it may be more efficient for your use case.
Concatenate datasets in place. See also concat-copying as it may be more efficient for your use case.
(concat-copying dataset & datasets)
Concatenate datasets into a new dataset copying data. Respects missing values. Datasets must all have the same columns. Result column datatypes will be a widening cast of the datatypes.
Concatenate datasets into a new dataset copying data. Respects missing values. Datasets must all have the same columns. Result column datatypes will be a widening cast of the datatypes.
(convert-types ds coltype-map-or-columns-selector)
(convert-types ds columns-selector new-types)
Convert type of the column to the other type.
Convert type of the column to the other type.
(dataset)
(dataset data)
(dataset data
{:keys [single-value-column-name column-names layout]
:or {single-value-column-name :$value layout :as-columns}
:as options})
Create dataset
.
Dataset can be created from:
Create `dataset`. Dataset can be created from: * single value * map of values and/or sequences * sequence of maps * sequence of columns * file or url
(dataset->str ds)
(dataset->str ds options)
Convert a dataset to a string. Prints a single line header and then calls dataset-data->str.
For options documentation see dataset-data->str.
Convert a dataset to a string. Prints a single line header and then calls dataset-data->str. For options documentation see dataset-data->str.
(drop ds columns-selector rows-selector)
Drop columns and rows.
Drop columns and rows.
(drop-columns ds)
(drop-columns ds columns-selector)
(drop-columns ds columns-selector meta-field)
Drop columns by (returns dataset):
Drop columns by (returns dataset): - name - sequence of names - map of names with new names (rename) - function which filter names (via column metadata)
(drop-missing ds)
(drop-missing ds columns-selector)
Drop rows with missing values
columns-selector
selects columns to look at missing values
Drop rows with missing values `columns-selector` selects columns to look at missing values
(drop-rows ds rows-selector)
(drop-rows ds rows-selector {:keys [select-keys pre result-type parallel?]})
Drop rows using:
Drop rows using: - row id - seq of row ids - seq of true/false - fn with predicate
(fill-range-replace ds colname max-span)
(fill-range-replace ds colname max-span missing-strategy)
(fill-range-replace ds colname max-span missing-strategy missing-value)
(full-join ds-left ds-right columns-selector)
(full-join ds-left ds-right columns-selector options)
(group-by ds grouping-selector)
(group-by ds
grouping-selector
{:keys [select-keys result-type]
:or {result-type :as-dataset select-keys :all}
:as options})
Group dataset by:
Options are:
select-keys
seq.:as-dataset
, default) or as map of datasets (:as-map
) or as map of row indexes (:as-indexes
) or as sequence of (sub)datasetsdataset
fnWhen dataset is returned, meta contains :grouped?
set to true. Columns in dataset:
Group dataset by: - column name - list of columns - map of keys and row indexes - function getting map of values Options are: - select-keys - when grouping is done by function, you can limit fields to a `select-keys` seq. - result-type - return results as dataset (`:as-dataset`, default) or as map of datasets (`:as-map`) or as map of row indexes (`:as-indexes`) or as sequence of (sub)datasets - other parameters which are passed to `dataset` fn When dataset is returned, meta contains `:grouped?` set to true. Columns in dataset: - name - group name - group-id - id of the group (int) - data - group as dataset
(grouped? ds)
Is dataset
represents grouped dataset (result of group-by
)?
Is `dataset` represents grouped dataset (result of `group-by`)?
(groups->map ds)
Convert grouped dataset to the map of groups
Convert grouped dataset to the map of groups
(inner-join ds-left ds-right columns-selector)
(inner-join ds-left ds-right columns-selector options)
(join-columns ds target-column columns-selector)
(join-columns ds
target-column
columns-selector
{:keys [separator missing-subst drop-columns? result-type
parallel?]
:or {separator "-" drop-columns? true result-type :string}})
(left-join ds-left ds-right columns-selector)
(left-join ds-left ds-right columns-selector options)
(map-columns ds column-name map-fn)
(map-columns ds column-name columns-selector map-fn)
(map-columns ds column-name new-type columns-selector map-fn)
(order-by ds columns-or-fn)
(order-by ds columns-or-fn comparators)
(order-by ds columns-or-fn comparators {:keys [parallel?]})
Order dataset by:
Order dataset by: - column name - columns (as sequence of names) - key-fn - sequence of columns / key-fn Additionally you can ask the order by: - :asc - :desc - custom comparator function
(pivot->longer ds)
(pivot->longer ds columns-selector)
(pivot->longer
ds
columns-selector
{:keys [target-columns value-column-name splitter drop-missing? datatypes]
:or {target-columns :$column value-column-name :$value drop-missing? true}})
tidyr
pivot_longer api
`tidyr` pivot_longer api
(pivot->wider ds columns-selector value-columns)
(pivot->wider
ds
columns-selector
value-columns
{:keys [fold-fn concat-columns-with concat-value-with drop-missing?]
:or {concat-columns-with "_" concat-value-with "-" drop-missing? true}})
(rename-columns ds columns-mapping)
(rename-columns ds columns-selector columns-map-fn)
Rename columns with provided old -> new name map
Rename columns with provided old -> new name map
(reorder-columns ds columns-selector & columns-selectors)
Reorder columns using column selector(s). When column names are incomplete, the missing will be attached at the end.
Reorder columns using column selector(s). When column names are incomplete, the missing will be attached at the end.
(replace-missing ds)
(replace-missing ds strategy)
(replace-missing ds columns-selector strategy)
(replace-missing ds columns-selector strategy value)
(right-join ds-left ds-right columns-selector)
(right-join ds-left ds-right columns-selector options)
(select ds columns-selector rows-selector)
Select columns and rows.
Select columns and rows.
(select-columns ds)
(select-columns ds columns-selector)
(select-columns ds columns-selector meta-field)
Select columns by (returns dataset):
Select columns by (returns dataset): - name - sequence of names - map of names with new names (rename) - function which filter names (via column metadata)
(select-missing ds)
(select-missing ds columns-selector)
Select rows with missing values
columns-selector
selects columns to look at missing values
Select rows with missing values `columns-selector` selects columns to look at missing values
(select-rows ds rows-selector)
(select-rows ds rows-selector {:keys [select-keys pre result-type parallel?]})
Select rows using:
Select rows using: - row id - seq of row ids - seq of true/false - fn with predicate
(semi-join ds-left ds-right columns-selector)
(semi-join ds-left ds-right columns-selector options)
(separate-column ds column separator)
(separate-column ds column target-columns separator)
(separate-column ds
column
target-columns
separator
{:keys [missing-subst drop-column? parallel?]
:or {missing-subst ""}})
(shape ds)
Returns shape of the dataset [rows, cols]
Returns shape of the dataset [rows, cols]
(split ds)
(split ds split-type)
(split ds split-type {:keys [seed parallel?] :as opts})
Split given dataset into train and test datasets as a lazy sequence of maps containing with :train
and :test
keys.
split-type
can be one of the following:
:kfold
- k-fold strategy, :k
defines number of folds (defaults to 5
), produces k
splits:bootstrap
- :ratio
defines ratio of observations put into result (defaults to 1.0
), produces 1
split:holdout
- split into two parts with given ratio (defaults to 2/3
), produces 1
split:loo
- leave one out, produces the same number of splits as number of observationsAdditionally you can provide:
:seed
- for random number generator:repeats
- repeat procedure :repeats
times:partition-selector
- same as in group-by
for stratified splitting to reflect dataset structure in splits.Rows are shuffled before splitting.
In case of grouped dataset each group is processed separately, pairs of grouped dataset are returned.
See more
Split given dataset into train and test datasets as a lazy sequence of maps containing with `:train` and `:test` keys. `split-type` can be one of the following: * `:kfold` - k-fold strategy, `:k` defines number of folds (defaults to `5`), produces `k` splits * `:bootstrap` - `:ratio` defines ratio of observations put into result (defaults to `1.0`), produces `1` split * `:holdout` - split into two parts with given ratio (defaults to `2/3`), produces `1` split * `:loo` - leave one out, produces the same number of splits as number of observations Additionally you can provide: * `:seed` - for random number generator * `:repeats` - repeat procedure `:repeats` times * `:partition-selector` - same as in `group-by` for stratified splitting to reflect dataset structure in splits. Rows are shuffled before splitting. In case of grouped dataset each group is processed separately, pairs of grouped dataset are returned. See [more](https://www.mitpressjournals.org/doi/pdf/10.1162/EVCO_a_00069)
(ungroup ds)
(ungroup ds
{:keys [order? add-group-as-column add-group-id-as-column separate?
dataset-name parallel?]
:or {separate? true}})
Concat groups into dataset.
When add-group-as-column
or add-group-id-as-column
is set to true
or name(s), columns with group name(s) or group id is added to the result.
Before joining the groups groups can be sorted by group name.
Concat groups into dataset. When `add-group-as-column` or `add-group-id-as-column` is set to `true` or name(s), columns with group name(s) or group id is added to the result. Before joining the groups groups can be sorted by group name.
(unique-by ds)
(unique-by ds columns-selector)
(unique-by
ds
columns-selector
{:keys [strategy select-keys parallel?] :or {strategy :first} :as options})
(update-columns ds columns-map)
(update-columns ds columns-selector update-functions)
(write! dataset output-path)
(write! dataset output-path options)
Write a dataset out to a file. Supported forms are:
(ds/write! test-ds "test.csv")
(ds/write! test-ds "test.tsv")
(ds/write! test-ds "test.tsv.gz")
(ds/write! test-ds "test.nippy")
(ds/write! test-ds out-stream)
Options:
:max-chars-per-column
- csv,tsv specific, defaults to 65536 - values longer than this will
cause an exception during serialization.:max-num-columns
- csv,tsv specific, defaults to 8192 - If the dataset has more than this number of
columns an exception will be thrown during serialization.:quoted-columns
- csv specific - sequence of columns names that you would like to always have quoted.:file-type
- Manually specify the file type. This is usually inferred from the filename but if you
pass in an output stream then you will need to specify the file type.Write a dataset out to a file. Supported forms are: ```clojure (ds/write! test-ds "test.csv") (ds/write! test-ds "test.tsv") (ds/write! test-ds "test.tsv.gz") (ds/write! test-ds "test.nippy") (ds/write! test-ds out-stream) ``` Options: * `:max-chars-per-column` - csv,tsv specific, defaults to 65536 - values longer than this will cause an exception during serialization. * `:max-num-columns` - csv,tsv specific, defaults to 8192 - If the dataset has more than this number of columns an exception will be thrown during serialization. * `:quoted-columns` - csv specific - sequence of columns names that you would like to always have quoted. * `:file-type` - Manually specify the file type. This is usually inferred from the filename but if you pass in an output stream then you will need to specify the file type.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close