Convert a string to int in the dataset

rawDataset = data['named_query'].getCoreResults()
data[a] = str(rawDataset.getValueAt(0,'TotalLoss')) // 107 3--value
data[b] = str(rawDataset.getValueAt(1,'TotalLoss')) // 109 2--value

I need to add the a & b but cannot able to add
because a is the string cannot able to convert a into int

Try removing the str function (that coerces things into strings).

yeah i tried But ,

d = (data[a])+(data[b])
data[d] = d

the result is coming as =10731092 only but the expected output is 2163

Then I'm guessing those are already strings, and using + concatenates them.
Convert to integers before adding, with int()

1 Like

i think so it's works