code: def feature_corr_matrix(df, method="spearman"):
      """
      Return the Spearman's rank-order correlation (or another method) between all pairs
      of features as a matrix with feature names as index and column names.
      The diagonal will be all 1.0 as features are self correlated.
  
      Spearman's correlation is the same thing as converting two variables
      to rank values and then running a standard Pearson's correlation
      on those ranked variables. Spearman's is nonparametric and does not
      assume a linear relationship between the variables; it looks for
      monotonic relationships.
  
      :param df: dataframe containing features as columns, and without the target variable.
      :param method: A string ("spearman", "pearson") or a callable function.
      :return: a data frame with the correlation matrix
      """
      corr = np.round(get_feature_corr(df, method=method), 4)
      df_corr = pd.DataFrame(
          data=corr, index=df.columns, columns=df.columns
      )
      return df_corr
  
imports: import pandas
  import numpy
  import matplotlib.pyplot
  import sklearn
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.ensemble import RandomForestRegressor
  from distutils.version import LooseVersion
  from sklearn.model_selection import cross_val_score
  from sklearn.base import clone
  from sklearn.metrics import r2_score
  from sklearn.metrics import f1_score
  from sklearn.preprocessing import LabelEncoder
  from scipy import stats
  from pandas.api.types import is_numeric_dtype
  from matplotlib.colors import ListedColormap
  from matplotlib.ticker import FormatStrFormatter
  from copy import copy
  import warnings
  import tempfile
  from os import getpid, makedirs
label_desc: Use image node_id 21 for calling a global function with example usage: feature_corr_matrix(df, method) and returns: df_corr