code: def add_aggregate_primitive_features(
      dft, agg_types, id_column, ignore_variables=[]
  ):
      """
      ###   Modify Dataframe by adding computational primitive Features using Feature Tools ####
      ###   What are aggregate primitives? they are to "mean""median","mode","min","max", etc. features
      ### Inputs:
      ###   df: Just sent in the data frame df that you want features added to
      ###   agg_types: list of computational types: 'mean','median','count', 'max', 'min', 'sum', etc.
      ###         One caveat: these agg_types must be found in the agg_func of numpy or pandas groupby statement.
      ###         for example: numpy has 'median','prod','sum','std','var', etc. - they will work!
      ###   idcolumn: this is to create an index for the dataframe since FT runs on index variable. You can leave it empty string.
      ###   ignore_variables: list of variables to ignore among numeric variables in data since they may be ID variables.
      """
      import copy
  
      ### Make sure the list of functions they send in are acceptable functions. If not, the aggregate will blow up!
      func_set = {
          "count",
          "sum",
          "mean",
          "mad",
          "median",
          "min",
          "max",
          "mode",
          "abs",
          "prod",
          "std",
          "var",
          "sem",
          "skew",
          "kurt",
          "quantile",
          "cumsum",
          "cumprod",
          "cummax",
          "cummin",
      }
      agg_types = list(set(agg_types).intersection(func_set))
      ### If the ignore_variables list is empty, make sure you add the id_column to it so it can be dropped from aggregation.
      if len(ignore_variables) == 0:
          ignore_variables = [id_column]
      ### Select only integer and float variables to do this aggregation on. Be very careful if there are too many vars.
      ### This will take time to run in that case.
      dft_index = copy.deepcopy(dft[id_column])
      dft_cont = copy.deepcopy(
          dft.select_dtypes("number").drop(ignore_variables, axis=1)
      )
      dft_cont[id_column] = dft_index
      try:
          dft_full = dft_cont.groupby(id_column).agg(agg_types)
      except:
          ### if for some reason, the groupby blows up, then just return the dataframe as is - no changes!
          return dft
      cols = [
          x + "_" + y + "_by_" + id_column
          for (x, y) in dft_full.columns
      ]
      dft_full.columns = cols
      ###  Not every column has useful values. If it is full of just the same value, remove it
      _, list_unique_col_ids = np.unique(
          dft_full, axis=1, return_index=True
      )
      dft_full = dft_full.iloc[:, list_unique_col_ids]
      return dft_full
  
file_path: Auto_ViML/autoviml/feature_engineering.py
imports: import pandas
  import numpy
  import copy
  import time
  import pdb
label_desc: Use image node_id 5 for calling a global function with example usage: add_aggregate_primitive_features(dft, agg_types, id_column, ignore_variables) and returns: dft_full, dft