hypertools.tools.missing_inds

hypertools.tools.missing_inds(x, format_data=True)[source]

Returns indices of missing data

This function is useful to identify rows of your array that contain missing data or nans. The returned indices can be used to remove the rows with missing data, or label the missing data points that are interpolated using PPCA.

Parameters:
xarray or list of arrays
format_databool

Whether or not to first call the format_data function (default: True).

Returns:
inds1-D numpy integer array, or list of 1-D numpy integer arrays

For a single array: a 1-D numpy array of the (unique, sorted) row indices that contain missing values – EMPTY (shape (0,)) when the array has no missing data, so downstream fancy indexing like x[inds, :] always yields a well-formed (possibly empty) selection. (Returning None here, as hypertools < 1.0 did, made x[None, :] silently act as np.newaxis and produce a wrong-shaped array.) For a list of arrays: one such entry per dataset.