def filter_samples_by_nan(data_df, sample_frac_cutoff):
    """ Filter out samples whose fraction of probes measured is less than sample_frac_cutoff.

    Args:
        data_df (pandas df)
        sample_frac_cutoff (float b/w 0 and 1)
    Returns:
        out_df (pandas df): potentially smaller than input
    """
    # Number of NaNs per sample
    num_nans = data_df.isnull().sum()

    # Number of rows
    num_rows = data_df.shape[0]

    # Fraction non-NaN per sample
    frac_non_nan_per_sample = 1 - num_nans/num_rows

    # Only return samples with more non-NaN data than sample_frac_cutoff
    out_df = data_df.loc[:, frac_non_nan_per_sample > sample_frac_cutoff]
    assert not out_df.empty, "All samples were filtered out. Try reducing the threshold."

    return out_df