-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DatetimeArray._from_sequence accepting bool dtype #32668
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
Conversation
with pytest.raises( | ||
ValueError, match="The dtype of 'values' is incorrect.*bool" | ||
): | ||
DatetimeArray(np.array([1, 2, 3], dtype="bool")) | ||
DatetimeArray(arr) |
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.
why is this a ValueError when DatetimeArray._from_sequence(arr) is a TypeError? Is is also worth considering making error messages consistent?
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.
originally i made it type error, then changed for consistenty with... something, but i dont remember what. will try to figure that out and report bakc
looks fine. need a whatsnew as a bug fix for pd.to_datetime erroneously accepting bools |
try: | ||
arg, _ = maybe_convert_dtype(arg, copy=False) | ||
except TypeError: | ||
if errors == "coerce": |
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.
actually do we have coverage for all of these paths? i seem to recall we using similar code elsewhere?
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 have tests in tests.tools.test_to_datetime that hit all of these cases
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.
kk
also maybe able to de-duplicate some of this code
can you rebase your PRs again, now that azure if running. (likely not a big deal, but just to make sure) |
thanks |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Identified when making the change this makes in Series.