code: def _generate_partial_statistics_from_df(
      dataframe: DataFrame,
      stats_options: options.StatsOptions,
      stats_generators: List[stats_generator.CombinerStatsGenerator],
  ) -> List[Any]:
      """Generate accumulators containing partial stats."""
      feature_allowlist = set()
      if stats_options.feature_allowlist:
          feature_allowlist.update(stats_options.feature_allowlist)
      # Create a copy of the stats options so that we don't modify the input object.
      stats_options_modified = copy.copy(stats_options)
      # Remove feature_allowlist option as it is no longer needed.
      stats_options_modified.feature_allowlist = None
      schema = schema_pb2.Schema()
      drop_columns = []
      for col_name, col_type in zip(
          dataframe.columns, dataframe.dtypes
      ):
          if not table_util.NumpyKindToArrowType(col_type.kind) or (
              feature_allowlist and col_name not in feature_allowlist
          ):
              drop_columns.append(col_name)
          elif col_type.kind == "b":
              # Track bool type feature as categorical.
              schema.feature.add(
                  name=col_name,
                  type=schema_pb2.INT,
                  bool_domain=schema_pb2.BoolDomain(),
              )
      dataframe = dataframe.drop(columns=drop_columns)
      if schema.feature:
          stats_options_modified.schema = schema
      record_batch_with_list_arrays = (
          table_util.CanonicalizeRecordBatch(
              pa.RecordBatch.from_pandas(dataframe)
          )
      )
      return stats_impl.generate_partial_statistics_in_memory(
          record_batch_with_list_arrays,
          stats_options_modified,
          stats_generators,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import csv
  import gzip
  import io
  import multiprocessing
  import os
  import tempfile
  from typing import Any, List, Optional, Text, cast
  import apache_beam
  from apache_beam.io.filesystem import CompressionTypes
  from apache_beam.options.pipeline_options import PipelineOptions
  from joblib import delayed
  from joblib import Parallel
  import numpy
  from pandas import DataFrame
  import pyarrow
  import tensorflow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.api import stats_api
  from tensorflow_data_validation.coders import csv_decoder
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import table_util
  from tfx_bsl.tfxio import tf_example_record
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: _generate_partial_statistics_from_df(dataframe, stats_options, stats_generators) and returns: stats_impl