code: def pdToNxCC(d, d2, lbl="type", mask=[]):
      listy = [
          "type",
          "approved",
          "nutraceutical",
          "illicit",
          "investigational",
          "withdrawn",
          "experimental",
      ]
      G = nx.Graph()
      nds = d2["id"].tolist()
      nattrs = {}
      for attr in listy:
          nattrs[attr] = d2[attr].tolist()
      nodes = []
      otherattrs = []
      for a in listy:
          if a != lbl and a not in mask:
              otherattrs.append(a)
      for i in range(len(nds)):
          dicty = {
              "node_label": int(nattrs[lbl][i]),
              "node_feature": torch.FloatTensor(
                  [float(nattrs[attr][i]) for attr in otherattrs]
              ),
          }
          t = (nds[i], dicty)
          nodes.append(t)
      G.add_nodes_from(nodes)
      src = d["srcid"].tolist()
      dst = d["dstid"].tolist()
      edges = []
      for i in range(len(src)):
          if G.has_node(src[i]) and G.has_node(dst[i]):
              t = (src[i], dst[i], {"edge_feature": float(0)})
              edges.append(t)
      G.add_edges_from(edges)
      return G
  
file_path: deepsnap/examples/bio_application/converter.py
imports: import pandas
  import networkx
  import torch
  import torch_geometric.data
  import torch_geometric.utils
label_desc: Use image node_id 6 for calling a global function with example usage: pdToNxCC(d, d2, lbl, mask) and returns: G