code: def _gen_map_chunks(
      cls,
      op,
      in_df,
      out_df,
      func_infos: List[ReductionSteps],
      input_index_to_output: Dict[int, int],
  ):
      axis = op.axis
  
      if axis == 0:
          agg_chunks_shape = (
              (in_df.chunk_shape[0], len(func_infos))
              if len(in_df.chunk_shape) == 2
              else (in_df.chunk_shape[0], 1)
          )
      else:
          agg_chunks_shape = (len(func_infos), in_df.chunk_shape[1])
  
      agg_chunks = np.empty(agg_chunks_shape, dtype=object)
      dtypes_cache = dict()
      for chunk in in_df.chunks:
          input_index = (
              chunk.index[1 - axis] if len(chunk.index) > 1 else 0
          )
          if input_index not in input_index_to_output:
              continue
          map_op = op.copy().reset_key()  # type: "DataFrameAggregate"
          new_axis_index = input_index_to_output[input_index]
          func_info = func_infos[new_axis_index]
          # force as_index=True for map phase
          map_op.output_types = (
              [OutputType.dataframe]
              if chunk.ndim == 2
              else [OutputType.series]
          )
          map_op.stage = OperandStage.map
          map_op.pre_funcs = func_info.pre_funcs
          map_op.agg_funcs = func_info.agg_funcs
  
          if axis == 0:
              new_index = (
                  (chunk.index[0], new_axis_index)
                  if len(chunk.index) == 2
                  else (chunk.index[0], 0)
              )
          else:
              new_index = (new_axis_index, chunk.index[1])
  
          if map_op.output_types[0] == OutputType.dataframe:
              if axis == 0:
                  shape = (1, out_df.shape[-1])
                  if out_df.ndim == 2:
                      columns_value = out_df.columns_value
                      index_value = out_df.index_value
                  else:
                      columns_value = out_df.index_value
                      index_value = parse_index(
                          pd.Index([0]), out_df.key
                      )
  
                  try:
                      dtypes = dtypes_cache[chunk.index[1]]
                  except KeyError:
                      dtypes = chunk.dtypes.reindex(
                          columns_value.to_pandas()
                      ).dropna()
                      dtypes_cache[chunk.index[1]] = dtypes
  
                  agg_chunk = map_op.new_chunk(
                      [chunk],
                      shape=shape,
                      index=new_index,
                      dtypes=dtypes,
                      columns_value=columns_value,
                      index_value=index_value,
                  )
              else:
                  shape = (out_df.shape[0], 1)
                  columns_value = parse_index(
                      pd.Index([0]), out_df.key, store_data=True
                  )
                  index_value = out_df.index_value
  
                  agg_chunk = map_op.new_chunk(
                      [chunk],
                      shape=shape,
                      index=new_index,
                      columns_value=columns_value,
                      index_value=index_value,
                  )
          else:
              agg_chunk = map_op.new_chunk(
                  [chunk], shape=(1,), index=new_index
              )
          agg_chunks[agg_chunk.index] = agg_chunk
      return agg_chunks
  
imports: import copy
  import functools
  import itertools
  from collections import OrderedDict
  from collections.abc import Iterable
  from typing import List, Dict
  import numpy
  import pandas
  from ...None import opcodes, tensor
  from ...config import options
  from ...core import OutputType, ENTITY_TYPE, enter_mode, recursive_tile
  from ...core.custom_log import redirect_custom_log
  from ...core.operand import OperandStage
  from ...serialization.serializables import BoolField, AnyField, Int32Field, ListField, DictField
  from ...utils import ceildiv, lazy_import, enter_current_session, pd_release_version
  from ..core import INDEX_CHUNK_TYPE
  from ..merge import DataFrameConcat
  from ..operands import DataFrameOperand, DataFrameOperandMixin
  from ..utils import build_df, build_empty_df, build_series, parse_index, validate_axis
  from .core import CustomReduction, ReductionCompiler, ReductionSteps, ReductionAggStep
label_desc: Use image node_id 5 for calling the DataFrameAggregate obj's underlying member method code with example usage: obj._gen_map_chunks(cls, op, in_df, out_df, func_infos, input_index_to_output) and returns: agg_chunks