MCPcopy Index your code
hub / github.com/dmlc/dgl / _append

Method _append

python/dgl/frame.py:818–841  ·  view source on GitHub ↗

Append ``other`` frame to ``self`` frame.

(self, other)

Source from the content-addressed store, hash-verified

816 self._columns[key].update(rowids, val)
817
818 def _append(self, other):
819 """Append ``other`` frame to ``self`` frame."""
820 # pad columns that are not provided in the other frame with initial values
821 for key, col in self._columns.items():
822 if key in other:
823 continue
824 scheme = col.scheme
825 ctx = F.context(col.data)
826 if self.get_initializer(key) is None:
827 self._set_zero_default_initializer()
828 initializer = self.get_initializer(key)
829 new_data = initializer(
830 (other.num_rows,) + scheme.shape,
831 scheme.dtype,
832 ctx,
833 slice(self._num_rows, self._num_rows + other.num_rows),
834 )
835 other[key] = new_data
836 # append other to self
837 for key, col in other._columns.items():
838 if key not in self._columns:
839 # the column does not exist; init a new column
840 self.add_column(key, col.scheme, F.context(col.data))
841 self._columns[key].extend(col.data, col.scheme)
842
843 def append(self, other):
844 """Append another frame's data into this frame.

Callers 2

add_rowsMethod · 0.95
appendMethod · 0.95

Calls 7

get_initializerMethod · 0.95
add_columnMethod · 0.95
contextMethod · 0.80
extendMethod · 0.80
initializerFunction · 0.50
itemsMethod · 0.45

Tested by

no test coverage detected