code: def test_targets(with_std, with_value):
      expl = Explanation(
          estimator="some estimator",
          targets=[
              TargetExplanation(
                  "y",
                  feature_weights=FeatureWeights(
                      pos=[
                          FeatureWeight(
                              "a",
                              13,
                              std=0.13 if with_std else None,
                              value=2 if with_value else None,
                          ),
                          FeatureWeight(
                              "b",
                              5,
                              std=0.5 if with_std else None,
                              value=1 if with_value else None,
                          ),
                      ],
                      neg=[
                          FeatureWeight(
                              "neg1",
                              -10,
                              std=0.2 if with_std else None,
                              value=5 if with_value else None,
                          ),
                          FeatureWeight(
                              "neg2",
                              -1,
                              std=0.3 if with_std else None,
                              value=4 if with_value else None,
                          ),
                      ],
                  ),
              ),
              TargetExplanation(
                  "y2",
                  feature_weights=FeatureWeights(
                      pos=[FeatureWeight("f", 1)],
                      neg=[],
                  ),
              ),
          ],
      )
      df_dict = format_as_dataframes(expl)
      assert isinstance(df_dict, dict)
      assert list(df_dict) == ["targets"]
      df = df_dict["targets"]
      expected_df = pd.DataFrame(
          {
              "target": ["y", "y", "y", "y", "y2"],
              "feature": ["a", "b", "neg2", "neg1", "f"],
              "weight": [13, 5, -1, -10, 1],
          },
          columns=["target", "feature", "weight"],
      )
      if with_std:
          expected_df["std"] = [0.13, 0.5, 0.3, 0.2, None]
      if with_value:
          expected_df["value"] = [2, 1, 4, 5, None]
      print(df, expected_df, sep="\n")
      assert expected_df.equals(df)
  
      single_df = format_as_dataframe(expl)
      assert expected_df.equals(single_df)
  
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 6 for calling a global function with example usage: test_targets(with_std, with_value) without return types