code: def test_transition_features():
      expl = Explanation(
          estimator="some estimator",
          targets=[
              TargetExplanation(
                  "class1",
                  feature_weights=FeatureWeights(
                      pos=[FeatureWeight("pos", 13, value=1)],
                      neg=[],
                  ),
              ),
              TargetExplanation(
                  "class2",
                  feature_weights=FeatureWeights(
                      pos=[FeatureWeight("pos", 13, value=1)],
                      neg=[],
                  ),
              ),
          ],
          transition_features=TransitionFeatureWeights(
              class_names=["class2", "class1"],  # reverse on purpose
              coef=np.array([[1.5, 2.5], [3.5, 4.5]]),
          ),
      )
      df_dict = format_as_dataframes(expl)
      assert isinstance(df_dict, dict)
      assert set(df_dict) == {"targets", "transition_features"}
      assert df_dict["targets"].equals(
          format_as_dataframe(expl.targets)
      )
      df = df_dict["transition_features"]
      print(df)
      print(format_as_text(expl))
      expected = pd.DataFrame(
          [
              {"from": "class2", "to": "class2", "coef": 1.5},
              {"from": "class2", "to": "class1", "coef": 2.5},
              {"from": "class1", "to": "class2", "coef": 3.5},
              {"from": "class1", "to": "class1", "coef": 4.5},
          ],
          columns=["from", "to", "coef"],
      )
      assert df.equals(expected)
      with pytest.warns(UserWarning):
          single_df = format_as_dataframe(expl)
      assert single_df.equals(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 9 for calling a global function with example usage: test_transition_features() without return types