Skip to main content

PopDelta is a data mining library for Python, developed to process and analyze Pandas Dataframes, interchangeably referred to as Populations. The primary objective of PopDelta is to identify underlying patterns within the data. This library is suitable for characterizing frequent patterns in a single dataframe or comparing differences between two dataframes, which proves useful for tasks such as contrasting customer groups or analyzing values' temporal shifts through cohort comparisons.

Possible applications for PopDelta:

Discerning frequent co-occurring patterns within a single dataset. Detecting patterns that differentiate purchasing customers from non-purchasing ones.

Note: PopDelta was formerly called KDA (Key Driver Analysis).

Installation

To install PopDelta, execute the following pip command:

pip install popdelta

Usage

PopDelta incorporates built-in utilities for data cleaning, including handling missing data, rectifying data inconsistencies, and implementing One-Hot Encoding.

PopDelta initialization parameters are: 1) target: the attribute utilized to "weight" the discovered data patterns, in the absence of a target, patterns will be “weighted” only based on their frequencies (row counts “a la” vanilla frequent itemset). 2) num_bins: bins for discretizing numerical attributes, and 3) string_attributes: a list of attributes that should be forced to string type (useful for ordinal attributes encoded in numerical format).

After initializing PopDelta, the object can be used to iterate through the generator returned from the process_batch function. This function requires two parameters: 1) batches: a list containing one, or two depending on the use case, dataframes for comparison purposes, and 2) progressive: a Boolean flag indicating whether the data should be processed progressively in chunks (recommended for datasets exceeding 10000 rows).

The user can compare datasets with not perfectly overlapping columns, as long as that intersection is not empty.

Example

The expected usage and input are as follows (you can find more examples in the examples.ipynb notebook:

Import pandas as pd
from popdelta.pop_delta import PopDelta

pd.set_option('mode.use_inf_as_na', True)
df = pd.read_csv("messy_dataset.csv")


over_40 = df[df[“age] > 40]
under_40 = df[df[“age] <= 40]

popDeltaW2 = PopDelta(target=”age”, num_bins=3, string_attributes=[])

for result in popDeltaW2.process_batch([over_40, under_40]):
display(result)

In this example, PopDelta is utilized to analyze two datasets: over_40 and under_40. The target variable for weighting is age, with 3 bins for discretizing numerical attributes and no predefined string attributes (applicable for ordinal attributes encoded as numerics).

Metadata

Release files for popdelta 0.0.2

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

Source distribution (sdist)

Source distribution for popdelta 0.0.2
File Size Uploaded Provenance Actions
popdelta-0.0.2.tar.gz 2.4 MB Without provenance Details for popdelta-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for popdelta 0.0.2
File Interpreter ABI Platform Actions
popdelta-0.0.2-py3-none-any.whl Python 3 none any Details for popdelta-0.0.2-py3-none-any.whl

Total release size: 2.5 MB

Release files / popdelta-0.0.2.tar.gz

Download URL popdelta-0.0.2.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c4ad84975890c1ac90ac666ddda3e2c4c1c4b9a726e08b5b51a2285b8997cd7a
BLAKE2b-256 checksum
How to use checksums
79c929248e833a129600062f68e8253a5211abe6b0b620466182d300fefd3fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / popdelta-0.0.2-py3-none-any.whl

Download URL popdelta-0.0.2-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ab5a6fbc972cea11cf5798d31c946b8fb72233edda436c956b0a8f6031b4171
BLAKE2b-256 checksum
How to use checksums
256bc720053ef1eacebc84d4edeff5e170a3709b3ee4f64e627c9ccbba949f4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for popdelta 0.0.2

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.2 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