MCPcopy Create free account
hub / github.com/dmlc/dgl / update_column

Method update_column

python/dgl/frame.py:772–792  ·  view source on GitHub ↗

Add or replace the column with the given name and data. Parameters ---------- name : str The column name. data : Column or data convertible to Column The column data.

(self, name, data)

Source from the content-addressed store, hash-verified

770 self._num_rows += num_rows
771
772 def update_column(self, name, data):
773 """Add or replace the column with the given name and data.
774
775 Parameters
776 ----------
777 name : str
778 The column name.
779 data : Column or data convertible to Column
780 The column data.
781 """
782 if isinstance(data, LazyFeature):
783 self._columns[name] = data
784 return
785
786 col = Column.create(data)
787 if len(col) != self.num_rows:
788 raise DGLError(
789 "Expected data to have %d rows, got %d."
790 % (self.num_rows, len(col))
791 )
792 self._columns[name] = col
793
794 def update_row(self, rowids, data):
795 """Update the feature data of the given rows.

Callers 1

__setitem__Method · 0.95

Calls 2

DGLErrorClass · 0.85
createMethod · 0.45

Tested by

no test coverage detected