code: def check_targets_dataframe(df, expl):
      assert list(df.columns) == ["target", "feature", "weight"]
      df_indexed = df.groupby(["target", "feature"]).agg(lambda x: x)
      for target in expl.targets:
          feature_weights = target.feature_weights
          for fw in chain(feature_weights.pos, feature_weights.neg):
              weight = df_indexed.loc[target.target, fw.feature][
                  "weight"
              ]
              assert weight == fw.weight
  
file_path: eli5/tests/test_formatters_as_dataframe.py
imports: from __future__ import print_function
  from itertools import chain
  import pytest
  import numpy
  from sklearn.linear_model import LinearRegression
  from sklearn.ensemble import ExtraTreesRegressor
  from eli5 import format_as_dataframes, format_as_dataframe, explain_weights_df, explain_weights_dfs, explain_prediction_df, explain_prediction_dfs, format_as_text, explain_weights, explain_prediction
  from eli5.base import Explanation, TargetExplanation, FeatureWeight, FeatureWeights, FeatureImportances, TransitionFeatureWeights
label_desc: Use image node_id 2 for calling a global function with example usage: check_targets_dataframe(df, expl) without return types