# Python data quality libraries

Python data quality libraries check that datasets match the rules a team expects, such as types, ranges, null counts, and uniqueness. A check runs against a DataFrame, a SQL table, or a Spark dataset and returns a structured result for each rule. These libraries let data pipelines stop bad records before they reach reports or machine learning models.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [GX Core](#gx-core) | 19.5M | 11.9K | Nov 2026 | Apache-2.0 |
| [PyDeequ](#pydeequ) | 13.3M | 828 | Sep 2026 | Apache-2.0 |
| [Pandera](#pandera) | 10.2M | 4.5K | Nov 2026 | MIT |
| [DQX](#databricks-labs-dqx) | 6.2M | 487 | Nov 2026 | Databricks License |
| [Soda Core](#soda-core) | 1.9M | 2.5K | Nov 2026 | Proprietary |
| [DataComPy](#datacompy) | 1.8M | 671 | Oct 2026 | Apache-2.0 |
| [Data Contract CLI](#datacontract-cli) | 1.1M | 1.1K | Nov 2026 | MIT |
| [Frictionless](#frictionless) | 988.8K | 858 | Oct 2026 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[GX Core](#gx-core) has the most monthly downloads in this comparison, at 19.5M.

## Capabilities

| Library | Direct pandas dataset input | PySpark quality workflow |
| --- | --- | --- |
| [GX Core](#gx-core) | Yes | Yes |
| [PyDeequ](#pydeequ) | No | Yes |
| [Pandera](#pandera) | Yes | Yes |
| [DQX](#databricks-labs-dqx) | No | Yes |
| [Soda Core](#soda-core) | Undocumented | Via plugin |
| [DataComPy](#datacompy) | Yes | Yes |
| [Data Contract CLI](#datacontract-cli) | No | Yes |
| [Frictionless](#frictionless) | Yes | Undocumented |

## Libraries

### GX Core

[GitHub](https://github.com/fivetran/great_expectations) · [PyPI](https://pypi.org/project/great-expectations) · [Docs](https://docs.greatexpectations.io/docs/core/introduction/try_gx/)

Defines data expectations, validates datasets, and builds readable validation documentation.

- Downloads / mo: 19.5M
- Stars: 11.9K
- Last release: 1.25.0
- License: Apache-2.0
- Capabilities: [From the GX Core docs](https://docs.greatexpectations.io/docs/core/introduction/try_gx/)

**Strengths**

- **Organizes reusable data expectations.** Define expectations as unit tests for data.
- **Builds readable validation sites.** Generate HTML pages for expectation suites and validation results.

**Watch out for**

- **Defaults to summary results.** Set result_format for the failure details the pipeline needs.

```sh
pip install great_expectations pandas
```

**fivetran/airflow-provider-great-expectations** (175 stars)

[fivetran/airflow-provider-great-expectations](https://github.com/fivetran/airflow-provider-great-expectations) 

```python
def _get_pandas_batch_definition(
    self, gx_context: AbstractDataContext
) -> BatchDefinition:
    name = self.task_id
    try:
        data_source = gx_context.data_sources.get(name=name)
        if not isinstance(data_source, PandasDatasource):
            raise ExistingDataSourceTypeMismatch(
                expected_type=PandasDatasource,
                actual_type=type(data_source),
                name=name,
            )
    except KeyError:
        data_source = gx_context.data_sources.add_pandas(name=name)

    try:
        asset = data_source.get_asset(name=name)
    except LookupError:
        asset = data_source.add_dataframe_asset(name=name)

    try:
        batch_definition = asset.get_batch_definition(name=name)
    except KeyError:
        batch_definition = asset.add_batch_definition_whole_dataframe(name=name)

    return batch_definition

```

[great_expectations_provider/operators/validate_dataframe.py](https://github.com/fivetran/airflow-provider-great-expectations/blob/0893a15cb4a66d306f57f87bc2237e578952ed4f/great_expectations_provider/operators/validate_dataframe.py#L123-L148) · [More projects using GX Core →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20great-expectations%20for%20dataset%20quality%20checks%20and%20validation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import great_expectations as gx
import pandas as pd

context = gx.get_context()
frame = pd.DataFrame({'value': [1, 2]})
source = context.data_sources.add_pandas('pandas')
asset = source.add_dataframe_asset(name='frame')
batch_definition = asset.add_batch_definition_whole_dataframe('whole')
batch = batch_definition.get_batch(batch_parameters={'dataframe': frame})
result = batch.validate(gx.expectations.ExpectColumnValuesToBeBetween(column='value', min_value=1))
print(result)

```

From [try_gx_exploratory.py](https://docs.greatexpectations.io/docs/core/introduction/try_gx/)

### PyDeequ

[GitHub](https://github.com/awslabs/python-deequ) · [PyPI](https://pypi.org/project/pydeequ) · [Docs](https://github.com/awslabs/python-deequ/blob/master/README.md)

Runs Deequ data-quality metrics, constraints, and suggestions through Apache Spark.

- Downloads / mo: 13.3M
- Stars: 828
- Last release: 1.7.0
- License: Apache-2.0
- Capabilities: [From the PyDeequ docs](https://github.com/awslabs/python-deequ/blob/master/README.md)

**Strengths**

- **Profiles data and verifies constraints.** Combine metrics, constraint checks, and suggested rules in Spark.
- **Tracks metrics across runs.** Persist metrics in a repository for comparisons over time.

**Watch out for**

- **Needs a matching Spark runtime.** Set SPARK_VERSION before importing PyDeequ and load its matching JAR.

```sh
pip install pydeequ
```

**aws-samples/data-science-on-aws** (142 stars)

[aws-samples/data-science-on-aws](https://github.com/aws-samples/data-science-on-aws) 

```python
def main():
    args_iter = iter(sys.argv[1:])
    args = dict(zip(args_iter, args_iter))

    # Retrieve the args and replace 's3://' with 's3a://' (used by Spark)
    s3_input_data = args["s3_input_data"].replace("s3://", "s3a://")
    print(s3_input_data)
    s3_output_analyze_data = args["s3_output_analyze_data"].replace("s3://", "s3a://")
    print(s3_output_analyze_data)

    spark = SparkSession.builder.appName("PySparkAmazonReviewsAnalyzer").getOrCreate()

    schema = StructType(
        [
            StructField("marketplace", StringType(), True),
            StructField("customer_id", StringType(), True),
            StructField("review_id", StringType(), True),
            StructField("product_id", StringType(), True),
            StructField("product_parent", StringType(), True),
            StructField("product_title", StringType(), True),
            StructField("product_category", StringType(), True),
            StructField("star_rating", IntegerType(), True),
            StructField("helpful_votes", IntegerType(), True),
            StructField("total_votes", IntegerType(), True),
            StructField("vine", StringType(), True),
            StructField("verified_purchase", StringType(), True),
            StructField("review_headline", StringType(), True),
            StructField("review_body", StringType(), True),
            StructField("review_date", StringType(), True),
        ]
    )

    dataset = spark.read.csv(s3_input_data, header=True, schema=schema, sep="\t", quote="")

    # Calculate statistics on the dataset
    analysisResult = (
        AnalysisRunner(spark)
        .onData(dataset)
        .addAnalyzer(Size())
        .addAnalyzer(Completeness("review_id"))
        .addAnalyzer(ApproxCountDistinct("review_id"))
        .addAnalyzer(Mean("star_rating"))
        .addAnalyzer(Compliance("top star_rating", "star_rating >= 4.0"))
        .addAnalyzer(Correlation("total_votes", "star_rating"))
        .addAnalyzer(Correlation("total_votes", "helpful_votes"))
        .run()
    )

    metrics = AnalyzerContext.successMetricsAsDataFrame(spark, analysisResult)
    metrics.show(truncate=False)
    metrics.repartition(1).write.format("csv").mode("overwrite").option("header", True).option("sep", "\t").save(
        "{}/dataset-metrics".format(s3_output_analyze_data)
    )

    # Check data quality
    verificationResult = (
        VerificationSuite(spark)
        .onData(dataset)
        .addCheck(
            Check(spark, CheckLevel.Error, "Review Check")
            .hasSize(lambda x: x >= 200000)
            .hasMin("star_rating", lambda x: x == 1.0)
            .hasMax("star_rating", lambda x: x == 5.0)
            .isComplete("review_id")
            .isUnique("review_id")
            .isComplete("marketplace")
            .isContainedIn("marketplace", ["US", "UK", "DE", "JP", "FR"])
        )
        .run()
    )

    print(f"Verification Run Status: {verificationResult.status}")
    resultsDataFrame = VerificationResult.checkResultsAsDataFrame(spark, verificationResult)
    resultsDataFrame.show(truncate=False)
    resultsDataFrame.repartition(1).write.format("csv").mode("overwrite").option("header", True).option(
        "sep", "\t"
    ).save("{}/constraint-checks".format(s3_output_analyze_data))

    verificationSuccessMetricsDataFrame = VerificationResult.successMetricsAsDataFrame(spark, verificationResult)
    verificationSuccessMetricsDataFrame.show(truncate=False)
    verificationSuccessMetricsDataFrame.repartition(1).write.format("csv").mode("overwrite").option(
        "header", True
    ).option("sep", "\t").save("{}/success-metrics".format(s3_output_analyze_data))

    # Suggest new checks and constraints
    suggestionsResult = ConstraintSuggestionRunner(spark).onData(dataset).addConstraintRule(DEFAULT()).run()

    suggestions = suggestionsResult["constraint_suggestions"]
    parallelizedSuggestions = spark.sparkContext.parallelize(suggestions)

    suggestionsResultsDataFrame = spark.createDataFrame(parallelizedSuggestions)
    suggestionsResultsDataFrame.show(truncate=False)
    suggestionsResultsDataFrame.repartition(1).write.format("csv").mode("overwrite").option("header", True).option(
        "sep", "\t"
    ).save("{}/constraint-suggestions".format(s3_output_analyze_data))

    print("end of run reached")
    spark.sparkContext._gateway.close()
    spark.stop()
    print("spark stopped")

```

[preprocess_deequ_pyspark.py](https://github.com/aws-samples/data-science-on-aws/blob/6239856d85bf71386791c8bd66c0a92037a8a5ae/preprocess_deequ_pyspark.py#L27-L126) · [More projects using PyDeequ →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pydeequ%20for%20dataset%20quality%20checks%20and%20validation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from pyspark.sql import SparkSession
from pydeequ.analyzers import AnalysisRunner, Size

spark = SparkSession.builder.getOrCreate()
frame = spark.createDataFrame([(1,), (2,)], ['value'])
result = AnalysisRunner(spark).onData(frame).addAnalyzer(Size()).run()
print(result)

```

From [README.md](https://github.com/awslabs/python-deequ/blob/master/README.md)

### Pandera

[GitHub](https://github.com/unionai-oss/pandera) · [PyPI](https://pypi.org/project/pandera) · [Docs](https://pandera.readthedocs.io/en/stable/)

Validates dataframe-like objects against schemas, column properties, and custom checks.

- Downloads / mo: 10.2M
- Stars: 4.5K
- Last release: 0.36.0
- License: MIT
- Capabilities: [From the Pandera docs](https://pandera.readthedocs.io/en/stable/)

**Strengths**

- **Validates dataframe columns and rules.** Check the types and properties of dataframe columns.
- **Supports different dataframe backends.** Choose the backend extra for the dataframe library in use.

**Watch out for**

- **Stops after the first error.** Set lazy to collect failures across schema checks.

```sh
pip install 'pandera[pandas]'
```

**dagster-io/dagster** (16.4K stars)

[dagster-io/dagster](https://github.com/dagster-io/dagster) 

```python
def _pandera_schema_to_type_check_fn(
    schema: DagsterPanderaSchema,
    table_schema: TableSchema,
) -> Callable[[TypeCheckContext, object], TypeCheck]:
    def type_check_fn(_context, value: object) -> TypeCheck:
        if isinstance(value, VALID_DATAFRAME_CLASSES):
            try:
                # `lazy` instructs pandera to capture every (not just the first) validation error
                # TODO: pending alternative dataframe support
                if isinstance(schema, pa_pd.DataFrameSchema):
                    df = check.inst(value, pd.DataFrame, "Must be a pandas DataFrame.")
                    schema.validate(df, lazy=True)
                # need to check that polars and pandera.polars are available before isinstance
                elif pl and pa_pl and isinstance(schema, pa_pl.DataFrameSchema):  # ty: ignore[redundant-condition]
                    df = check.inst(value, pl.DataFrame, "Must be a polars DataFrame.")
                    schema.validate(df, lazy=True)
                else:
                    check.failed(
                        f"Unexpected schema/value type combination: {type(schema).__name__} / {type(value).__name__}"
                    )
            except pa_errors.SchemaErrors as e:
                return _pandera_errors_to_type_check(e, table_schema)
            except Exception as e:
                return TypeCheck(
                    success=False,
                    description=f"Unexpected error during validation: {e}",
                )
        else:
            return TypeCheck(
                success=False,
                description=(
                    f"Must be one of {VALID_DATAFRAME_CLASSES}, not {type(value).__name__}."
                ),
            )

        return TypeCheck(success=True)

    return type_check_fn

```

[python_modules/libraries/dagster-pandera/dagster_pandera/__init__.py](https://github.com/dagster-io/dagster/blob/b0099d257d666c1c95e8079254060d2ab2caa6f3/python_modules/libraries/dagster-pandera/dagster_pandera/__init__.py#L175-L212) · [More projects using Pandera →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pandera%20for%20dataset%20quality%20checks%20and%20validation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import pandas as pd
import pandera.pandas as pa

schema = pa.DataFrameSchema({'value': pa.Column(int, pa.Check.ge(0))})
validated = schema.validate(pd.DataFrame({'value': [1, 2]}))
print(validated)

```

From [stable.md](https://pandera.readthedocs.io/en/stable/)

### DQX

[GitHub](https://github.com/databrickslabs/dqx) · [PyPI](https://pypi.org/project/databricks-labs-dqx) · [Docs](https://databrickslabs.github.io/dqx/docs/reference/api/engine/)

Runs data quality checks and data quality monitoring.

- Downloads / mo: 6.2M
- Stars: 487
- Last release: 0.17.2
- License: Databricks License
- Capabilities: [From the DQX docs](https://databrickslabs.github.io/dqx/docs/reference/api/engine/)

```sh
pip install databricks-labs-dqx
```

**Quickstart**

```python
from databricks.sdk import WorkspaceClient
from databricks.labs.dqx.engine import DQEngineCore

engine = DQEngineCore(workspace_client=WorkspaceClient())
checks = engine.load_checks_from_local_file('checks.yml')
result = engine.apply_checks_by_metadata(df, checks)

```

From [engine.py](https://databrickslabs.github.io/dqx/docs/reference/api/engine/) · [Find projects using DQX →](https://dashboard.exa.ai/playground/search?q=databricks-labs-dqx%20GitHub%20projects)

### Soda Core

[GitHub](https://github.com/sodadata/soda-core) · [PyPI](https://pypi.org/project/soda-core) · [Docs](https://docs.soda.io/apis/python-api)

Verifies schema and data-quality contracts expressed in YAML.

- Downloads / mo: 1.9M
- Stars: 2.5K
- Last release: 4.30.0
- License: Proprietary
- Capabilities: [From the Soda Core docs](https://docs.soda.io/apis/python-api)

**Strengths**

- **Defines checks as data contracts.** Store schema and data rules in YAML contracts.
- **Returns individual check outcomes.** Inspect each contract’s check results and overall execution status.

**Watch out for**

- **is_passed excludes execution errors.** Use is_ok to reject failed checks and execution errors.

```sh
pip install soda-postgres
```

**Quickstart**

```python
from soda_core.contracts import verify_contract_locally

result = verify_contract_locally(
    data_source_file_path='data_source.yml',
    contract_file_path='contract.yml',
)
print(result)

```

From [__init__.py](https://github.com/sodadata/soda-core/blob/main/soda-core/src/soda_core/contracts/__init__.py) · [Find projects using Soda Core →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20soda-core%20for%20dataset%20quality%20checks%20and%20validation&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### DataComPy

[GitHub](https://github.com/capitalone/datacompy) · [PyPI](https://pypi.org/project/datacompy) · [Docs](https://capitalone.github.io/datacompy/api/datacompy.html)

Compares DataFrames in Python.

- Downloads / mo: 1.8M
- Stars: 671
- Last release: 1.2.0
- License: Apache-2.0
- Capabilities: [From the DataComPy docs](https://capitalone.github.io/datacompy/api/datacompy.html)

```sh
pip install datacompy
```

**Quickstart**

```python
import pandas as pd
from datacompy import PandasCompare

left = pd.DataFrame({'id': [1], 'value': [2]})
right = pd.DataFrame({'id': [1], 'value': [2]})
comparison = PandasCompare(left, right, join_columns='id')
print(comparison.matches())

```

From [README.md](https://github.com/capitalone/datacompy/blob/main/README.md) · [Find projects using DataComPy →](https://dashboard.exa.ai/playground/search?q=datacompy%20GitHub%20projects)

### Data Contract CLI

[GitHub](https://github.com/datacontract/datacontract-cli) · [PyPI](https://pypi.org/project/datacontract-cli) · [Docs](https://cli.datacontract.com/python-library)

Lints data contract YAML files, connects to data sources, and runs schema and quality tests from the command line.

- Downloads / mo: 1.1M
- Stars: 1.1K
- Last release: 1.2.11
- License: MIT
- Capabilities: [From the Data Contract CLI docs](https://cli.datacontract.com/python-library)

```sh
pip install datacontract-cli
```

**Quickstart**

```python
from datacontract.data_contract import DataContract

contract = DataContract(data_contract_file='datacontract.yaml')
run = contract.lint()
print(run.result)

```

From [python-library.md](https://cli.datacontract.com/python-library) · [Find projects using Data Contract CLI →](https://dashboard.exa.ai/playground/search?q=datacontract-cli%20GitHub%20projects)

### Frictionless

[GitHub](https://github.com/frictionlessdata/frictionless-py) · [PyPI](https://pypi.org/project/frictionless) · [Docs](https://github.com/frictionlessdata/frictionless-py/blob/main/docs/guides/validating-data.md)

Describes, extracts, validates, and transforms tabular data.

- Downloads / mo: 988.8K
- Stars: 858
- Last release: 5.21.0
- License: MIT
- Capabilities: [From the Frictionless docs](https://github.com/frictionlessdata/frictionless-py/blob/main/docs/guides/validating-data.md)

```sh
pip install frictionless
```

**Quickstart**

```python
from pprint import pprint
from frictionless import validate

report = validate('capital-invalid.csv')
print(report)

```

From [validating-data.md](https://github.com/frictionlessdata/frictionless-py/blob/main/docs/guides/validating-data.md) · [Find projects using Frictionless →](https://dashboard.exa.ai/playground/search?q=frictionless%20GitHub%20projects)

## FAQ

### Which Python data quality library should I use?

[GX Core](#gx-core) suits teams that define expectations for DataFrames or SQL data and want readable validation documentation. [Pandera](#pandera) suits schema checks on DataFrames inside Python code. [PyDeequ](#pydeequ) and [DQX](#databricks-labs-dqx) suit checks on Spark datasets.

### What is Great Expectations?

Great Expectations, published as [GX Core](#gx-core), defines expectations about data and validates DataFrame batches or SQL data against them. Each run returns structured results and can build readable validation documentation.

### What is Pandera?

[Pandera](#pandera) validates DataFrame-like objects against schemas, column properties, and custom checks. It covers both schema and statistical validation.

### What is DataComPy?

[DataComPy](#datacompy) compares two datasets and reports the differences in rows and columns.

### What is Soda Core?

[Soda Core](#soda-core) verifies schema and data quality contracts written in YAML against a data source.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python data quality libraries GX Core Pandera Soda Core PyDeequ code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
