class_docstr: Checks the input data to Auto-Sklearn.
  
  It also determines what columns are categorical and which ones are numerical,
  so that the pre-processing pipeline can process this columns accordingly.
  
  Attributes
  ----------
  feat_type: Optional[List[str]] = None
      In case the dataset is not a pandas DataFrame:
          +   If provided, this list indicates which columns should be treated as
              categorical it is internally transformed into a dictionary that
              indicates a mapping from column index to categorical/numerical.
          +   If not provided, by default all columns are treated as numerical
  
      If the input dataset is of type pandas dataframe, this argument
      must be none, as the column type will be inferred from the pandas dtypes.
  
  data_type:
      Class name of the data type provided during fit.
class_docstr_tok: ["Checks","the","input","data","to","Auto-Sklearn",".","It","also","determines","what","columns","are","categorical","and","which","ones","are","numerical",",","so","that","the","pre-processing","pipeline","can","process","this","columns","accordingly",".","Attributes","--","--","--","--","--","feat_type",":","Optional","[","List","[","str","]","]","=","None","In","case","the","dataset","is","not","a","pandas","DataFrame",":","+","If","provided",",","this","list","indicates","which","columns","should","be","treated","as","categorical","it","is","internally","transformed","into","a","dictionary","that","indicates","a","mapping","from","column","index","to","categorical\/numerical",".","+","If","not","provided",",","by","default","all","columns","are","treated","as","numerical","If","the","input","dataset","is","of","type","pandas","dataframe",",","this","argument","must","be","none",",","as","the","column","type","will","be","inferred","from","the","pandas","dtypes",".","data_type",":","Class","name","of","the","data","type","provided","during","fit","."]
docstr: Returns a dictionary that maps pandas dataframe columns to a feature type.
  This feature type can be categorical, numerical or string
  
  Parameters
  ----------
  X: pd.DataFrame
      A set of features that are going to be validated (type and dimensionality
      checks) and a encoder fitted in the case the data needs encoding
  
  Returns
  -------
  feat_type:
      dictionary with column to feature type mapping
docstr_tok: ["Returns","a","dictionary","that","maps","pandas","dataframe","columns","to","a","feature","type",".","This","feature","type","can","be","categorical",",","numerical","or","string","Parameters","--","--","--","--","--","X",":","pd.DataFrame","A","set","of","features","that","are","going","to","be","validated","(","type","and","dimensionality","checks",")","and","a","encoder","fitted","in","the","case","the","data","needs","encoding","Returns","--","--","--","-","feat_type",":","dictionary","with","column","to","feature","type","mapping"]
code: def get_feat_type_from_columns(
      self,
      X: pd.DataFrame,
  ) -> Dict[Union[str, int], str]:
      """
      Returns a dictionary that maps pandas dataframe columns to a feature type.
      This feature type can be categorical, numerical or string
  
      Parameters
      ----------
      X: pd.DataFrame
          A set of features that are going to be validated (type and dimensionality
          checks) and a encoder fitted in the case the data needs encoding
  
      Returns
      -------
      feat_type:
          dictionary with column to feature type mapping
      """
      # Also, register the feature types for the estimator
      feat_type = {}
  
      # Make sure each column is a valid type
      for i, column in enumerate(X.columns):
          if is_sparse(X[column]):
              raise ValueError(
                  "Auto-sklearn does not yet support sparse pandas Series."
                  f" Please convert {column} to a dense format."
              )
          elif X[column].dtype.name in ["category", "bool"]:
              feat_type[column] = "categorical"
          elif X[column].dtype.name == "string":
              if self.allow_string_features:
                  feat_type[column] = "string"
              else:
                  feat_type[column] = "categorical"
                  warnings.warn(
                      f"you disabled text encoding column {column} will be "
                      f"encoded as category"
                  )
          # Move away from np.issubdtype as it causes
          # TypeError: data type not understood in certain pandas types
          elif not is_numeric_dtype(X[column]):
              if X[column].dtype.name == "object":
                  warnings.warn(
                      f"Input Column {column} has generic type object. "
                      f"Autosklearn will treat this column as string. "
                      f"Please ensure that this setting is suitable for your task.",
                      UserWarning,
                  )
                  if self.allow_string_features:
                      feat_type[column] = "string"
                  else:
                      feat_type[column] = "categorical"
                      warnings.warn(
                          f"you disabled text encoding column {column} will be"
                          f"encoded as category"
                      )
              elif pd.core.dtypes.common.is_datetime_or_timedelta_dtype(
                  X[column].dtype
              ):
                  raise ValueError(
                      "Auto-sklearn does not support time and/or date datatype as "
                      f"given in column {column}. Please convert the time "
                      " information to a numerical value first. One example on how to"
                      " do this can be found on "
                      " https://stats.stackexchange.com/questions/311494/"
                  )
              else:
                  raise ValueError(
                      "Input Column {} has unsupported dtype {}. "
                      "Supported column types are categorical/bool/numerical dtypes. "
                      "Make sure your data is formatted in a correct way, "
                      "before feeding it to Auto-Sklearn.".format(
                          column,
                          X[column].dtype.name,
                      )
                  )
          else:
              feat_type[column] = "numerical"
      return feat_type
  
file_path: auto-sklearn/autosklearn/data/feature_validator.py
imports: from typing import Dict, List, Optional, Tuple, Union, cast
  import logging
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_sparse
  from scipy.sparse import csr_matrix, spmatrix
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import NotFittedError
  from autosklearn.util.logging_ import PickableLoggerAdapter
label_desc: Use image node_id 5 for calling the FeatureValidator obj's underlying member method code with example usage: obj.get_feat_type_from_columns(X) and returns: feat_type