class_docstr: Tigergraph bindings class
  
  * Initialize with DB cfg
  * Register named stored procedures and graphistry bindings
  * Call stored procedures
  * Call interpreted queries
class_docstr_tok: ["Tigergraph","bindings","class","*","Initialize","with","DB","cfg","*","Register","named","stored","procedures","and","graphistry","bindings","*","Call","stored","procedures","*","Call","interpreted","queries"]
code: def __json_to_graphistry(self, graphistry, json, bindings):
      edges_df = pd.DataFrame({"from_id": [], "to_id": []})
      edge_key = bindings["edges"]
      edges = [x for x in json if edge_key in x]
      if len(edges) > 0 and (edge_key in edges[0]):
          edges = edges[0][edge_key]
          edges_df = pd.DataFrame(edges)
          try:
              edges_df = edges_df.drop(columns=["attributes"])
              attrs = [x["attributes"] for x in edges]
              edges_df = pd.merge(
                  edges_df,
                  pd.DataFrame(attrs),
                  left_index=True,
                  right_index=True,
              )
          except:
              self.__log("Failed to extract edge attrs")
          g = graphistry.bind(
              source="from_id", destination="to_id"
          ).edges(edges_df)
  
      nodes_df = pd.DataFrame({"type": [], "node_id": []})
      node_key = bindings["nodes"]
      nodes = [x for x in json if node_key in x]
      if len(nodes) > 0 and (node_key in nodes[0]):
          nodes = nodes[0][node_key]
          nodes_df = pd.DataFrame(nodes)
          try:
              nodes_df = nodes_df.drop(columns=["attributes"])
              attrs = [x["attributes"] for x in nodes]
              nodes_df = pd.merge(
                  nodes_df,
                  pd.DataFrame(attrs),
                  left_index=True,
                  right_index=True,
              )
          except:
              self.__log("Failed to extract node attrs")
      else:
          nodes_df = (
              pd.DataFrame(
                  {
                      "node_id": edges_df["from_id"].append(
                          edges_df["to_id"]
                      )
                  }
              )
              .drop_duplicates()
              .reset_index(drop=True)
          )
          from_types = nodes_df.merge(
              edges_df[["from_id", "from_type"]].rename(
                  columns={"from_id": "node_id", "from_type": "type"}
              ),
              on="node_id",
              how="left",
          )
          to_types = nodes_df.merge(
              edges_df[["to_id", "to_type"]].rename(
                  columns={"to_id": "node_id", "to_type": "type"}
              ),
              on="node_id",
              how="left",
          )
          nodes_df = nodes_df.merge(
              pd.DataFrame(
                  {
                      "type": from_types.merge(
                          to_types, left_index=True, right_index=True
                      ).apply(
                          lambda row: row["type_x"]
                          if not pd.isna(row["type_x"])
                          else row["type_y"],
                          axis=1,
                      )
                  }
              ),
              left_index=True,
              right_index=True,
          )
      g = g.bind(node="node_id").nodes(nodes_df)
      return g
  
file_path: pygraphistry/graphistry/tigeristry.py
imports: import requests
  import pandas
label_desc: Use image node_id 7 for calling the Tigeristry obj's underlying member method code with example usage: obj.__json_to_graphistry(graphistry, json, bindings) and returns: g