def get_grouped_by_powers(bases, powers):
 positive = []
 negative = []
 for (base, power) in zip(bases, powers):
  if (power < 0):
   negative.append((base, (- power)))
  elif (power > 0):
   positive.append((base, power))
  else:
   raise ValueError(u'Unit with 0 power')
 return (positive, negative)

def get_grouped_by_powers ( bases , powers ) : positive = [ ] negative = [ ] for ( base , power ) in zip ( bases , powers ) : if ( power < 0 ) : negative . append ( ( base , ( - power ) ) ) elif ( power > 0 ) : positive . append ( ( base , power ) ) else : raise ValueError ( u'Unit with 0 power' ) return ( positive , negative )
groups the powers and bases in the given ~astropy .