Skip to main content

Column.truncate

truncate

Group: Rounding
Aliases: int

Documentation

If the column is numeric, truncate the floating-point values to an integer by dropping the fractional part. This is equivalent to "round-toward-zero". If the column is of type Date_Time, truncates the values to Date.

Examples

Truncate a column of Float values.

      Column.from_vector "foo" [1.25, 2.33, 3.57] . truncate == (Column.from_vector "foo" [1, 2, 3])

Truncate a column of Date_Time values.

     date_times = Column.from_vector "foo" [Date_Time.new 2020 10 24 1 2 3, Date_Time.new 2020 10 24 1 2 3]
dates = Column.from_vector "foo" [Date.new 2020 10 24, Date.new 2020 10 24]
col.truncate == dates