class_docstr: The core class of DeepGraph (dg).
  
  This class encapsulates the graph representation as ``pandas.DataFrame``
  objects in its attributes ``v`` and ``e``. It can be initialized with a
  node table ``v``, whose rows represent the nodes of the graph, as well
  as an edge table ``e``, whose rows represent edges between the nodes.
  
  Given a node table ``v``, it provides methods to iteratively compute
  pairwise relations between the nodes using arbitrary, user-defined
  functions. These methods provide arguments to parallelize the
  computation and control memory consumption (see ``create_edges`` and
  ``create_edges_ft``).
  
  Also provides methods to partition nodes, edges or an entire graph by
  the graph's properties and labels, and to create common network
  representations and graph objects of popular Python network packages.
  
  Furthermore, it provides methods to visualize graphs and their
  properties and to benchmark the graph construction parameters.
  
  Optionally, the convenience parameter ``supernode_labels_by`` can be
  passed, creating supernode labels by enumerating all distinct (tuples
  of) values of a (multiple) column(s) of ``v`` . Superedge labels can be
  created analogously, by passing the parameter ``superedge_labels_by``.
  
  Parameters
  ----------
  v : pandas.DataFrame or pandas.HDFStore, optional (default=None)
      The node table, a table representation of the nodes of a graph. The
      index of ``v`` must be unique and represents the node indices. The
      column names of ``v`` represent the types of features of the nodes,
      and each cell represents a feature of a node. Only a reference to
      the input DataFrame is created, not a copy. May also be a
      ``pandas.HDFStore``, but only ``create_edges`` and
      ``create_edges_ft`` may then be used (so far).
  
  e : pandas.DataFrame, optional (default=None)
      The edge table, a table representation of the edges between the
      nodes given by ``v``. Its index has to be a
      ``pandas.core.index.MultiIndex``, whose first level contains the
      indices of the source nodes, and the second level contains the
      indices of the target nodes. Each row of ``e`` represents an edge,
      column names of ``e`` represent the types of relations of the edges,
      and each cell in ``e`` represents a relation of an edge. Only a
      reference to the input DataFrame is created, not a copy.
  
  supernode_labels_by : dict, optional (default=None)
      A dictionary whose keys are strings and their values are (lists of)
      column names of ``v``. Appends a column to ``v`` for each key, whose
      values correspond to supernode labels, enumerating all distinct
      (tuples of) values of the column(s) given by the dict's value.
  
  superedge_labels_by : dict, optional (default=None)
      A dictionary whose keys are strings and their values are (lists of)
      column names of ``e``. Appends a column to ``e`` for each key, whose
      values correspond to superedge labels enumerating all distinct
      (tuples of) values of the column(s) given by the dict's value.
  
  Attributes
  ----------
  v : pandas.DataFrame
      See Parameters.
  
  e : pandas.DataFrame
      See Parameters.
  
  n : int
      Property: Number of nodes.
  
  m : int
      Property: Number of edges.
  
  f : pd.DataFrame
      Property: types of features and number of features of corresponding
      type.
  
  r : pd.DataFrame
      Property: types of relations and number of relations of
      corresponding type.
class_docstr_tok: ["The","core","class","of","DeepGraph","(","dg",")",".","This","class","encapsulates","the","graph","representation","as","``","pandas.DataFrame","``","objects","in","its","attributes","``","v","``","and","``","e","``",".","It","can","be","initialized","with","a","node","table","``","v","``",",","whose","rows","represent","the","nodes","of","the","graph",",","as","well","as","an","edge","table","``","e","``",",","whose","rows","represent","edges","between","the","nodes",".","Given","a","node","table","``","v","``",",","it","provides","methods","to","iteratively","compute","pairwise","relations","between","the","nodes","using","arbitrary",",","user-defined","functions",".","These","methods","provide","arguments","to","parallelize","the","computation","and","control","memory","consumption","(","see","``","create_edges","``","and","``","create_edges_ft","``",")",".","Also","provides","methods","to","partition","nodes",",","edges","or","an","entire","graph","by","the","graph","'s","properties","and","labels",",","and","to","create","common","network","representations","and","graph","objects","of","popular","Python","network","packages",".","Furthermore",",","it","provides","methods","to","visualize","graphs","and","their","properties","and","to","benchmark","the","graph","construction","parameters",".","Optionally",",","the","convenience","parameter","``","supernode_labels_by","``","can","be","passed",",","creating","supernode","labels","by","enumerating","all","distinct","(","tuples","of",")","values","of","a","(","multiple",")","column","(","s",")","of","``","v","``",".","Superedge","labels","can","be","created","analogously",",","by","passing","the","parameter","``","superedge_labels_by","``",".","Parameters","--","--","--","--","--","v",":","pandas.DataFrame","or","pandas.HDFStore",",","optional","(","default=None",")","The","node","table",",","a","table","representation","of","the","nodes","of","a","graph",".","The","index","of","``","v","``","must","be","unique","and","represents","the","node","indices",".","The","column","names","of","``","v","``","represent","the","types","of","features","of","the","nodes",",","and","each","cell","represents","a","feature","of","a","node",".","Only","a","reference","to","the","input","DataFrame","is","created",",","not","a","copy",".","May","also","be","a","``","pandas.HDFStore","``",",","but","only","``","create_edges","``","and","``","create_edges_ft","``","may","then","be","used","(","so","far",")",".","e",":","pandas.DataFrame",",","optional","(","default=None",")","The","edge","table",",","a","table","representation","of","the","edges","between","the","nodes","given","by","``","v","``",".","Its","index","has","to","be","a","``","pandas.core.index.MultiIndex","``",",","whose","first","level","contains","the","indices","of","the","source","nodes",",","and","the","second","level","contains","the","indices","of","the","target","nodes",".","Each","row","of","``","e","``","represents","an","edge",",","column","names","of","``","e","``","represent","the","types","of","relations","of","the","edges",",","and","each","cell","in","``","e","``","represents","a","relation","of","an","edge",".","Only","a","reference","to","the","input","DataFrame","is","created",",","not","a","copy",".","supernode_labels_by",":","dict",",","optional","(","default=None",")","A","dictionary","whose","keys","are","strings","and","their","values","are","(","lists","of",")","column","names","of","``","v","``",".","Appends","a","column","to","``","v","``","for","each","key",",","whose","values","correspond","to","supernode","labels",",","enumerating","all","distinct","(","tuples","of",")","values","of","the","column","(","s",")","given","by","the","dict","'s","value",".","superedge_labels_by",":","dict",",","optional","(","default=None",")","A","dictionary","whose","keys","are","strings","and","their","values","are","(","lists","of",")","column","names","of","``","e","``",".","Appends","a","column","to","``","e","``","for","each","key",",","whose","values","correspond","to","superedge","labels","enumerating","all","distinct","(","tuples","of",")","values","of","the","column","(","s",")","given","by","the","dict","'s","value",".","Attributes","--","--","--","--","--","v",":","pandas.DataFrame","See","Parameters",".","e",":","pandas.DataFrame","See","Parameters",".","n",":","int","Property",":","Number","of","nodes",".","m",":","int","Property",":","Number","of","edges",".","f",":","pd.DataFrame","Property",":","types","of","features","and","number","of","features","of","corresponding","type",".","r",":","pd.DataFrame","Property",":","types","of","relations","and","number","of","relations","of","corresponding","type","."]
docstr: Append a column with binning labels of the values in ``v[col]``.
  
  Append a column ``col_name`` to ``v`` with the indices of the bins to
  which each value in ``v[col]`` belongs to.
  
  If ``bins`` is an int, it determines the number of bins to create. If
  ``log_bins`` is True, this number determines the (approximate) number
  of bins to create for each magnitude. For linear bins, it is the number
  of bins for the whole range of values. If ``floor`` is set True, the
  bin edges are floored to the closest integer. If ``return_bin_edges``
  is set True, the created bin edges are returned.
  
  If ``bins`` is a sequence, it defines the bin edges, including the
  rightmost edge, allowing for non-uniform bin widths.
  
  See ``np.digitize`` for details.
  
  Parameters
  ----------
  col : int or str
      A column name of ``v``, whose corresponding values are binned and
      labelled.
  
  col_name : str
      The column name for the created labels.
  
  bins : int or array_lke, optional (default=10)
      If ``bins`` is an int, it determines the number of bins to create.
      If ``log_bins`` is True, this number determines the (approximate)
      number of bins to create for each magnitude. For linear bins, it is
      the number of bins for the whole range of values. If ``bins`` is a
      sequence, it defines the bin edges, including the rightmost edge,
      allowing for non-uniform bin widths.
  
  log_bins : bool, optional (default=False)
      Whether to use logarithmically or linearly spaced bins.
  
  floor : bool, optional (default=False)
      Whether to floor the bin edges to the closest integers.
  
  return_bin_edges : bool, optional (default=False)
      Whether to return the bin edges.
  
  Returns
  -------
  v : pd.DataFrame
      Appends an extra column ``col_name`` to ``v`` with the binning
      labels.
  
  bin_edges : np.ndarray
      Optionally, return the created bin edges.
  
  Examples
  --------
  First, we need a node table:
  
  >>> import pandas as pd
  >>> import deepgraph as dg
  >>> v = pd.DataFrame({'time': [1,2,12,105,899]})
  >>> g = dg.DeepGraph(v)
  
  >>> g.v
     time
  0     1
  1     2
  2    12
  3   105
  4   899
  
  Binning time values with default arguments:
  
  >>> bin_edges = g.append_binning_labels_v('time', 'time_l',
  ...                                       return_bin_edges=True)
  
  >>> bin_edges
  array([   1.        ,  100.77777778,  200.55555556,  300.33333333,
          400.11111111,  499.88888889,  599.66666667,  699.44444444,
          799.22222222,  899.        ])
  
  >>> g.v
     time  time_l
  0     1       1
  1     2       1
  2    12       1
  3   105       2
  4   899      10
  
  Binning time values with logarithmically spaced bins:
  
  >>> bin_edges = g.append_binning_labels_v('time', 'time_l', bins=5,
  ...                                       log_bins=True,
  ...                                       return_bin_edges=True)
  
  >>> bin_edges
  array([   1.        ,    1.62548451,    2.64219989,    4.29485499,
            6.98122026,   11.34786539,   18.44577941,   29.9833287 ,
           48.73743635,   79.22194781,  128.77404899,  209.32022185,
          340.24677814,  553.06586728,  899.        ])
  
  >>> g.v
     time  time_l
  0     1       1
  1     2       2
  2    12       6
  3   105      10
  4   899      15
  
  Binning time values with logarithmically spaced bins (floored):
  
  >>> bin_edges = g.append_binning_labels_v('time', 'time_l', bins=5,
  ...                                       log_bins=True, floor=True,
  ...                                       return_bin_edges=True)
  
  >>> bin_edges
  array([   1.,    2.,    4.,    6.,   11.,   18.,   29.,   48.,   79.,
          128.,  209.,  340.,  553.,  899.])
  
  >>> g.v
     time  time_l
  0     1       1
  1     2       2
  2    12       5
  3   105       9
  4   899      14
docstr_tok: ["Append","a","column","with","binning","labels","of","the","values","in","``","v","[","col","]","``",".","Append","a","column","``","col_name","``","to","``","v","``","with","the","indices","of","the","bins","to","which","each","value","in","``","v","[","col","]","``","belongs","to",".","If","``","bins","``","is","an","int",",","it","determines","the","number","of","bins","to","create",".","If","``","log_bins","``","is","True",",","this","number","determines","the","(","approximate",")","number","of","bins","to","create","for","each","magnitude",".","For","linear","bins",",","it","is","the","number","of","bins","for","the","whole","range","of","values",".","If","``","floor","``","is","set","True",",","the","bin","edges","are","floored","to","the","closest","integer",".","If","``","return_bin_edges","``","is","set","True",",","the","created","bin","edges","are","returned",".","If","``","bins","``","is","a","sequence",",","it","defines","the","bin","edges",",","including","the","rightmost","edge",",","allowing","for","non-uniform","bin","widths",".","See","``","np.digitize","``","for","details",".","Parameters","--","--","--","--","--","col",":","int","or","str","A","column","name","of","``","v","``",",","whose","corresponding","values","are","binned","and","labelled",".","col_name",":","str","The","column","name","for","the","created","labels",".","bins",":","int","or","array_lke",",","optional","(","default=10",")","If","``","bins","``","is","an","int",",","it","determines","the","number","of","bins","to","create",".","If","``","log_bins","``","is","True",",","this","number","determines","the","(","approximate",")","number","of","bins","to","create","for","each","magnitude",".","For","linear","bins",",","it","is","the","number","of","bins","for","the","whole","range","of","values",".","If","``","bins","``","is","a","sequence",",","it","defines","the","bin","edges",",","including","the","rightmost","edge",",","allowing","for","non-uniform","bin","widths",".","log_bins",":","bool",",","optional","(","default=False",")","Whether","to","use","logarithmically","or","linearly","spaced","bins",".","floor",":","bool",",","optional","(","default=False",")","Whether","to","floor","the","bin","edges","to","the","closest","integers",".","return_bin_edges",":","bool",",","optional","(","default=False",")","Whether","to","return","the","bin","edges",".","Returns","--","--","--","-","v",":","pd.DataFrame","Appends","an","extra","column","``","col_name","``","to","``","v","``","with","the","binning","labels",".","bin_edges",":","np.ndarray","Optionally",",","return","the","created","bin","edges",".","Examples","--","--","--","--","First",",","we","need","a","node","table",":",">",">",">","import","pandas","as","pd",">",">",">","import","deepgraph","as","dg",">",">",">","v","=","pd.DataFrame","(","{","'time","'",":","[","1,2,12,105,899","]","}",")",">",">",">","g","=","dg.DeepGraph","(","v",")",">",">",">","g.v","time","0","1","1","2","2","12","3","105","4","899","Binning","time","values","with","default","arguments",":",">",">",">","bin_edges","=","g.append_binning_labels_v","(","'time","'",",","'time_l","'",",","...","return_bin_edges=True",")",">",">",">","bin_edges","array","(","[","1.",",","100.77777778",",","200.55555556",",","300.33333333",",","400.11111111",",","499.88888889",",","599.66666667",",","699.44444444",",","799.22222222",",","899",".","]",")",">",">",">","g.v","time","time_l","0","1","1","1","2","1","2","12","1","3","105","2","4","899","10","Binning","time","values","with","logarithmically","spaced","bins",":",">",">",">","bin_edges","=","g.append_binning_labels_v","(","'time","'",",","'time_l","'",",","bins=5",",","...","log_bins=True",",","...","return_bin_edges=True",")",">",">",">","bin_edges","array","(","[","1.",",","1.62548451",",","2.64219989",",","4.29485499",",","6.98122026",",","11.34786539",",","18.44577941",",","29.9833287",",","48.73743635",",","79.22194781",",","128.77404899",",","209.32022185",",","340.24677814",",","553.06586728",",","899",".","]",")",">",">",">","g.v","time","time_l","0","1","1","1","2","2","2","12","6","3","105","10","4","899","15","Binning","time","values","with","logarithmically","spaced","bins","(","floored",")",":",">",">",">","bin_edges","=","g.append_binning_labels_v","(","'time","'",",","'time_l","'",",","bins=5",",","...","log_bins=True",",","floor=True",",","...","return_bin_edges=True",")",">",">",">","bin_edges","array","(","[","1.",",","2.",",","4.",",","6.",",","11.",",","18.",",","29.",",","48.",",","79.",",","128.",",","209.",",","340.",",","553.",",","899",".","]",")",">",">",">","g.v","time","time_l","0","1","1","1","2","2","2","12","5","3","105","9","4","899","14"]
code: def append_binning_labels_v(
      self,
      col,
      col_name,
      bins=10,
      log_bins=False,
      floor=False,
      return_bin_edges=False,
  ):
      """Append a column with binning labels of the values in ``v[col]``.
  
      Append a column ``col_name`` to ``v`` with the indices of the bins to
      which each value in ``v[col]`` belongs to.
  
      If ``bins`` is an int, it determines the number of bins to create. If
      ``log_bins`` is True, this number determines the (approximate) number
      of bins to create for each magnitude. For linear bins, it is the number
      of bins for the whole range of values. If ``floor`` is set True, the
      bin edges are floored to the closest integer. If ``return_bin_edges``
      is set True, the created bin edges are returned.
  
      If ``bins`` is a sequence, it defines the bin edges, including the
      rightmost edge, allowing for non-uniform bin widths.
  
      See ``np.digitize`` for details.
  
      Parameters
      ----------
      col : int or str
          A column name of ``v``, whose corresponding values are binned and
          labelled.
  
      col_name : str
          The column name for the created labels.
  
      bins : int or array_lke, optional (default=10)
          If ``bins`` is an int, it determines the number of bins to create.
          If ``log_bins`` is True, this number determines the (approximate)
          number of bins to create for each magnitude. For linear bins, it is
          the number of bins for the whole range of values. If ``bins`` is a
          sequence, it defines the bin edges, including the rightmost edge,
          allowing for non-uniform bin widths.
  
      log_bins : bool, optional (default=False)
          Whether to use logarithmically or linearly spaced bins.
  
      floor : bool, optional (default=False)
          Whether to floor the bin edges to the closest integers.
  
      return_bin_edges : bool, optional (default=False)
          Whether to return the bin edges.
  
      Returns
      -------
      v : pd.DataFrame
          Appends an extra column ``col_name`` to ``v`` with the binning
          labels.
  
      bin_edges : np.ndarray
          Optionally, return the created bin edges.
  
      Examples
      --------
      First, we need a node table:
  
      >>> import pandas as pd
      >>> import deepgraph as dg
      >>> v = pd.DataFrame({'time': [1,2,12,105,899]})
      >>> g = dg.DeepGraph(v)
  
      >>> g.v
         time
      0     1
      1     2
      2    12
      3   105
      4   899
  
      Binning time values with default arguments:
  
      >>> bin_edges = g.append_binning_labels_v('time', 'time_l',
      ...                                       return_bin_edges=True)
  
      >>> bin_edges
      array([   1.        ,  100.77777778,  200.55555556,  300.33333333,
              400.11111111,  499.88888889,  599.66666667,  699.44444444,
              799.22222222,  899.        ])
  
      >>> g.v
         time  time_l
      0     1       1
      1     2       1
      2    12       1
      3   105       2
      4   899      10
  
      Binning time values with logarithmically spaced bins:
  
      >>> bin_edges = g.append_binning_labels_v('time', 'time_l', bins=5,
      ...                                       log_bins=True,
      ...                                       return_bin_edges=True)
  
      >>> bin_edges
      array([   1.        ,    1.62548451,    2.64219989,    4.29485499,
                6.98122026,   11.34786539,   18.44577941,   29.9833287 ,
               48.73743635,   79.22194781,  128.77404899,  209.32022185,
              340.24677814,  553.06586728,  899.        ])
  
      >>> g.v
         time  time_l
      0     1       1
      1     2       2
      2    12       6
      3   105      10
      4   899      15
  
      Binning time values with logarithmically spaced bins (floored):
  
      >>> bin_edges = g.append_binning_labels_v('time', 'time_l', bins=5,
      ...                                       log_bins=True, floor=True,
      ...                                       return_bin_edges=True)
  
      >>> bin_edges
      array([   1.,    2.,    4.,    6.,   11.,   18.,   29.,   48.,   79.,
              128.,  209.,  340.,  553.,  899.])
  
      >>> g.v
         time  time_l
      0     1       1
      1     2       2
      2    12       5
      3   105       9
      4   899      14
  
      """
  
      x = self.v[col]
  
      # create bins
      if _is_array_like(bins):
          bin_edges = bins
      else:
          bin_edges = _create_bin_edges(x, bins, log_bins, floor)
  
      self.v[col_name] = np.digitize(x, bin_edges)
  
      if return_bin_edges:
          return bin_edges
  
imports: import inspect
  import os
  from datetime import datetime
  from itertools import chain
  from deepgraph.iterators_and_indexers import _matrix_iterator, _ft_iterator, _iter_edges, _initiate_create_edges, _aggregate_super_table
  from deepgraph.utils import _is_array_like, _dic_translator, _create_bin_edges, _flatten
  import numpy
  import pandas
label_desc: Use image node_id 14 for calling the DeepGraph obj's underlying member method code with example usage: obj.append_binning_labels_v(col, col_name, bins, log_bins, floor, return_bin_edges) and returns: bin_edges