quantlab.model.collected_panel.as_feature_dtype#

quantlab.model.collected_panel.as_feature_dtype(data)[source]#

Return data with every variable cast to FEATURE_DTYPE.

A variable already of that type is kept as it is, not copied. Every variable is cast, integer ones included: the fit reads its features as FEATURE_DTYPE whatever their type.

Parameters:
dataxr.Dataset

A feature panel.

Returns:
xr.Dataset

data with every variable of FEATURE_DTYPE; data itself when every variable already is.

Examples

>>> wide = panel.assign(f_a=panel["f_a"].astype(np.float64))
>>> as_feature_dtype(wide)["f_a"].dtype
dtype('float32')