【发布时间】:2022-01-08 15:12:57
【问题描述】:
抱歉,如果这已经被问过了。我正在尝试设置一个小型 A/B 测试并将记录平均 (50%) 分成 3 个类别:Low intent、Medium intent、High intent。我想随机选择 3 个类别中的 50% 到对照组,50% 到治疗组到另一列。
样本数据:
|ID|Buyer Intent |Email
:--:|:-----------:|:-------------|
|1 |Low Intent |john@gmail.com|
|2 |Medium Intent|jane@gmail.com|
|3 |Medium Intent|tom@gmail.com |
|4 |Low Intent |sara@gmail.com|
|5 |High Intent |mich@gmail.com|
|6 |High Intent |sall@gmail.com|
所需数据:
|ID|Buyer Intent |Email |Group
:--|:-----------:|:--------------:|:----------:|
|1 |Low Intent |john@gmail.com |Control |
|2 |Medium Intent|jane@gmail.com |Treatment |
|3 |Medium Intent|tom@gmail.com |Control |
|4 |Low Intent |sara@gmail.com |Treatment. |
|5 |High Intent |mich@gmail.com |Treatment. |
|6 |High Intent |sall@gmail.com | Control. |
【问题讨论】:
-
感谢您提供的数据。请以更易于复制和粘贴到程序中的格式提供,例如
df.head().to_dict('list')。
标签: python pandas dataframe numpy