code: def adj_matrx_gen_custom(input_file, city_file):
      """genenrate Adjacency Matrix from file"""
      print("generate adj_matrix data (take long time)...")
      # data
      df = pd.read_csv(
          input_file,
          sep="\t",
          names=["date", "迁出省份", "迁出城市", "迁入省份", "迁入城市", "人数"],
      )
      # 只需要2020年的数据
      df["date"] = pd.to_datetime(df["date"], format="%Y%m%d")
      df = df.set_index("date")
      df = df["2020"]
      city_df = pd.read_csv(city_file)
      # 剔除武汉
      city_df = city_df.drop(0)
      num = len(city_df)
      matrix = np.zeros([num, num])
      for i in city_df["city"]:
          for j in city_df["city"]:
              if i == j:
                  continue
              # 选出从i到j的每日人数
              cut = df[df["迁出城市"].str.contains(i)]
              cut = cut[cut["迁入城市"].str.contains(j)]
              # 求均值作为权重
              average = cut["人数"].mean()
              # 赋值给matrix
              i_index = int(city_df[city_df["city"] == i]["num"]) - 1
              j_index = int(city_df[city_df["city"] == j]["num"]) - 1
              matrix[i_index, j_index] = average
  
      np.savetxt("dataset/W_74.csv", matrix, delimiter=",")
  
file_path: PGL/legacy/examples/stgcn/data_loader/data_utils.py
imports: import numpy
  import pandas
  from utils.math_utils import z_score
label_desc: Use image node_id 2 for calling a global function with example usage: adj_matrx_gen_custom(input_file, city_file) without return types