in kats/consts.py [0:0]
def __eq__(self, other: object) -> bool:
# Currently "__eq__" only works with other TimeSeriesData objects.
if not isinstance(other, TimeSeriesData):
return NotImplemented
# Check if time values are equal
try:
assert_series_equal(self.time, other.time, check_dtype=False)
except AssertionError:
return False
# If both objects are univariate
if isinstance(self.value, pd.Series) and isinstance(other.value, pd.Series):
# Check if value Series are equal
try:
assert_series_equal(self.value, other.value, check_dtype=False)
except AssertionError:
return False
# If both objects are multivariate
elif isinstance(self.value, pd.DataFrame) and isinstance(
other.value, pd.DataFrame
):
# Check if value DataFrames are equal (ignore column order)
try:
assert_frame_equal(
self.value.sort_index(axis=1),
other.value.sort_index(axis=1),
check_names=True,
check_dtype=False,
)
except AssertionError:
return False
# Otherwise one TimeSeriesData is univariate and the other is multivariate
else:
return False
return True