
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
abtestools
Advanced tools
An awesome README template to jumpstart your projects!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
This library provides tools for AB Testing, very useful when working with marketing data
To develop on this project, you will need to create a poetry environment with the needed dependencies
poetry install
git clone https://github.com/pablominue/pyabtesting.git
or
pip install abtestools
Import main modules
from abtestools import audience, test
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)
FAQs
AB Test Framework for Python
We found that abtestools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.