turicreate.SFrame.add_columns

SFrame.add_columns(data, column_names=None, inplace=False)

Returns an SFrame with multiple columns added. The number of elements in all columns must match the length of every other column of the SFrame.

If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame.

If inplace == True, this operation modifies the current SFrame, returning self.

Parameters:
data : list[SArray] or SFrame

The columns to add.

column_names: list of string, optional

A list of column names. All names must be specified. column_names is ignored if data is an SFrame.

inplace : bool, optional. Defaults to False.

Whether the SFrame is modified in place.

Returns:
out : SFrame

The current SFrame.

See also

add_column

Examples

>>> sf = turicreate.SFrame({'id': [1, 2, 3], 'val': ['A', 'B', 'C']})
>>> sf2 = turicreate.SFrame({'species': ['cat', 'dog', 'fossa'],
...                        'age': [3, 5, 9]})
>>> res = sf.add_columns(sf2)
>>> res
+----+-----+-----+---------+
| id | val | age | species |
+----+-----+-----+---------+
| 1  |  A  |  3  |   cat   |
| 2  |  B  |  5  |   dog   |
| 3  |  C  |  9  |  fossa  |
+----+-----+-----+---------+
[3 rows x 4 columns]