jtablesaw / tablesaw

Java dataframe and visualization library
https://jtablesaw.github.io/tablesaw/
Apache License 2.0
3.56k stars 645 forks source link

IntColumns returning double types for min/max/median/sum #1172

Closed minhster99 closed 1 year ago

minhster99 commented 1 year ago

Just thought I'd raise this minor bug. When calling the min/max/median/sum functions on an intColumn, the return type is double which isn't right. It should be integers. We can work around the problem by casting it to an int.

eg double min = table.intColumn("my integers").min(); table.intColumn("my integers").setMissingTo( (int) min)

note the need to cast

lwhite1 commented 1 year ago

This is a known issue. It is done so that the results of min() etc., can be consistent across all numeric column types, which allows them to be put in the same column as results from other types. I don't see this changing.

On Tue, Dec 6, 2022 at 12:21 AM minhster99 @.***> wrote:

Just thought I'd raise this minor bug. When calling the min/max/median/sum functions on an intColumn, the return type is double which isn't right. It should be integers. We can work around the problem by casting it to an int.

eg double min = table.intColumn("my integers").min(); table.intColumn("my integers").setMissingTo( (int) min)

note the need to cast

— Reply to this email directly, view it on GitHub https://github.com/jtablesaw/tablesaw/issues/1172, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2FPASHWKAMEEAPPF6ZS33WL3EMRANCNFSM6AAAAAASVCNUUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

minhster99 commented 1 year ago

fair enough