# Great Expectations (GX)

> A free Python tool that tests data. It comes with lots of checks.

**Field:** Data Engineering  
**Category:** Governance & Quality  
**Also known as:** GX, GX Core, Great Expectations Library

## Think of it like

It is like a list of promises your data makes. Then someone checks each promise.

## Definition

Great Expectations is a free, open source Python library for testing data. Each check is called an expectation, such as "values in this column are not null". It ships with dozens of ready-made ones. You run a set of expectations against a batch of data and get a pass or fail for each. It can also write the results as a web page for people to read. A paid cloud version adds a shared workspace.

## Example

A team runs GX on each new file from a partner. A file with a quantity below zero is sent back before it gets to the warehouse.

## Example code

```python
import great_expectations as gx

context = gx.get_context()
source = context.data_sources.add_pandas("pandas")
asset = source.add_dataframe_asset(name="orders")
batch_def = asset.add_batch_definition_whole_dataframe("all")
batch = batch_def.get_batch(batch_parameters={"dataframe": df})

check = gx.expectations.ExpectColumnValuesToBeBetween(
    column="quantity", min_value=1, max_value=100)
print(batch.validate(check).success)
```

Point GX at a DataFrame, then test that every quantity is between 1 and 100.

## Why it matters

It gives Python pipelines one shared way to write and report data tests. The results also show what the data should look like.

## Common mistake

Letting it scan the data and keeping every rule it suggests. Many are too strict and fail on normal days.

## Three principles

- **Expectations.** Each check is a named promise.
- **Ready-made library.** Dozens of common checks built in.
- **Readable results.** Reports people can open and read.

## Related terms

- [Data Quality Check](https://learn.benibix.com/term/data/data-quality-check)
- [Data Quality](https://learn.benibix.com/term/data/data-quality)
- [DataFrame](https://learn.benibix.com/term/data/dataframe)
- [Python](https://learn.benibix.com/term/development/python)

![Top: a pipeline with a gate between load and transform, where checks for not null, unique and price above zero let good rows through and stop bad ones. Bottom: monitors watch a table over a week for row count, freshness and schema, and raise an alert when Thursday's row count drops.](https://learn.benibix.com/diagrams/quality-checks-vs-observability.svg)

---

Source: https://learn.benibix.com/term/data/great-expectations
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
