Skip to main content

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

pyabtesting

An awesome README template to jumpstart your projects!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage

About The Project

This library provides tools for AB Testing, very useful when working with marketing data

(back to top)

Getting Started

Prerequisites

To develop on this project, you will need to create a poetry environment with the needed dependencies

  • install with Poetry
    poetry install
    

Installation

  1. git clone https://github.com/pablominue/pyabtesting.git
    

    or

    pip install abtestools
    
  2. Import main modules

    from abtestools import audience, test
    

(back to top)

Usage

import datetime

import pandas as pd

from abtestools.audiences import Audience
from abtestools.campaign import Campaign
from abtestools.test import Metric

data = pd.read_csv("tests/cookie_cats.txt", delimiter=",")

audience = Audience(
    users=data["userid"], group_mapping=dict(zip(data["userid"], data["version"]))
)

campaign = Campaign(
    audience=audience,
    metrics=[
        Metric(name="retention_1", type="discrete"),
        Metric(name="retention_7", type="discrete"),
    ],
    date_range=[
        datetime.datetime.today() - datetime.timedelta(days=x) for x in range(10)
    ],
)


def extract_data(date, metric_column: str, convert_bool: bool = True) -> dict:
    # Logic for each date calculation should be added here
    if convert_bool:
        data[metric_column] = data[metric_column].astype(int)
    return dict(zip(data["userid"], data[metric_column]))


for res in campaign.backfill(
    metric=Metric(name="retention_1", type="discrete"),
    extract_data=extract_data,
    metric_column="retention_1",
):
    print(res)

Metadata

Release files for abtestools 1.1.4

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

Source distribution (sdist)

Source distribution for abtestools 1.1.4
File Size Uploaded
abtestools-1.1.4.tar.gz 24.6 kB Details

Built distribution (wheel)

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

Total release size: 48.8 kB

Release files / abtestools-1.1.4.tar.gz

Download URL abtestools-1.1.4.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8493b98e8b5f59ddddc3014677cff0e2e0fe0f3eafd9b14ef15d77ffa509fe55
BLAKE2b-256 checksum
How to use checksums
a9ca8fdcf4af8185c47b59c516671ba82ecbbe9d6225e5686fc544a64d825d75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.11.5 Darwin/24.0.0

Release files / abtestools-1.1.4-py3-none-any.whl

Download URL abtestools-1.1.4-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a703d42a29876331651bef3bf53874ffa04a7a93b3f10681b63adddcb8b244fd
BLAKE2b-256 checksum
How to use checksums
03030a869e320f334bc9c33b01d92508f3dba4940f9f89055681093c52cf0342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.11.5 Darwin/24.0.0

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

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