<commit_before>---
layout: docs
menu: docs
title: Transformation
permalink: /docs/transform.html
---

Data transformations in Vega-Lite are described via either top-level transforms (the `transform` property) or [field transforms inside `encoding`](encoding.html#field-transform) (`aggregate`, `bin`, `timeUnit`, and `sort`).

When both types of transforms are specified, the top-level `transform`s are executed first based on the order in the array. Then the inline transforms are executed in this order: `bin`, `timeUnit`, `aggregate`, and `sort`.

## Top-level Transform Property

{: .suppress-error}
```json
{
  "data": ... ,
  "transform": [
     ...
  ],
  "mark": ... ,
  "encoding": ... ,
  ...
}
```

The top-level `transform` object is an array of objects describing transformations. The transformations are executed in the order in which they are specified in the array.
Vega-Lite's `transform` supports the following types of transformations:

- [Aggregate](aggregate.html#transform)
- [Bin](bin.html#transform)
- [Calculate](calculate.html)
- [Filter](filter.html)
- [TimeUnit](timeunit.html#transform)<commit_msg>Clarify top-level vs view-level in transform.md<commit_after>---
layout: docs
menu: docs
title: Transformation
permalink: /docs/transform.html
---

Data transformations in Vega-Lite are described via either [view-level](spec.html#common) transforms (the `transform` property) or [field transforms inside `encoding`](encoding.html#field-transform) (`aggregate`, `bin`, `timeUnit`, and `sort`).

When both types of transforms are specified, the view-level `transform`s are executed first based on the order in the array. Then the inline transforms are executed in this order: `bin`, `timeUnit`, `aggregate`, and `sort`.

## View-level Transform Property

{: .suppress-error}
```json
{
  "data": ... ,
  "transform": [
     ...
  ],
  "mark": ... ,
  "encoding": ... ,
  ...
}
```

The View-level `transform` object is an array of objects describing transformations. The transformations are executed in the order in which they are specified in the array.
Vega-Lite's `transform` supports the following types of transformations:

- [Aggregate](aggregate.html#transform)
- [Bin](bin.html#transform)
- [Calculate](calculate.html)
- [Filter](filter.html)
- [TimeUnit](timeunit.html#transform)
{'fraction_non_alphanumeric': 0.1379757785467128, 'fraction_numerical': 0.0, 'mean_word_length': 4.481042654028436, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4647336', 'n_tokens_mistral': 692, 'n_tokens_neox': 658, 'n_words': 232}