code: def _get_categories(block_table, block_indexes):
      block_index_set = set(block_indexes)
  
      def _mapper(blocks):
          categories_ = []
          for bid, block in enumerate(blocks):
              if bid not in block_index_set:
                  continue
  
              enc = OneHotEncoder()
              cate_block = enc.fit(block).categories_
              categories_.append([set(cate) for cate in cate_block])
  
          return categories_
  
      def _reducer(categories1_, categories2_):
          categories_ = []
          for cate_block1, cate_block2 in zip(
              categories1_, categories2_
          ):
              cate_block = [
                  cate1 | cate2
                  for cate1, cate2 in zip(cate_block1, cate_block2)
              ]
              categories_.append(cate_block)
  
          return categories_
  
      categories = block_table.mapValues(_mapper).reduce(_reducer)
  
      categories = [
          [sorted(cate) for cate in cate_block]
          for cate_block in categories
      ]
  
      return categories
  
file_path: FATE/python/fate/arch/dataframe/ops/_encoder.py
imports: import functools
  import pandas
  import numpy
  import torch
  from sklearn.preprocessing import OneHotEncoder
  from typing import Union
  from ._compress_block import compress_blocks
  from .._dataframe import DataFrame
  from ..manager import BlockType, DataManager
label_desc: Use image node_id 2 for calling a global function with example usage: _get_categories(block_table, block_indexes) and returns: categories, categories_, categories_