You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please indicate the following details about the environment in which you found the bug:
SDV version: Any
Python version: Any
Operating System: Any
Error Description
When using the GreaterThan constraint with a datetime value as the high scalar, it raises the following error
438 high = self._get_value(table_data, 'high')
439
--> 440 return self.operator(high, low).all(axis=1)
441
442 def _transform(self, table_data):
TypeError: '>=' not supported between instances of 'Timestamp' and 'int'
I suspect this might have a similar fix to issue #590. I think it has to do with the way we are doing is_valid in the GreaterThan constraint.
Steps to reproduce
I used the student_placements dataset in this case.
transform_gt_constraint = GreaterThan(
low='start_date',
high='end_date',
handling_strategy='reject_sampling')
upper_limit_constraint = GreaterThan(
low='end_date',
high=pd.to_datetime('now'),
scalar='high',
handling_strategy='reject_sampling')
# Add the constraints and fit the data
constraints = [transform_gt_constraint, upper_limit_constraint]
multi_constraint_gc = GaussianCopula(constraints=constraints)
multi_constraint_gc.fit(student_placements)
The text was updated successfully, but these errors were encountered:
Note that if you specify transform instead of reject_sampling, there is a different error:
/usr/local/lib/python3.7/dist-packages/sdv/constraints/tabular.py in _transform(self, table_data)
458 """
459 table_data = table_data.copy()
--> 460 diff = self._get_value(table_data, 'high') - self._get_value(table_data, 'low')
461
462 if self._is_datetime:
UFuncTypeError: ufunc 'subtract' cannot use operands with types dtype('O') and dtype('<M8[ns]')
Steps to Reproduce
Do a similar thing as above, except only input a single constraint using the transform strategy
upper_limit_constraint=GreaterThan(
low='end_date',
high=pd.to_datetime('now'),
scalar='high',
handling_strategy='transform')
# Add the constraints and fit the dataconstraints= [upper_limit_constraint]
multi_constraint_gc=GaussianCopula(constraints=constraints)
multi_constraint_gc.fit(student_placements)
Environment Details
Please indicate the following details about the environment in which you found the bug:
Error Description
When using the
GreaterThan
constraint with a datetime value as thehigh
scalar, it raises the following errorI suspect this might have a similar fix to issue #590. I think it has to do with the way we are doing
is_valid
in theGreaterThan
constraint.Steps to reproduce
I used the
student_placements
dataset in this case.The text was updated successfully, but these errors were encountered: