Closed dsgibbons closed 5 months ago
After rereading the docs, I realised this can be solved via the constraints
kwarg:
import patito as pt
class model(pt.Model):
x_min: int
x_max: int = pt.Field(constraints=pt.col("x_min") < pt.col("x_max"))
I agree that that would be nice. In the meantime you should be able to represent this with - hehe, I you just answered what I was going to say about constraints ;)
Feel free to liberally point out any flaws with patito! We finally migrated last week to support pydantic 2, and there will very likely be docs issues that aren't clear!
Thank you for the quick turnaround :)
The comparators
lt
,gt
,le
andge
are all defined with respect to a single floating point. It would be even better if we could define these with respect to other columns. Something like:I imagine this may be difficult if the underlying functionality is not supported in Pydantic, but I'd love to see this feature!