def is_compatible(self, other):
if isinstance(other, type(self)):<EOL><INDENT>try:<EOL><INDENT>if not self.dx == other.dx:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % (type(self).__name__,<EOL>self.dx, other.dx))<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if not self.unit == other.unit and not (<EOL>self.unit in [dimensionless_unscaled, None] and<EOL>other.unit in [dimensionless_unscaled, None]):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>% (type(self).__name__, str(self.unit),<EOL>str(other.unit)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>arr = numpy.asarray(other)<EOL>if arr.ndim != self.ndim:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if arr.dtype != self.dtype:<EOL><INDENT>warn("<STR_LIT>"<EOL>% (self.dtype, other.dtype))<EOL><DEDENT><DEDENT>return True<EOL>
Check whether this series and other have compatible metadata

        This method tests that the `sample size <Series.dx>`, and the
        `~Series.unit` match.