-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Date and DateTime support for Missing is missing #28570
Comments
It's worth noting that other constructors don't have overloads for missing
So it is likely that the fix is to add an overload just to the |
I think that there is a case to be made for overloading As an example, consider a user is trying to parse a an array or a column of a data frame containing strings as well as missing values to dates. Asking the user to explicitly handle missing values for this particular case while all other operations handle missing values quietly without the user having to explicitly deal with them would constitute an inconsistent user experience. |
Could you clarify which operations handle missing values quietly? For constructors. If, for example, you have an array Deliberate handling of missings is something Julia makes you more sensitive to than in other languages. For instance this is (probably) recommended behavior.
This might be a pain, but there is a lot to be said for this really being a feature because it encourages people to be aware of how missing values propogate. R constructors do propagate missing values however, so this is new for people coming over from there. |
But we should still work on a PR for the Unary operators! |
Interestingly, it looks like someone snuck in a bunch of broadcasting behavior that should probably throw errors in 1.0 julia/stdlib/Dates/src/arithmetic.jl Line 94 in f8d82cc
We might want to learn more about that before a PR to avoid having to write out so many overloadings of unary operators. Posted on discourse here |
I don't think we should have a special case for dates: either all constructors should accept However, we should make it easier to enable functions/constructors to accept |
Could you clarify more about the functions issue? Should I file a distinct issue for It seems like a |
Yes, |
I'm still not 100% convinced that accepting I am, however, ok with using a I also agree with pdeffebach that this approach, while feasible, is at odds with the promises made when |
As far as I recall, the argument was that a few basic operations would propagate |
Without the I think lift is a good idea. Given that |
I don't think the removal of the constructor fallback on |
Thanks for the feedback. Taking Dates as the example here. Overloading But we can't expect to track down every intermediate function that a constructor calls if it isn't just |
If Also, +1 for the |
Yes, my idea is that people will need to use |
I personally prefer |
So are we going to do anything here? Define |
This seems to demand a more general approach to me, rather than adding more and more methods for missing all over the place? When would it end? Never. |
This is a slight confusion of terms --- lifting values in the case of Since |
I agree, once we have decided that a given operator should propagate missing values, we should follow this behavior for all types that implement it. The question of which operators should propagate |
Take a look at an issue here where I (misguidedly) bring up missings in NaNMath.jl. The package maintainer fairly says that they don't anticipate their package being used in a context where missing values would be a concern. That is to say, the space of "values that should always propagate missings" might be quite small. But of course means we would inevitably have gotchas where we have to say "No, that type doesn't support missings, use lift." The inconsistency would be tiring. |
AFAICT NaNMath is a different question, as |
I've just rather unexpectedly run into the lack of methods for Is there any consensus around this? I can make a PR if everyone agrees to support it for |
@ExpandingMan I think there are some good methods using + or -. Only you need to make whatever type you are adding is a date type such as |
I'm in the same boat as @ExpandingMan here - I've actually been using Are there any reasons not to add this? |
Inspired by the discussion in JuliaLang#28570
Inspired by the discussion in #28570
Currently, there is no support for
missing
values when it comes to working withDate
andDateTime
.For example, the
Date
constructor throws an error when called on amissing
input value:Similarly, computing the difference between two dates fails of one of them is missing:
Presumably, all unary and binary operators need to be overloaded, either in
Base
or inDates
. Any ideas and suggestions for how to address this issue would be more than welcome.The text was updated successfully, but these errors were encountered: