code: def pd_data_types(df, return_df=False):
      """
      ```
      infers data type of each column in Pandas DataFrame
      Args:
        df(pd.DataFrame): pandas DataFrame
        return_df(bool): If True, returns columns and types in DataFrame.
                         Otherwise, a dictionary is returned.
      ```
      """
  
      infer_type = lambda x: pd.api.types.infer_dtype(x, skipna=True)
      df.apply(infer_type, axis=0)
  
      # DataFrame with column names & new types
      df_types = (
          pd.DataFrame(df.apply(pd.api.types.infer_dtype, axis=0))
          .reset_index()
          .rename(columns={"index": "column", 0: "type"})
      )
      if return_df:
          return df_types
      cols = list(df_types["column"].values)
      col_types = list(df_types["type"].values)
      return dict(list(zip(cols, col_types)))
  
imports: from ..None import utils
  from ..imports import *
  from ..preprocessor import Preprocessor
  from numbers import Number
  from types import SimpleNamespace
  from typing import Any, AnyStr, Callable, Collection, Dict, Hashable, Iterator, List, Mapping, NewType, Optional, Sequence, Tuple, TypeVar, Union
  from pandas.api.types import is_categorical_dtype, is_numeric_dtype
label_desc: Use image node_id 1 for calling a global function with example usage: pd_data_types(df, return_df) and returns: dict, df_types