Adapt to change in behavior of pandas.Timestamp constructor
#10944
+22
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves the upstream test failures indicated in #10932 by introducing a function to automatically cast a
pandas.Timestampto the coarsest resolution without changing its value, which we depend on in decoding the reference date of datetime data. Previously theTimestampconstructor would approximately accomplish this for us, but this was changed in pandas-dev/pandas#62801.In some cases the behavior of this function will be different than the previous
Timestampconstructor, since this function does not parse the string for this information. For example, previously theTimestampconstructor would assume that millisecond resolution was needed to represent this time:but strictly speaking only
"s"resolution is needed, which is what this new approach will choose. In a certain way, however, this may ultimately be more consistent with how we infer the resolution of the data values themselves. I did not add a what's new entry since this is somewhat of an internal change, but I can add one if we feel the change in behavior of this edge case is worth noting.cc: @kmuehlbauer