code: def load_features(input_data):
      # Summarise features by terrorist group
      dt_collect = input_data[
          [
              "eventid",
              "nperps",
              "success",
              "suicide",
              "nkill",
              "nwound",
              "gname",
          ]
      ]
      dt_collect.fillna(0, inplace=True)
      dt_collect.nperps[dt_collect.nperps < 0] = 0
  
      summarize_by_gname = (
          dt_collect.groupby("gname")
          .agg(
              {
                  "eventid": "count",
                  "nperps": "sum",
                  "nkill": "sum",
                  "nwound": "sum",
                  "success": "sum",
              }
          )
          .reset_index()
      )
      summarize_by_gname.columns = [
          "gname",
          "n_attacks",
          "n_nperp",
          "n_nkil",
          "n_nwound",
          "n_success",
      ]
      summarize_by_gname["success_ratio"] = (
          summarize_by_gname["n_success"]
          / summarize_by_gname["n_attacks"]
      )
      summarize_by_gname.drop(["n_success"], axis=1, inplace=True)
  
      # Collect counts of each attack type
      dt_collect = input_data[["gname", "attacktype1_txt"]]
      gname_attacktypes = (
          dt_collect.groupby(["gname", "attacktype1_txt"])[
              "attacktype1_txt"
          ]
          .count()
          .to_frame()
      )
      gname_attacktypes.columns = ["attacktype_count"]
      gname_attacktypes.reset_index(inplace=True)
      gname_attacktypes_wide = gname_attacktypes.pivot(
          index="gname",
          columns="attacktype1_txt",
          values="attacktype_count",
      )
      gname_attacktypes_wide.fillna(0, inplace=True)
      gname_attacktypes_wide.drop(["Unknown"], axis=1, inplace=True)
  
      # Collect counts of each target type
      dt_collect = input_data[["gname", "targtype1_txt"]]
      gname_targtypes = (
          dt_collect.groupby(["gname", "targtype1_txt"])[
              "targtype1_txt"
          ]
          .count()
          .to_frame()
      )
      gname_targtypes.columns = ["targtype_count"]
      gname_targtypes.reset_index(inplace=True)
      gname_targtypes_wide = gname_targtypes.pivot(
          index="gname",
          columns="targtype1_txt",
          values="targtype_count",
      )
      gname_targtypes_wide.fillna(0, inplace=True)
      gname_targtypes_wide.drop(["Unknown"], axis=1, inplace=True)
  
      # Combine all features
      data_frames = [
          summarize_by_gname,
          gname_attacktypes_wide,
          gname_targtypes_wide,
      ]
      gnames_features = reduce(
          lambda left, right: pd.merge(
              left, right, on=["gname"], how="outer"
          ),
          data_frames,
      )
      return gnames_features
  
file_path: stellargraph/demos/community_detection/utils.py
imports: import pandas
  import numpy
  import random
  import networkx
  from sklearn.cluster import DBSCAN
  from functools import reduce
  import matplotlib.pyplot
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: load_features(input_data) and returns: gnames_features