Getrow() - unwanted rounding

hi all,

ultra new to processing, apologies in advance if this has been asked/is basic.

im trying to read data out of a table that i have imported from a csv file.

i load the table, select a specific row i am interested in then reference the column within that row. Thats all fine, and i am able to extract the number, however the number as been rounded from 10.25 to 10.

does anyone know why this rounding occurs?

Many thanks

Table table;
table = loadTable(“sample.csv”, “header”);
TableRow row = table.getRow(3);
float a =row.getInt(“price”);

println(nf(a, 2, 2));

println(a); //prints 10

Try using float a = row.getFloat("price");

Also read

You are using getInt. You need getFloat() as mention by @KAZ. Keep the reference handy. If not clear, ask here in the forum.


perfect- thanks a lot.