Add blank rows to this frame. For existing fields, the rows will be extended according to their initializers. Parameters ---------- num_rows : int The number of new rows
(self, num_rows)
| 742 | self._columns[name] = Column(init_data, scheme) |
| 743 | |
| 744 | def add_rows(self, num_rows): |
| 745 | """Add blank rows to this frame. |
| 746 | |
| 747 | For existing fields, the rows will be extended according to their |
| 748 | initializers. |
| 749 | |
| 750 | Parameters |
| 751 | ---------- |
| 752 | num_rows : int |
| 753 | The number of new rows |
| 754 | """ |
| 755 | feat_placeholders = {} |
| 756 | for key, col in self._columns.items(): |
| 757 | scheme = col.scheme |
| 758 | ctx = F.context(col.data) |
| 759 | if self.get_initializer(key) is None: |
| 760 | self._set_zero_default_initializer() |
| 761 | initializer = self.get_initializer(key) |
| 762 | new_data = initializer( |
| 763 | (num_rows,) + scheme.shape, |
| 764 | scheme.dtype, |
| 765 | ctx, |
| 766 | slice(self._num_rows, self._num_rows + num_rows), |
| 767 | ) |
| 768 | feat_placeholders[key] = new_data |
| 769 | self._append(Frame(feat_placeholders)) |
| 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. |
no test coverage detected