MCPcopy Create free account
hub / github.com/alibaba/GraphScope / to_numpy

Method to_numpy

python/graphscope/framework/context.py:137–159  ·  view source on GitHub ↗

Get the context data as a numpy array. Args: selector (str): Describes how to select values of context. See more details in derived context DAG node class. vertex_range (dict): optional, default to None. Works as slicing. The expressio

(self, selector, vertex_range=None, axis=0)

Source from the content-addressed store, hash-verified

135 raise NotImplementedError()
136
137 def to_numpy(self, selector, vertex_range=None, axis=0):
138 """Get the context data as a numpy array.
139
140 Args:
141 selector (str): Describes how to select values of context.
142 See more details in derived context DAG node class.
143 vertex_range (dict): optional, default to None.
144 Works as slicing. The expression {'begin': m, 'end': n} select a portion
145 of vertices from `m` to, but not including `n`. Type of `m`, `n` must be
146 identical with vertices' oid type.
147 Omitting the first index starts the slice at the beginning of the vertices,
148 and omitting the second index extends the slice to the end of the vertices.
149 Note the comparison is not based on numeric order, but on alphabetic order.
150 axis (int): optional, default to 0.
151
152 Returns:
153 :class:`graphscope.framework.context.ResultDAGNode`:
154 A result holds the `numpy.ndarray`, evaluated in eager mode.
155 """
156 self._check_selector(selector)
157 vertex_range = utils.transform_vertex_range(vertex_range)
158 op = dag_utils.context_to_numpy(self, selector, vertex_range, axis)
159 return ResultDAGNode(self, op)
160
161 def to_dataframe(self, selector, vertex_range=None):
162 """Get the context data as a pandas DataFrame.

Callers

nothing calls this directly

Calls 2

_check_selectorMethod · 0.95
ResultDAGNodeClass · 0.85

Tested by

no test coverage detected