Skip to content

when generating examples between 2 dates: hypothesis.errors.Unsatisfiable: Unable to satisfy assumptions of example_generating_inner_function #803

Answered by cosmicBboy
telferm57 asked this question in Q&A
Discussion options

You must be logged in to vote

hi @telferm57 this is a current limitation in the data synthesis strategies module re: check strategy chaining. The upshot is that you can use in_range checks to achieve what you want:

import pandas as pd
import pandera as pa
from pandera.engines import pandas_engine


schema = pa.DataFrameSchema(
    {
        "eventdate": pa.Column(
            pandas_engine.DateTime,
            checks=[
                pa.Check.in_range(
                    pd.to_datetime("1/1/2015", dayfirst=True),
                    pd.to_datetime("1/1/2019", dayfirst=True)
                ),
            ]
        ),
    }
)

print(schema.example(50))

Improvements need to be made on this front... the primary gotcha…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by telferm57
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants
Converted from issue

This discussion was converted from issue #773 on March 26, 2022 15:57.