otp.Source.dropna#
- Source.dropna(how='any', inplace=False)[source]#
Drops ticks that contain NaN values according to the policy in the
how
parameter- Parameters
how ("any" or "all") –
any
- filters out ticks if at least one field has NaN valueall
- filters out ticks if all fields have NaN values.inplace (bool) – the flag controls whether operation should be applied inplace.
- Return type
Source
orNone
Examples
Drop ticks where at least one field has
nan
value.>>> data = otp.Ticks([[ 'X', 'Y'], ... [ 0.0, 1.0], ... [ otp.nan, 2.0], ... [ 4.0, otp.nan], ... [ otp.nan, otp.nan], ... [ 6.0, 7.0]]) >>> data = data.dropna() >>> otp.run(data)[['X', 'Y']] X Y 0 0.0 1.0 1 6.0 7.0
Drop ticks where all fields have
nan
values.>>> data = otp.Ticks([[ 'X', 'Y'], ... [ 0.0, 1.0], ... [ otp.nan, 2.0], ... [ 4.0, otp.nan], ... [ otp.nan, otp.nan], ... [ 6.0, 7.0]]) >>> data = data.dropna(how='all') >>> otp.run(data)[['X', 'Y']] X Y 0 0.0 1.0 1 NaN 2.0 2 4.0 NaN 3 6.0 7.0