castChunk
Casts one chunk to the target dtype.
Source and target pairs and their behaviour (every row is unit-tested):
$(DT same dtype)$(DD returned unchanged, sharing the buffers) $(DT numeric to numeric)$(DD strict: out-of-range throws; strict = false: null) $(DT int to float)$(DD value conversion) $(DT float to int)$(DD truncation; NaN and infinity are out of range) $(DT BOOLEAN to integer)$(DD 0 / 1) $(DT integer to BOOLEAN)$(DD value != 0) $(DT numeric or temporal to STRING)$(DD to!string; temporals through the ddn.datetime formatters) $(DT STRING to numeric)$(DD to!T semantics; unparsable throws or nulls) $(DT STRING to DATETIME / TIME)$(DD the strict ISO-8601 grammar; unparsable throws or nulls) $(DT INT64 to/from DATETIME and TIME)$(DD physical reinterpretation, zero copy) $(DT anything else)$(DD DataFrameException: unsupported pair, regardless of strict)
Parameters
chunk | the chunk to convert |
target | the target dtype |
strict | throw on convertible failures (true) or map them to null |
Returns
Throws
table when strict.