-
Notifications
You must be signed in to change notification settings - Fork 122
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
Workaround for Dataframe object in the config: check whether value is string before mandatory missing check #553
Conversation
Thanks @jeffknaide. |
Blocked by #543. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jeffknaide.
See inline comments.
tests/__init__.py
Outdated
def __eq__(self, other: Any) -> Any: | ||
return self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find __eq__
returning self very odd. what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when a pandas DataFrame runs df.__eq__(val)
, it returns a DataFrame of booleans with the same shape as the original DataFrame. Here I was trying to mimic the behavior of a df comparison resulting in the same class being returned, as this is partially what caused issues originally. perhaps this should be made clearer with a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
Yes, add a comment what the behavior we are mimicking is.
I guess we can't mimic it without overriding both eq and bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think so -- if we don't override eq, the comparison to string would return a bool and then not raise the expected error on the conditional. eg if Dataframe() == "???"
would equate to if False
(which wouldn't raise the expected error) without the eq override.
@@ -34,6 +34,17 @@ def __deepcopy__(self, memo: Any) -> Any: | |||
raise NotImplementedError() | |||
|
|||
|
|||
class Dataframe: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment here.
something like:
Emulates Pandas Dataframe equality behavior.
Co-authored-by: Omry Yadan <[email protected]>
Co-authored-by: Omry Yadan <[email protected]>
lgtm. |
At first glance I don't foresee any issue (crossing fingers). Just mentioning that maybe there could be a new utility function to avoid repeating |
Yeah, was thinking that too. |
@odelalleau @omry oh, yes, that makes sense. I just added There was also an inner function defined in |
It’s almost certainly because that function can be called on a node: it starts with |
I think we will want to take a closer look at this in a followup. |
Most could be kept, only the change in |
Maybe. it just feels like there are a bit too many layers here. The logic can be slightly reorganized to be simpler. |
This reverts commit 203b073.
@omry - i just reverted previous commit. let me know if you want me to put the utils function back while leaving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jeffknaide.
… string before mandatory missing check (omry#553)
Closes #566
sidestep source of facebookresearch/hydra#1285 at the omegaconf level