def _maybe_dt_data(data, feature_names, feature_types):
    """
    Validate feature names and types if data table
    """
    if not isinstance(data, DataTable):
        return data, feature_names, feature_types

    data_types_names = tuple(lt.name for lt in data.ltypes)
    bad_fields = [data.names[i]
                  for i, type_name in enumerate(data_types_names)
                  if type_name not in DT_TYPE_MAPPER]
    if bad_fields:
        msg = """DataFrame.types for data must be int, float or bool.
                Did not expect the data types in fields """
        raise ValueError(msg + ', '.join(bad_fields))

    if feature_names is None:
        feature_names = data.names

        # always return stypes for dt ingestion
        if feature_types is not None:
            raise ValueError('DataTable has own feature types, cannot pass them in')
        feature_types = np.vectorize(DT_TYPE_MAPPER2.get)(data_types_names)

    return data, feature_names, feature_types
def _maybe_dt_data ( data , feature_names , feature_types ) : if not isinstance ( data , DataTable ) : return data , feature_names , feature_types data_types_names = tuple ( lt . name for lt in data . ltypes ) bad_fields = [ data . names [ i ] for i , type_name in enumerate ( data_types_names ) if type_name not in DT_TYPE_MAPPER ] if bad_fields : msg = """DataFrame.types for data must be int, float or bool.
                Did not expect the data types in fields """ raise ValueError ( msg + ', ' . join ( bad_fields ) ) if feature_names is None : feature_names = data . names if feature_types is not None : raise ValueError ( 'DataTable has own feature types, cannot pass them in' ) feature_types = np . vectorize ( DT_TYPE_MAPPER2 . get ) ( data_types_names ) return data , feature_names , feature_types
Validate feature names and types if data table