turicreate.SFrame.dropna_split

SFrame.dropna_split(columns=None, how='any', recursive=False)

Split rows with missing values from this SFrame. This function has the same functionality as dropna(), but returns a tuple of two SFrames. The first item is the expected output from dropna(), and the second item contains all the rows filtered out by the dropna algorithm.

Parameters:
columns : list or str, optional

The columns to use when looking for missing values. By default, all columns are used.

how : {‘any’, ‘all’}, optional

Specifies whether a row should be dropped if at least one column has missing values, or if all columns have missing values. ‘any’ is default.

recursive: bool

By default is False. If this flag is set to True, then nan check will be performed on each element of a sframe cell in a recursive manner if the cell has a nested structure, such as dict, list.

Returns:
out : (SFrame, SFrame)
(SFrame with missing values removed,

SFrame with the removed missing values)

See also

dropna

Examples

>>> sf = turicreate.SFrame({'a': [1, None, None], 'b': ['a', 'b', None]})
>>> good, bad = sf.dropna_split()
>>> good
+---+---+
| a | b |
+---+---+
| 1 | a |
+---+---+
[1 rows x 2 columns]
>>> bad
+------+------+
|  a   |  b   |
+------+------+
| None |  b   |
| None | None |
+------+------+
[2 rows x 2 columns]