code: def format_as_dataframe(explanation):
      # type: (Explanation) -> Optional[pd.DataFrame]
      """Export an explanation to a single ``pandas.DataFrame``.
      In case several dataframes could be exported by
      :func:`eli5.formatters.as_dataframe.format_as_dataframes`,
      a warning is raised. If no dataframe can be exported, ``None`` is returned.
      This function also accepts some components of the explanation as arguments:
      feature importances, targets, transition features.
      Note that :func:`eli5.explain_weights` limits number of features
      by default. If you need all features, pass ``top=None`` to
      :func:`eli5.explain_weights`, or use
      :func:`explain_weights_df`.
      """
      for attr in _EXPORTED_ATTRIBUTES:
          value = getattr(explanation, attr)
          if value:
              other_attrs = [
                  a
                  for a in _EXPORTED_ATTRIBUTES
                  if getattr(explanation, a) and a != attr
              ]
              if other_attrs:
                  warnings.warn(
                      "Exporting {} to DataFrame, but also {} could be "
                      "exported. Consider using eli5.format_as_dataframes.".format(
                          attr, ", ".join(other_attrs)
                      )
                  )
              return format_as_dataframe(value)
      return None
  
file_path: eli5/eli5/formatters/as_dataframe.py
imports: from itertools import chain
  from typing import Any, Dict, List, Optional
  import warnings
  import pandas
  import eli5
  from eli5.base import Explanation, FeatureImportances, TargetExplanation, TransitionFeatureWeights
  from eli5.base_utils import singledispatch
label_desc: Use image node_id 7 for calling a global function with example usage: format_as_dataframe(explanation) and returns: None, format_as_dataframe