Skip to main content

polars-qlens

A lightweight Python package for profiling and analyzing data quality with Polars.

Overview

polars-qlens is a Python package for exploring datasets and evaluating their quality through automated profiling and reporting.

It is designed to make it easier to understand the structure and quality of a dataset before using it for analysis, machine learning, or other data-driven applications.

Built with Polars for fast DataFrame operations and designed to be extensible as the project grows.

Features

  • Dataset profiling with Polars
  • Automatic data quality analysis
  • Missing value detection and analysis
  • Column type analysis
  • Numerical and categorical column analysis
  • Constant column detection
  • Duplicate row detection
  • Duplicate column detection
  • Inconsistent categorical value detection
  • Date column detection
  • Invalid date detection
  • Outlier detection using the IQR method
  • Correlation analysis
  • Overall data quality scoring
  • HTML quality reports
  • JSON quality reports
  • Simple Python API
  • Extensible project structure

Installation

Install the latest release from PyPI:

pip install polars-qlens

Usage

Import DatasetProfiler from qlens:

from qlens import DatasetProfiler

Create a profiler using the path to your CSV dataset:

profiler = DatasetProfiler("data.csv")

Load and profile the dataset:

profiler.load_csv()
results = profiler.profile()

The profiler analyzes the dataset and returns the results as a Python dictionary.

Reports

polars-qlens supports generating data quality reports in different formats:

  • Terminal output for quick inspection
  • HTML for human-readable reports
  • JSON for programmatic use

Example:

from qlens import DatasetProfiler
from qlens.report import QualityReport

profiler = DatasetProfiler("data.csv")

profiler.load_csv()
results = profiler.profile()

report = QualityReport(results)

report.generate()
report.to_json("quality_report.json")
report.to_html("quality_report.html")

The generated files are:

quality_report.html
quality_report.json

The HTML report provides a visual overview of the dataset's quality, while the JSON report is useful when the results need to be processed by another program.

Example Workflow

A typical workflow looks like this:

CSV Dataset
    |
    v
DatasetProfiler
    |
    v
Polars DataFrame
    |
    v
Data Quality Analysis
    |
    +------> Missing Data Analysis
    |
    +------> Column Analysis
    |
    +------> Duplicate Detection
    |
    +------> Category Analysis
    |
    +------> Date Analysis
    |
    +------> Outlier Detection
    |
    +------> Correlation Analysis
    |
    +------> Quality Score
    |
    v
QualityReport
    |
    +------> Terminal
    |
    +------> HTML
    |
    +------> JSON

Analysis

The profiler currently analyzes several aspects of dataset quality.

Missing Values

Detects missing values in each column and calculates the percentage of missing values.

Duplicate Rows

Detects duplicate rows in the dataset and reports the total number found.

Constant Columns

Identifies columns containing only one unique value.

Inconsistent Categories

Detects categorical values that differ in formatting but represent the same normalized value.

For example:

Addis Ababa
addis ababa
ADDIS ABABA

Duplicate Columns

Detects columns containing identical data.

Date Analysis

Attempts to identify date columns and detects invalid date values.

Outliers

Detects numerical outliers using the Interquartile Range (IQR) method.

Correlations

Identifies strongly correlated numerical column pairs.

Quality Score

Calculates an overall data quality score based on detected issues.

The score is represented on a scale from:

0 - 100

Requirements

  • Python 3.12+
  • Polars
  • NumPy

Dependencies are installed automatically when polars-qlens is installed from PyPI.

Project Status

polars-qlens is currently in the early development stage.

The current release focuses on establishing the core profiling and reporting functionality.

Future versions will expand the analysis capabilities, improve the reporting system, and introduce additional data quality checks.

Development

Clone the repository:

git clone https://github.com/rcodes-ix/dqengine.git
cd dqengine

Create a virtual environment:

python -m venv .venv

Activate it on Linux/macOS:

source .venv/bin/activate

Install the project in editable mode:

pip install -e .

Project Structure

data-quality-engine/
├── src/
│   └── qlens/
│       ├── __init__.py
│       ├── profiler.py
│       └── report.py
├── .github/
│   └── workflows/
│       └── release.yml
├── .gitignore
├── LICENSE
├── README.md
└── pyproject.toml

License

This project is licensed under the MIT License.

See the LICENSE file for more information.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_qlens-0.1.2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polars_qlens-0.1.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file polars_qlens-0.1.2.tar.gz.

File metadata

  • Download URL: polars_qlens-0.1.2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polars_qlens-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86fa020d73b69c9c283efd2c1eb5a6dfae04b473956689ff754b27183004570e
MD5 63937e4f78e36222e1d3522c04e14ff5
BLAKE2b-256 8d1de863552898e87be65d4ad7a785187b5ac4d0cf07540438bdf39e89ea9ce7

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_qlens-0.1.2.tar.gz:

Publisher: release.yml on rcodes-ix/polars-qlens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_qlens-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: polars_qlens-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polars_qlens-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3037dcfc6a6eb57da5fa75d10b9801df19b29bb949cf5af83bec03ad2bc4623
MD5 c2f77588634c04029ca9f1160358d53c
BLAKE2b-256 1be632fadd5e341298caa7929ee5ef250b869fa7cfe359463ccaf1fd5a98d1ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_qlens-0.1.2-py3-none-any.whl:

Publisher: release.yml on rcodes-ix/polars-qlens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page