Liking cljdoc? Tell your friends :D

tablecloth.api.join-separate


array-column->columnsclj

(array-column->columns ds src-column)
(array-column->columns ds src-column opts)

Converts a column of type java array into several columns, one for each element of the array of all rows. The source column is dropped afterwards. The function assumes that arrays in all rows have same type and length and are numeric.

ds Datset to operate on. src-column The (array) column to convert opts can contain: prefix newly created column will get prefix before column number

Converts a column of type java array into several columns,
one for each element of the array of all rows. The source column is dropped afterwards.
The function assumes that arrays in all rows have same type and length and are numeric.

`ds` Datset to operate on.
`src-column` The (array) column to convert
`opts` can contain:
  `prefix` newly created column will get prefix before column number
sourceraw docstring

columns->array-columnclj

(columns->array-column ds column-selector new-column)

Converts several columns to a single column of type array. The src columns are dropped afterwards.

ds Dataset to operate on. column-selector anything supported by [[select-columns]] new-column new column to create

Converts several columns to a single column of type array.
 The src columns are dropped afterwards.

`ds` Dataset to operate on.
`column-selector` anything supported by [[select-columns]]
`new-column` new column to create
sourceraw docstring

join-columnsclj

(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}
               :as _conf})

Join clumns of dataset. Accepts: dataset column selector (as in select-columns) options :separator (default "-") :drop-columns? - whether to drop source columns or not (default true) :result-type :map - packs data into map :seq - packs data into sequence :string - join strings with separator (default) or custom function which gets row as a vector :missing-subst - substitution for missing value

Join clumns of dataset. Accepts:
dataset
column selector (as in select-columns)
options
`:separator` (default "-")
`:drop-columns?` - whether to drop source columns or not (default true)
`:result-type`
   `:map` - packs data into map
   `:seq` - packs data into sequence
   `:string` - join strings with separator (default)
   or custom function which gets row as a vector
`:missing-subst` - substitution for missing value
sourceraw docstring

map-column->columnsclj

(map-column->columns ds src-col)

The map-column->columns function transforms a dataset by expanding a column containing map values into multiple new columns. Specifically, it takes a source dataset ds and a source column src-col within that dataset (which contains map values), and performs the following operations:

  • Extracts the map data from src-col.
  • Creates a new dataset from this map data, where each key in the maps becomes a column.
  • Generates new column names by combining the name of src-col with each of the original map keys, using a dash (-) as a separator. The type (keyword, symbol, or string) of the new column names matches the type of src-col.
  • Appends these new columns to the original dataset ds.
  • Removes the original src-col from ds.

The result is a new dataset that includes all original columns (except src-col) and the newly expanded columns derived from the maps in src-col. Parameters

'ds': The input dataset, expected to be a Tablecloth dataset or any dataset compatible with the functions used. 'src-col': The name (keyword, symbol, or string) of the source column in ds that contains map values.

Return Value

A new dataset with the following characteristics:

Contains all columns from the original dataset ds, except the src-col. Includes new columns derived from the keys of the maps in src-col, with names formed by combining src-col and the map keys. The new columns are appropriately named and typed, maintaining the type consistency with src-col.

   The map-column->columns function transforms a dataset by expanding a column containing map values into 
   multiple new columns. Specifically, it takes a source dataset ds and a source column src-col within that dataset (which contains map values), and performs the following operations:

- Extracts the map data from src-col.
- Creates a new dataset from this map data, where each key in the maps becomes a column.
- Generates new column names by combining the name of src-col with each of the original map keys, using a dash (-) as a separator. The type (keyword, symbol, or string) of the new column names matches the type of src-col.
- Appends these new columns to the original dataset ds.
- Removes the original src-col from ds.

The result is a new dataset that includes all original columns (except src-col) and the newly expanded columns derived from the maps in src-col.
Parameters
 

'ds': The input dataset, expected to be a Tablecloth dataset or any dataset compatible with the functions used.
'src-col': The name (keyword, symbol, or string) of the source column in ds that contains map values.

   Return Value
 
A new dataset with the following characteristics:

Contains all columns from the original dataset ds, except the src-col.
Includes new columns derived from the keys of the maps in src-col, with names formed by combining src-col and the map keys.
The new columns are appropriately named and typed, maintaining the type consistency with src-col.
   
sourceraw docstring

separate-columnclj

(separate-column ds column)
(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 ""}
                  :as _conf})
source

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

× close