-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
modified changes for datetime and NaT Objects Behavior closes #43280 #43289
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
Hello @Navaneethan2503! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-08-31 14:28:48 UTC |
Hi @Navaneethan2503, thank you for this PR. I think that this solves the problem for >>> import pandas as pd
>>> from datetime import datetime
>>> pd.to_numeric(pd.Series(datetime(2021,8,22)), errors="coerce")
0 20210822
dtype: int64
>>> pd.to_numeric(datetime(2021,8,22), errors="coerce")
nan Additionally, I am not sure that the idea is to change the current behavior of datetime series for a new one. Instead, the idea should be to apply the current behavior to scalar arguments. |
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.
Good approach @Navaneethan2503
I thing all scalar argument are passed , my suggestion idea is good because datatime behaviour are all type passed |
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.
always always start with tests that fail w/o the change and pass with
Final PR pass all scalar arguments including datetime and NaT DataType , make it merge |
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 think the expected behavior is still being discussed? This is breaking tests.
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.
you have requested review but I see no changes since the previous review and ci is failing?
also can you move the tests from the docstring to pandas/tests and add a release note
@@ -267,7 +267,7 @@ Datetimelike | |||
^^^^^^^^^^^^ | |||
- Bug in :class:`DataFrame` constructor unnecessarily copying non-datetimelike 2D object arrays (:issue:`39272`) | |||
- :func:`to_datetime` would silently swap ``MM/DD/YYYY`` and ``DD/MM/YYYY`` formats if the given ``dayfirst`` option could not be respected - now, a warning is raised in the case of delimited date strings (e.g. ``31-12-2012``) (:issue:`12585`) | |||
- | |||
-Bug in :class:'Series and scalar' to_numeric as inconsistent behaviour for datatime object (:issue:'43280') |
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.
you can build the release notes and check the output https://pandas.pydata.org/pandas-docs/dev/development/contributing_documentation.html#building-the-documentation
Thanks for the PR but it appears this is a duplicate of #43315 which is a little further along. Closing as a duplicate but happy to have you work on other issues with a |
pd.to_numeric
has an inconsistent behavior fordatetime
objects #43280**Modified datatime object 👍 **
i have changed view values to numeric of date and missing data found in pd series is returns Nan when coerce errors .
**Example for solved changes 💯 **