class_docstr: Validate a dataframe using a Pydantic schema.
  
  Attributes:
      df: dataframe to be validated
class_docstr_tok: ["Validate","a","dataframe","using","a","Pydantic","schema",".","Attributes",":","df",":","dataframe","to","be","validated"]
docstr: Create list of dict of dataframe rows on basis of dataframe type
  Supports only polars and pandas dataframe
  
  Args:
      df: dataframe to be converted
      dataframe_type: type of dataframe
  
  Returns:
      list of dict of dataframe rows
docstr_tok: ["Create","list","of","dict","of","dataframe","rows","on","basis","of","dataframe","type","Supports","only","polars","and","pandas","dataframe","Args",":","df",":","dataframe","to","be","converted","dataframe_type",":","type","of","dataframe","Returns",":","list","of","dict","of","dataframe","rows"]
code: def _df_to_list_of_dict(
      self, df: DataFrameType, dataframe_type: str
  ) -> List[Dict]:
      """
      Create list of dict of dataframe rows on basis of dataframe type
      Supports only polars and pandas dataframe
  
      Args:
          df: dataframe to be converted
          dataframe_type: type of dataframe
  
      Returns:
          list of dict of dataframe rows
      """
      if dataframe_type == "pandas":
          return df.to_dict(orient="records")
      elif dataframe_type == "polars":
          return df.to_dicts()
      else:
          return []
  
file_path: pandas-ai/pandasai/helpers/df_validator.py
imports: from typing import List, Dict
  from pydantic import ValidationError
  from pydantic import BaseModel
  from pandasai.helpers.df_info import DataFrameType, df_type
label_desc: Use image node_id 3 for calling the DfValidator obj's underlying member method code with example usage: obj._df_to_list_of_dict(df, dataframe_type) and returns: df, df, list