code: def _feature_importances_to_df(feature_importances):
      # type: (FeatureImportances) -> pd.DataFrame
      weights = feature_importances.importances
      df = pd.DataFrame(
          {
              "feature": [fw.feature for fw in weights],
              "weight": [fw.weight for fw in weights],
          },
          columns=["feature", "weight"],
      )
      if any(fw.std is not None for fw in weights):
          df["std"] = [fw.std for fw in weights]
      if any(fw.value is not None for fw in weights):
          df["value"] = [fw.value for fw in weights]
      return df
  
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 8 for calling a global function with example usage: _feature_importances_to_df(feature_importances) and returns: df