System.dataset.addColumn adds decimals to float values in added column

When I add a column to a dataset using the System.dataset.addColumn the values of the added column comes out with a lot of decimals even if I round them up before adding them to the python list.
This is the output excel, the last column is the one I added.
Any way to fix this?

dont use type float

double is not accepted int the function argument for some reason

seems like you should find the reason then xd
got some code i can look at?

Here’s the code



col_caravaggio = []
time_frame=288 //1 day=12*24
for startDate_mil in range(date_from_mil,date_to_mil,time_frame_mil):	
	data_1 = system.tag.queryTagHistory(paths_1,startDate, endDate,1,"Average")
	caravaggio = round(data_1.getValueAt(0,1),2)

dataset_final=system.dataset.addColumn(dataset_query, col_caravaggio,"Caravaggio",float)

excel = system.dataset.toExcel(True, [dataset_final])

alright seems python doesnt have a double, but java has.

import java.lang.Double
and use it instead of float
dataset_final=system.dataset.addColumn(dataset_query, col_caravaggio,"Caravaggio",java.lang.Double)

1 Like

That’s because jython’s floats are double (always). The issue is that datasets are java, not jython, and need java column types.

1 Like