datatable-to-map

Uses a datatable to create a map of key-value pairs

One column is used as the keys in the key-value pair, and another column is used for the values in the pair.

Arguments

Inputs:

data: The datatable containing at least two columns.

key column: The name of the column containing keys. If unspecified, defaults to 'key' (and will thus cause an error if there is no column named 'key'.) Each key must be unique.

value column: The name of the column containing values. If unspecified, defaults to 'value' (and will thus cause an error if there is no column named 'value'.)

Output:

map: The map of key-value pairs created using the key column and value column.

Example

Possible use cases

  • Creating bins for data, based on known relationships or categories.

  • Creating a dynamic dictionary in a spreadsheet that multiple people can edit and update, and feeding that spreadsheet into Data-flo as a map, enabling the automatic remapping of frequently-misspelt words.

  • Using a spreadsheet to update sample lists and their positions in laboratory experiment plates.

Last updated