pyabtesting
An awesome README template to jumpstart your projects!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
About The Project
This library provides tools for AB Testing, very useful when working with marketing data
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
-
git clone https://github.com/pablominue/pyabtesting.git
or
pip install abtestools
-
Import main modules
from abtestools import audience, test
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)
| File | Size | Uploaded | |
|---|---|---|---|
| abtestools-1.1.4.tar.gz | 24.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|