-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: maybe_convert_objects mixed datetimes and timedeltas #27438
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
Merged
jreback
merged 6 commits into
pandas-dev:master
from
BeforeFlight:maybe_convert_objects_BUG
Jul 24, 2019
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9f0c986
BUG: maybe_convert_objects mixed datetimes and timedeltas in some inp…
BeforeFlight f005531
Rewrite nested ifs. Test added.
BeforeFlight e109dbf
Some fixes.
BeforeFlight 034f729
Tests with np.nan, pd.NaT added.
BeforeFlight d416771
Linter fixes.
BeforeFlight f2f265e
Array full of NaT ambiguity TODO.
BeforeFlight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
this construction seems odd, you can just construct directly no? e.g.
arr = np.array([np.datetime...., np.timedetla.lll], dtype='object'])
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.
don't you need a NaT somewhere? what about throwing in a np.nan as well (maybe another case)
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.
Construction is odd, yes - will rewrite (it's leftover of previous tests sorry). Will add tests with NaT as well.
As for np.nan - not quite understand. Add something with datetimes and np.nan?
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.
yes we likely already have a test for this, but pls check
Uh oh!
There was an error while loading. Please reload this page.
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.
@jreback all is green please check.
Now there are 10 tests for
maybe_convert_objects
+ 13 tests throughDataframe
constructor (there are also tests formaybe_convert_numeric
but I did not count these).Uh oh!
There was an error while loading. Please reload this page.
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.
By the way - no one confirm my changes with array full of
NaT
with bothconvert_DT
andconvert_TD
checks asTrue
(elif seen.nat_:
case) - now it returnsdatetime
without any warning of ambiguity withtimedelta
. Old behaviour was to returnobject
(without considering flags state IIRC). Check it pls too.