> For the complete documentation index, see [llms.txt](https://docs.rasgoml.com/rasgo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/one_hot_encode.md).

# One Hot Encode

One hot encode a column. Create a null value flag for the column if any of the values are NULL.

## Parameters

| Name           | Type         | Description                                                                                 | Is Optional |
| -------------- | ------------ | ------------------------------------------------------------------------------------------- | ----------- |
| column         | column       | Column name to one-hot encode                                                               |             |
| list\_of\_vals | string\_list | optional argument to override the dynamic lookup of all values in the target one-hot column | True        |

## Example

```python
ds = rasgo.get.dataset(id)

ds2 = ds.one_hot_encode(column='WEATHER_DESCRIPTION')
ds2.preview()

```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/one_hot_encode/one_hot_encode.sql>" %}
