code: def preprocess(tbl):
      tbl = (
          tbl.cast(bool_cols + count_cols + timestamp_cols, "int")
          .fillna(0, timestamp_cols)
          .fillna(
              "",
              [
                  "present_media",
                  "present_domains",
                  "present_links",
                  "hashtags",
              ],
          )
      )
  
      process_media = lambda x: "_".join(x.split("\t")[:2])
      tbl = (
          tbl.apply(
              "present_media", "present_media", process_media, "string"
          )
          .encode_string("present_media", media_map)
          .encode_string("tweet_type", type_map)
      )
  
      count_func = lambda x: str(x).count("\t") + 1 if x else 0
      tbl = (
          tbl.apply("hashtags", "len_hashtags", count_func, "int")
          .apply("present_domains", "len_domains", count_func, "int")
          .apply("present_links", "len_links", count_func, "int")
      )
  
      return tbl
  
file_path: BigDL/python/friesian/example/wnd/recsys2021/wnd_preprocess_recsys.py
imports: import os
  from argparse import ArgumentParser
  import tempfile
  import pickle
  from time import time
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.data.file import makedirs, exists
  from bigdl.dllib.utils.file_utils import put_local_file_to_remote
  from bigdl.friesian.feature import FeatureTable
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 2 for calling a global function with example usage: preprocess(tbl) and returns: tbl