BPt.Dataset.drop_nan_subjects#

Dataset.drop_nan_subjects(scope, inplace=False)[source]#

This method is used for dropping all of the subjects which have NaN values for a given scope / column.

Parameters
scopeScope

A BPt style Scope used to select a subset of column(s) in which to apply the current function to. See Scope for more information on how this can be applied.

inplacebool, optional

If True, perform the current function inplace and return None.

default = False

Examples

In [1]: data = bp.read_csv('data/example1.csv')

In [2]: data
Out[2]: 
  animals  numbers
0   'cat'      1.0
1   'cat'      2.0
2   'dog'      1.0
3   'dog'      2.0
4   'elk'      NaN

# We can specify a scope of 'all' or a specific column
# both yielding the same results.
In [3]: data.drop_nan_subjects(scope='all')
Dropped 1 Rows
Out[3]: 
  animals  numbers
0   'cat'      1.0
1   'cat'      2.0
2   'dog'      1.0
3   'dog'      2.0

In [4]: data.drop_nan_subjects(scope='numbers')
Dropped 1 Rows
Out[4]: 
  animals  numbers
0   'cat'      1.0
1   'cat'      2.0
2   'dog'      1.0
3   'dog'      2.0