code: def load_dataframe(
      df: pd.DataFrame, block_type: str = None
  ) -> Layout:
      """Load the Layout object from the given dataframe.
  
      Args:
          df (pd.DataFrame):
  
          block_type (str):
              If there's no block_type column in the CSV file,
              you must pass in a block_type variable such that layout parser
              can appropriately detect the type of the layout elements.
  
      Returns:
          Layout:
              The parsed Layout object from the CSV file.
      """
      df = df.copy()
      if "points" in df.columns:
          if df["points"].dtype == object:
              df["points"] = df["points"].map(
                  lambda x: ast.literal_eval(x) if not pd.isna(x) else x
              )
  
      if block_type is None:
          if "block_type" not in df.columns:
              raise ValueError(
                  "`block_type` not specified both in dataframe and arguments"
              )
      else:
          df["block_type"] = block_type
  
      if any(col in TextBlock._features for col in df.columns):
          # Automatically setting index for textblock
          if "id" not in df.columns:
              df["id"] = df.index
  
      return load_dict(
          df.apply(lambda x: x.dropna().to_dict(), axis=1).to_list()
      )
  
file_path: layout-parser/src/layoutparser/io/basic.py
imports: import ast
  import json
  from typing import List, Union, Dict, Dict, Any
  import pandas
  from ..elements import BaseLayoutElement, TextBlock, Layout, BASECOORD_ELEMENT_NAMEMAP
label_desc: Use image node_id 4 for calling a global function with example usage: load_dataframe(df, block_type) and returns: load_dict