Skip to content

Basic example of t-test on a polars dataframe #98

Answered by e10v
rosmur asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

Thank you for your interest and for a good question.

The easiest way is to create an Ibis Table from Polars DataFrame and then use it as input data. Example:

import ibis
import polars as pl
import tea_tasting as tt


data = ibis.memtable(pl.from_pandas(tt.make_users_data(seed=42)))

experiment = tt.Experiment(
    sessions_per_user=tt.Mean("sessions"),
    orders_per_session=tt.RatioOfMeans("orders", "sessions"),
    orders_per_user=tt.Mean("orders"),
    revenue_per_user=tt.Mean("revenue"),
)

result = experiment.analyze(data)
print(result)

P.S. First, I wanted to suggest using Polars as Ibis data backend:

con = ibis.polars.connect({"users_data": pl.from_pandas(tt.make_users_data(s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rosmur
Comment options

@e10v
Comment options

Answer selected by e10v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants