> For the complete documentation index, see [llms.txt](https://cgps.gitbook.io/data-flo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cgps.gitbook.io/data-flo/reference-guide/create-dictionary-from-datatable.md).

# create-dictionary-from-datatable

## Description

<mark style="color:purple;">`create-dictionary-from-datatable`</mark> *adaptor creates a new dictionary from two columns in a datatable.*

## Inputs

**`data`**\
Type: `datatable`\
Required: Yes\
The datatable containing key-value pairs.

**`key column`**\
Type: `text`\
Required: Yes\
The name of the column which contains keys. If unspecified, defaults to `key`.

**`value column`**\
Type: `text`\
Required: Yes\
The name of the column which contains values. If unspecified, defaults to `value`.

## Outputs

**`dictionary`**\
Type: `dictionary`\
A dictionary containing key-value pairs.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`data`:

| id | code | name           |
| -- | ---- | -------------- |
| 1  | GB   | United Kingdom |
| 2  | TR   | Turkey         |
| 3  | US   | United States  |

`key column:` code

`value column:` name

#### Outputs:

`dictionary`:

| Code | Name           |
| ---- | -------------- |
| GB   | United Kingdom |
| TR   | Turkey         |
| US   | United States  |

-> Created dictionary from datatable with the key column `code` and value column `name`.

## 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.
