def test_table_groups_mask_index(T1):
 for masked in (False, True):
  t1 = Table(T1, masked=masked).group_by('a')
  t2 = t1.groups[np.array([True, False, True])]
  assert (len(t2.groups) == 2)
  assert (t2.groups[0].pformat() == t1.groups[0].pformat())
  assert (t2.groups[1].pformat() == t1.groups[2].pformat())
  assert np.all((t2.groups.keys['a'] == np.array([0, 2])))

def test_table_groups_mask_index ( T1 ) : for masked in ( False , True ) : t1 = Table ( T1 , masked = masked ) . group_by ( 'a' ) t2 = t1 . groups [ np . array ( [ True , False , True ] ) ] assert ( len ( t2 . groups ) == 2 ) assert ( t2 . groups [ 0 ] . pformat ( ) == t1 . groups [ 0 ] . pformat ( ) ) assert ( t2 . groups [ 1 ] . pformat ( ) == t1 . groups [ 2 ] . pformat ( ) ) assert np . all ( ( t2 . groups . keys [ 'a' ] == np . array ( [ 0 , 2 ] ) ) )
use boolean mask as item in __getitem__ for groups .