def find_rows_by_string(tab, names, colnames=['assoc']):
    """Find the rows in a table ``tab`` that match at least one of the
    strings in ``names``.  This method ignores whitespace and case
    when matching strings.

    Parameters
    ----------
    tab : `astropy.table.Table`
       Table that will be searched.

    names : list
       List of strings.

    colname : str
       Name of the table column that will be searched for matching string.

    Returns
    -------
    mask : `~numpy.ndarray`
       Boolean mask for rows with matching strings.

    """
    mask = np.empty(len(tab), dtype=bool)
    mask.fill(False)
    names = [name.lower().replace(' ', '') for name in names]

    for colname in colnames:

        if colname not in tab.columns:
            continue

        col = tab[[colname]].copy()
        col[colname] = defchararray.replace(defchararray.lower(col[colname]).astype(str),
                                        ' ', '')
        for name in names:
            mask |= col[colname] == name
    return mask
def find_rows_by_string ( tab , names , colnames = [ 'assoc' ] ) : mask = np . empty ( len ( tab ) , dtype = bool ) mask . fill ( False ) names = [ name . lower ( ) . replace ( ' ' , '' ) for name in names ] for colname in colnames : if colname not in tab . columns : continue col = tab [ [ colname ] ] . copy ( ) col [ colname ] = defchararray . replace ( defchararray . lower ( col [ colname ] ) . astype ( str ) , ' ' , '' ) for name in names : mask |= col [ colname ] == name return mask
Find the rows in a table ``tab`` that match at least one of the
    strings in ``names``.  This method ignores whitespace and case
    when matching strings.

    Parameters
    ----------
    tab : `astropy.table.Table`
       Table that will be searched.

    names : list
       List of strings.

    colname : str
       Name of the table column that will be searched for matching string.

    Returns
    -------
    mask : `~numpy.ndarray`
       Boolean mask for rows with matching strings.