def validate(self, in_dshape): if not isreal(in_dshape.measure[str(self.x)]): raise ValueError('x must be real') elif not isreal(in_dshape.measure[str(self.y)]): raise ValueError('y must be real') elif not isreal(in_dshape.measure[str(self.name)]): raise ValueError('aggregate value must be real')
def validate(self, in_dshape): if not all([isreal(in_dshape.measure[str(xcol)]) for xcol in self.x]): raise ValueError('x columns must be real') elif not all([isreal(in_dshape.measure[str(ycol)]) for ycol in self.y]): raise ValueError('y columns must be real') unique_x_measures = set(in_dshape.measure[str(xcol)] for xcol in self.x) if len(unique_x_measures) > 1: raise ValueError('x columns must have the same data type') unique_y_measures = set(in_dshape.measure[str(ycol)] for ycol in self.y) if len(unique_y_measures) > 1: raise ValueError('y columns must have the same data type')
def test_isreal(): assert isreal('int32') assert isreal(dshape('int32')) assert isreal('?int32') assert isreal('float64') assert not isreal('complex64') assert not isreal('{x: int64, y: float64}')
def validate(self, in_dshape): if not all([isreal(in_dshape.measure[str(xcol)]) for xcol in self.x]): raise ValueError('x columns must be real') elif not all([isreal(in_dshape.measure[str(ycol)]) for ycol in self.y]): raise ValueError('y columns must be real')
def validate(self, in_dshape): for col in [self.x, self.y] + list(self.z): if not isreal(in_dshape.measure[str(col)]): raise ValueError('{} must be real'.format(col))