code: def test_explain_weights_fi(boston_train):
      X, y, feature_names = boston_train
      reg = ExtraTreesRegressor()
      reg.fit(X, y)
      expl = explain_weights(reg)
      df = format_as_dataframe(expl)
      assert list(df.columns) == ["feature", "weight", "std"]
      df_indexed = df.groupby("feature").agg(lambda x: x)
      for fw in expl.feature_importances.importances:
          df_fw = df_indexed.loc[fw.feature]
          assert np.isclose(df_fw["weight"], fw.weight)
          assert np.isclose(df_fw["std"], fw.std)
  
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 3 for calling a global function with example usage: test_explain_weights_fi(boston_train) without return types