Skip to main content

No project description provided

Project description

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()

Project details


Download files

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

Source Distribution

dq_summary_llm-0.0.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

dq_summary_llm-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file dq_summary_llm-0.0.3.tar.gz.

File metadata

  • Download URL: dq_summary_llm-0.0.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dq_summary_llm-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f754cd42c670eefc4ee04324bafa140d27fee3dabeb0ca016942c34509d1d1d5
MD5 bef18c9bd0f8b67f1ae292fd563f28cf
BLAKE2b-256 74eca272895850cc367171ce63d3131e2f6d41480e702d06c07d005952c42289

See more details on using hashes here.

File details

Details for the file dq_summary_llm-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: dq_summary_llm-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dq_summary_llm-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ea2144ff0bce15e68505cf51ba603e1e821fdefdf574d7b6dd822dbf40a7c4ab
MD5 d02dca2c6f46a8b4d3db61fb8415ad86
BLAKE2b-256 f55a9ad00fd0b04fe3325455be28ecdd4680c050b6cf4fcda1ec7fb171a1893d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page