(data, to_metas=False)
return data.transform(new_domain)
Remove non-binary columns from the data.
Remove non-binary columns from the data.
Remove non - binary columns from the data .
def remove_nonbinary_features(data, to_metas=False):
    """Remove non-binary columns from the data."""
    new_domain = Domain(
        [a for a in data.domain.attributes
         if a.is_discrete and len(a.values) == 2],
        data.domain.class_vars,
        data.domain.metas +
        (() if not to_metas
         else tuple(a for a in data.domain.attributes
               if not (a.is_discrete and len(a.values) == 2))
         if to_metas else ()))
    return data.transform(new_domain)
def remove_nonbinary_features ( data , to_metas = False ) : new_domain = Domain ( [ a for a in data . domain . attributes if a . is_discrete and len ( a . values ) == 2 ] , data . domain . class_vars , data . domain . metas + ( ( ) if not to_metas else tuple ( a for a in data . domain . attributes if not ( a . is_discrete and len ( a . values ) == 2 ) ) if to_metas else ( ) ) ) return data . transform ( new_domain )