Last updated: 2023-03-16.
tf_quant_finance.datetime.convert_to_date_tensor#
Converts supplied data to a DateTensor if possible.
tf_quant_finance.datetime.convert_to_date_tensor(
date_inputs
)
Args:#
date_inputs: One of the supported types that can be converted to a DateTensor. The following input formats are supported. 1. Sequence ofdatetime.datetime,datetime.date, or any other structure with data attributes called ‘year’, ‘month’ and ‘day’. 2. A numpy array ofdatetime64type. 3. Sequence of (year, month, day) Tuples. Months are 1-based (with January as 1) and constants.Months enum may be used instead of ints. Days are also 1-based. 4. A tuple of three int32Tensors containing year, month and date as positive integers in that order. 5. A single int32Tensorcontaining ordinals (i.e. number of days since 31 Dec 0 with 1 being 1 Jan 1.)
Returns:#
A DateTensor object representing the supplied dates.
Raises:#
ValueError: If conversion fails for any reason.