Вы можете проверить с помощью np.random.multinomial
np.random.multinomial(5, [1/3.]*3, size=5) # here when you input size 5 , it only creat 5 lines
Out[38]:
array([[2, 2, 1],
[1, 2, 2],
[0, 3, 2],
[1, 1, 3],
[3, 1, 1]])
Завершить фрейм данных
ary=np.random.multinomial(5, [1/3.]*3, size=5)
df=pd.DataFrame(ary,columns=['A','B','C'])
df['SUM']=df.sum(1)
df
Out[43]:
A B C SUM
0 1 2 2 5
1 2 2 1 5
2 1 3 1 5
3 1 1 3 5
4 1 2 2 5