I randomly generated numbers and below you can see a small example of my data.
import pandas as pd
import numpy as np
data = {
'total_sales':[0,120,180,90,30,90],
}
df1 = pd.DataFrame(data, columns = [
'total_sales',])
Now I want to divide this amount into three other columns. So actually total_sales now represents the sum of three columns (group_1,group_2, and group_3).
So far so good. But now I want to divide total_sales into these three groups on the bases of probability let's say each third element will be randomly distributed between those groups (group_1, group_2, and group_3 ). Examples are shown in a row that started with the value of 180 and the last row from the table which started with 90.
So can anybody help me with how to solve this problem?


