code: def detect_type_series(
      series,
      *,
      dirty_float_threshold=0.9,
      max_cat_cardinality="auto",
      near_constant_threshold=0.95,
      target_col=None,
  ):
      try:
          n_distinct_values = series.nunique()
      except TypeError:
          types = series.dropna().map(lambda x: type(x).__name__)
          if types.nunique() == 1:
              return types.iloc[0]
          else:
              return "mixed-unhashable"
      if series.isna().mean() > 0.99:
          return "missing"
      # infer near-constant-values
      # fast-pass if n_distinct_values is high
      count = series.count()
  
      if n_distinct_values == 1:
          return "constant"
  
      if (
          n_distinct_values < (1 - near_constant_threshold) * count
          and series.name != target_col
      ):
          if (
              series.value_counts().max()
              > near_constant_threshold * count
          ):
              return "near_constant"
      if n_distinct_values == 2:
          return "categorical"
  
      inferred_type = pd.api.types.infer_dtype(series)
      if inferred_type in _DATE_TYPES:
          return "date"
      elif inferred_type in _CATEGORICAL_TYPES:
          return "categorical"
      elif inferred_type in _FLOAT_TYPES:
          return _type_detection_float(
              series, max_cat_cardinality=max_cat_cardinality
          )
      elif inferred_type in _INTEGER_TYPES:
          return _type_detection_int(
              series, max_cat_cardinality=max_cat_cardinality
          )
      elif inferred_type in _OBJECT_TYPES:
          return _type_detection_object(
              series,
              max_cat_cardinality=max_cat_cardinality,
              dirty_float_threshold=dirty_float_threshold,
          )
      else:
          raise ValueError("WEEEEEIIIRRD")
  
imports: from importlib.metadata import version
  from joblib import hash
  import warnings
  from warnings import warn
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.compose import make_column_transformer, ColumnTransformer
  from sklearn.impute import SimpleImputer
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import OneHotEncoder, StandardScaler
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 11 for calling a global function with example usage: detect_type_series(series) and returns: str, str, str, str, str, str, types, str, _type_detection_float, _type_detection_int, _type_detection_object