I have a dataframe in the form where rows indicate ids and columns indicate the no of classes.

Say I have 10 classes then column names would be ‘class1’, ‘class2’, . . ., ‘class10’.

For each row I am predicting the probabilities of belonging to the various classes.

Say for 9 classes these are the calculated probabilities stored in a tensor.

tensor([1.3953e-05, 3.3629e-01, 2.9408e-01, 3.5847e-01, 1.8039e-05, 9.7759e-06,

1.1096e-02, 7.1202e-06, 1.9519e-05])

What would be the best way to add this tensor to the particular row for which I am calculating these probabilities. Given I want to add it to a dataframe.

Also, how can I limit the trailing no of digits after the decimal in the tensor?