Skip to main content

Data Quality Summary using LLM

This Python package generates a data quality report for a dataset using a Large Language Model (LLM) such as OpenAI's GPT. It takes a Pandas DataFrame as input and returns a human-readable report about potential data issues. The package also includes full LLM responses and logs for transparency.

Features

  • Accepts any Pandas DataFrame as input.
  • Connects to an LLM using OpenAI API credentials.
  • Generates intelligent data quality reports and explains the data.
  • Optionally allows custom prompts to guide the LLM.

Class: DataQualitySummery

__init__(api_key: str, base_url: str, model: str, temprature: float, max_token: int)

Initializes the LLM connection.

Parameters:

  • api_key: OpenAI or compatible API key.
  • base_url: Base URL of the LLM API.
  • model: The model name, e.g., "gpt-4".
  • temprature: Float to control randomness.
  • max_token: Maximum tokens allowed in the LLM response.

data_quality_details(data: pd.DataFrame, response: str = None) -> str

Generates a data quality report using the provided DataFrame.

Parameters:

  • data: A pandas DataFrame.
  • response: Optional custom instruction for the LLM.

Returns:

  • A string containing the data quality report, including raw LLM responses.

Example Usage

from your_module import DataQualitySummery
import pandas as pd

# Create a sample DataFrame
df = pd.DataFrame({
    'Name': ['Alice', None, 'Charlie'],
    'Age': [25, 30, None]
})

# Initialize the class
dq = DataQualitySummery(
    api_key='your-api-key',
    base_url='https://api.openai.com/v1',
    model='gpt-4',
    temprature=0.7,
    max_token=500
)

# Generate the report
report = dq.data_quality_details(df)
print(report)

data_quality_summary(response) -> str

Generates a data quality summary using the provided response. Pass the data_quality_details

Parameters:

  • response: Previous data_quality_details instruction for the LLM.

Returns:

  • A string containing the data quality summary, including raw LLM responses.

Example Usage

from your_module import DataQualitySummery
import pandas as pd

# Create a sample DataFrame
df = pd.DataFrame({
    'Name': ['Alice', None, 'Charlie'],
    'Age': [25, 30, None]
})

# Initialize the class
dq = DataQualitySummery(
    api_key='your-api-key',
    base_url='https://api.openai.com/v1',
    model='gpt-4',
    temprature=0.7,
    max_token=500
)

# Generate the report
report = dq.data_quality_details(df)
print(report)

summary= dq.data_quality_summary(report)
print(summary)

data_explainer(data, response:str= None, sample_size: int=10) -> str

Generates a explanation base on the dataset make sure the column name is proper not abbreviation of actual column name.

Parameters:

  • data: A pandas DataFrame.
  • response: Optional custom instruction for the LLM.
  • sample_size: Number of data points as an example for the LLM.

Returns:

  • A string containing the data Expalantion what is the data represent, including raw LLM responses.

Example Usage

from your_module import DataQualitySummery
import pandas as pd

# Create a sample DataFrame
df = pd.DataFrame({
    'Name': ['Alice', None, 'Charlie'],
    'Age': [25, 30, None]
})

# Initialize the class
dq = DataQualitySummery(
    api_key='your-api-key',
    base_url='https://api.openai.com/v1',
    model='gpt-4',
    temprature=0.7,
    max_token=500
)

# Generate the explanation

explanation= dq.data_explainer(data, 5)
print()

Metadata

Release files for dq-summary-llm 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dq-summary-llm 0.0.3
File Size Uploaded Provenance
dq_summary_llm-0.0.3.tar.gz 3.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dq-summary-llm 0.0.3
File Interpreter ABI Platform
dq_summary_llm-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / dq_summary_llm-0.0.3.tar.gz

Download URL dq_summary_llm-0.0.3.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f754cd42c670eefc4ee04324bafa140d27fee3dabeb0ca016942c34509d1d1d5
BLAKE2b-256 checksum
How to use checksums
74eca272895850cc367171ce63d3131e2f6d41480e702d06c07d005952c42289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / dq_summary_llm-0.0.3-py3-none-any.whl

Download URL dq_summary_llm-0.0.3-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea2144ff0bce15e68505cf51ba603e1e821fdefdf574d7b6dd822dbf40a7c4ab
BLAKE2b-256 checksum
How to use checksums
f55a9ad00fd0b04fe3325455be28ecdd4680c050b6cf4fcda1ec7fb171a1893d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for dq-summary-llm 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

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