Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support datetimes in GreaterThan constraint #266

Closed
rollervan opened this issue Dec 2, 2020 · 0 comments · Fixed by #272
Closed

Support datetimes in GreaterThan constraint #266

rollervan opened this issue Dec 2, 2020 · 0 comments · Fixed by #272
Assignees
Labels
internal The issue doesn't change the API or functionality
Milestone

Comments

@rollervan
Copy link
Contributor

rollervan commented Dec 2, 2020

  • SDV version: 0.5.0
  • Python version: 3.8
  • Operating System: Ubuntu

Description

It raises an error using GreaterThan constraint with handling_strategy=transform.
It works fine for numerical data but fails for datetime data.

What I Did

Here's a reproducible example:

from sdv.tabular import GaussianCopula
from sdv.constraints import UniqueCombinations, GreaterThan, ColumnFormula
from sdv.demo import load_tabular_demo

data = load_tabular_demo('student_placements')
data.head()

date_constraint = GreaterThan(
    low='start_date',
    high='end_date',
    handling_strategy='transform'
)

constraints = [
    date_constraint,
]

model = GaussianCopula(constraints=constraints)
model.fit(data)

Error output:

TypeError: Addition/subtraction of integers and integer-arrays with TimedeltaArray is no longer supported.  Instead of adding/subtracting `n`, use `n * obj.freq`
@csala csala added this to the 0.6.2 milestone Jan 13, 2021
@csala csala added the internal The issue doesn't change the API or functionality label Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal The issue doesn't change the API or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants