for i, j, k in zip(results["pred_category_id"][:1], results["predicted_category_ids"][:1], results["text_predicted_probs"][:1]): print(j.index(str(i))) # get the index of pred_category_id in predicted_category_ids print(ast.literal_eval(k)[j.index(str(i))]) # get the value at this index in text_predicted_probs # output: 0 0.943