code: def get_dataset_info(
      df: Union[pd.DataFrame, dd.core.DataFrame]
  ) -> DatasetInfo:
      """Constructs FieldInfo objects for each feature in dataset. These objects are used for downstream type
      inference.
  
      # Inputs
      :param df: (Union[pd.DataFrame, dd.core.DataFrame]) Pandas or Dask dataframe.
  
      # Return
      :return: (DatasetInfo) Structure containing list of FieldInfo objects.
      """
      source = wrap_data_source(df)
      return get_dataset_info_from_source(source)
  
imports: import logging
  import os
  from dataclasses import dataclass
  from typing import Any, Dict, List, Set, Union
  import dask.dataframe
  import numpy
  import pandas
  import yaml
  from dataclasses_json import dataclass_json, LetterCase
  from tqdm import tqdm
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.backend import Backend
  from ludwig.constants import COLUMN, COMBINER, ENCODER, EXECUTOR, HYPEROPT, INPUT_FEATURES, PREPROCESSING, SCHEDULER, SEARCH_ALG, SPLIT, TEXT, TYPE
  from ludwig.types import ModelConfigDict
  from ludwig.utils.automl.data_source import DataSource, wrap_data_source
  from ludwig.utils.automl.field_info import FieldConfig, FieldInfo, FieldMetadata
  from ludwig.utils.automl.type_inference import infer_type, should_exclude
  from ludwig.utils.data_utils import load_yaml
  from ludwig.utils.misc_utils import merge_dict
  from ludwig.utils.system_utils import Resources
label_desc: Use image node_id 7 for calling a global function with example usage: get_dataset_info(df) and returns: get_dataset_info_from_source