A modern, open-source Python library built for efficient, scalable data profiling and visualization
Project description
aiedatools
aiedatools is a modern, open-source Python library built for efficient, scalable data profiling and visualization. It is designed for data scientists working with Pandas, Polars, and Google BigQuery (currently).
Features
- Fast, rich profiling summaries across diverse datasets
- Interactive visualizations for single and multi-variable analysis
- Google BigQuery → Polars DataFrame workflows with type safety
- Works with Pandas, Polars, Arrow, dicts, and more
- Statistical testing (p-value matrix) and correlation heatmaps
Installation
Requires Python >= 3.10. Install via pip:
pip install aiedatools
Dependencies
- numpy >= 2.0.0
- pandas >= 2.2.2
- polars
- duckdb
- plotly
- scipy
- pyarrow
- google-cloud-bigquery
Quick Start
1. Table Profiling
from aiedatools import profile_table
import polars as pl
df = pl.read_csv('mydata.csv')
summary = profile_table(df)
print(summary.head())
- Detects column type (cat/num/date/key)
- Computes missing rate, unique levels, distributions, outlier indicators
2. Plotting
Categorical with Bar Plot
from aiedatools import plot_cat_bar
plot_cat_bar(df, 'category')
# With target variable:
plot_cat_bar(df, 'category', target_col='score')
Numeric Histogram and Box Plot
from aiedatools import plot_numeric
plot_numeric(df, 'value', plot_type='hist')
plot_numeric(df, 'value', plot_type='box')
3. Two-variable Analysis
Correlation Heatmap and P-value Heatmap
from aiedatools import plot_corr_heatmap, plot_pvalue_heatmap
plot_corr_heatmap(df, var_num=['score', 'age', 'income'])
plot_pvalue_heatmap(df, list_var_num=['score', 'age'], list_var_cat=['category'])
4. BigQuery to Polars
from aiedatools import bq_to_polars
query = "SELECT * FROM `project.dataset.my_table` LIMIT 1000"
df = bq_to_polars(query)
Detailed Usage Examples
Profiling a Polars DataFrame
import polars as pl
from aiedatools import profile_table
df = pl.DataFrame({
'group': ['A', 'A', 'B', 'B', 'C'],
'score': [85, 87, 90, 75, 88],
'age': [20, 20, 21, 19, 22]
})
profile = profile_table(df)
print(profile)
Plotting with Top N Categories and Target
from aiedatools import plot_cat_bar
plot_cat_bar(df, 'group', target_col='score', number_of_bars=2)
Numeric Variable Distribution with KDE Overlay
from aiedatools import plot_numeric
plot_numeric(df, 'score', plot_type=['hist', 'box'])
Custom Correlation Heatmap with Options
from aiedatools import plot_corr_heatmap
plot_corr_heatmap(df, var_num=['score', 'age'], colorscale='Viridis', round_decimals=3, color_by_absolute=True)
BigQuery: Load Results Directly to Polars
from aiedatools import bq_to_polars
query = 'SELECT category, COUNT(*) as cnt FROM `myproject.mydataset.table` GROUP BY category'
df_bq = bq_to_polars(query)
print(df_bq.head())
API Overview
Profile & Plot
profile_table(table)— Profile columns, detect types, missingness, value distributions, outliersplot_cat_bar(table, cat_col, target_col=None, number_of_bars=None)— Bar plot for categorical columns, with support for target aggregation, top-N selection, and "other values"plot_numeric(table, num_col, plot_type='hist')— Histogram or box plot of numeric columns
Two-variable Analysis
plot_corr_heatmap(df, var_num, ...)— Correlation heatmap for selected columnsplot_pvalue_heatmap(df, list_var_num, list_var_cat, ...)— P-value matrix and heatmap (supports numeric, categorical, and mixed pairs)
Cloud-to-Analytics (BigQuery)
bq_to_polars(query)— Runs BigQuery SQL and returns a Polars DataFrame, fixing Arrow types for compatibility
Advanced Usage
Custom Column Type Thresholds
You can adjust num_to_cat_threshold and cat_to_key_threshold in profile_table to fine-tune column classification.
profile = profile_table(df, num_to_cat_threshold=10, cat_to_key_threshold=50)
Use with Arrow Tables or Dictionaries
import pyarrow as pa
arrow_table = pa.table({'cat': ['A', 'B'], 'val': [1, 2]})
profile_table(arow_table)
Plot Customization
- All plotting functions return a Plotly Figure (
fig) — you can further modify it (e.g., layout, colors).
_, fig = plot_cat_bar(df, 'group')
fig.update_layout(title='Custom Title')
fig.show()
BigQuery Authentication via Service Account Key
Be sure to authenticate with Google Cloud before using bq_to_polars. This can be done via the GOOGLE_APPLICATION_CREDENTIALS environment variable:
Linux / macOS (bash, zsh, etc.)
Temporary (current session only):
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
Permanent (all sessions):
Please get steps from internet.
Windows
Temporary (current session only):
CMD
set GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account-file.json"
Powershell
$env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account-file.json"
Permanent (all sessions):
CMD/Powershell
setx GOOGLE_APPLICATION_CREDENTIALS "C:\path\to\your\service-account-file.json"
Verify
CMD
echo %GOOGLE_APPLICATION_CREDENTIALS%
Powershell
echo $env:GOOGLE_APPLICATION_CREDENTIALS
License
Copyright (c) Lei Liu. See LICENSE for details.
Author
Lei Liu (dr.mathesis@outlook.com)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiedatools-0.0.4.tar.gz.
File metadata
- Download URL: aiedatools-0.0.4.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b076e0718837fbbbc90d0f35947fb196b73408f08a546813ec5a5e4cfc38b755
|
|
| MD5 |
7edc66690bbc970621fcd595fc1c135a
|
|
| BLAKE2b-256 |
a9dba1ec0c46e4665645f7c1f04ff3d987a9a9c16fcf45bee97b0d7bf9e64d27
|
Provenance
The following attestation bundles were made for aiedatools-0.0.4.tar.gz:
Publisher:
publish.yml on drmathesis/aiedatools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiedatools-0.0.4.tar.gz -
Subject digest:
b076e0718837fbbbc90d0f35947fb196b73408f08a546813ec5a5e4cfc38b755 - Sigstore transparency entry: 758324959
- Sigstore integration time:
-
Permalink:
drmathesis/aiedatools@3760a46215053be1867c9cb8df8e22a1c95cecee -
Branch / Tag:
refs/tags/ver-0.0.4 - Owner: https://github.com/drmathesis
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3760a46215053be1867c9cb8df8e22a1c95cecee -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiedatools-0.0.4-py3-none-any.whl.
File metadata
- Download URL: aiedatools-0.0.4-py3-none-any.whl
- Upload date:
- Size: 27.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7d7b742b12f23cb0fe9c0ded92e645f6b818b7ac6edf2c88520e6bb0d3f40bc
|
|
| MD5 |
bc9a690920bdf3273c4166b6dc09424f
|
|
| BLAKE2b-256 |
5930762da6a24964b0f70e0bd78933312c9120c2294f3f661e2b1bfc45db400a
|
Provenance
The following attestation bundles were made for aiedatools-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on drmathesis/aiedatools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiedatools-0.0.4-py3-none-any.whl -
Subject digest:
c7d7b742b12f23cb0fe9c0ded92e645f6b818b7ac6edf2c88520e6bb0d3f40bc - Sigstore transparency entry: 758324994
- Sigstore integration time:
-
Permalink:
drmathesis/aiedatools@3760a46215053be1867c9cb8df8e22a1c95cecee -
Branch / Tag:
refs/tags/ver-0.0.4 - Owner: https://github.com/drmathesis
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3760a46215053be1867c9cb8df8e22a1c95cecee -
Trigger Event:
release
-
Statement type: