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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cgps.gitbook.io/data-flo/reference-guide/create-dictionary-from-datatable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
