-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fix numpy deprecation warning for scalar datetime64 values #22742
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
BUG: fix numpy deprecation warning for scalar datetime64 values #22742
Conversation
Hello @fjetter! Thanks for submitting the PR.
|
i think this is covered by #22699 already |
#22699 is silencing it for now. https://github.com/pandas-dev/pandas/pull/22699/files#diff-3bbe4551f20de6060dce38a95d0adc80R961 is the relevant line. |
As far as testing goes, I don't think we need a new test, as this would have failed if #22699 were in already. I don't think this needs to go in 0.23.5. |
doc/source/whatsnew/v0.23.5.txt
Outdated
@@ -26,7 +26,7 @@ Fixed Regressions | |||
- Calling :meth:`DataFrameGroupBy.rank` and :meth:`SeriesGroupBy.rank` with empty groups | |||
and ``pct=True`` was raising a ``ZeroDivisionError`` due to `c1068d9 | |||
<https://github.com/pandas-dev/pandas/commit/c1068d9d242c22cb2199156f6fb82eb5759178ae>`_ (:issue:`22519`) | |||
- | |||
- Constructing a Series with a numpy.datetime64 value will no longer issue a DeprecationWarning (:issue:`22741`) |
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.
yeah pls move this to 0.24.0
dece94e
to
331f4f9
Compare
@@ -803,6 +803,7 @@ Other | |||
- Require at least 0.28.2 version of ``cython`` to support read-only memoryviews (:issue:`21688`) | |||
- :meth:`~pandas.io.formats.style.Styler.background_gradient` now also supports tablewise application (in addition to rowwise and columnwise) with ``axis=None`` (:issue:`15204`) | |||
- :meth:`~pandas.io.formats.style.Styler.bar` now also supports tablewise application (in addition to rowwise and columnwise) with ``axis=None`` and setting clipping range with ``vmin`` and ``vmax``. ``NaN`` values are also handled properly. (:issue:`21548`, :issue:`21526`) | |||
- Constructing a Series with a numpy.datetime64 value will no longer issue a DeprecationWarning (:issue:`22741`) |
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.
Double backticks on Series
, numpy.datetime64
, and DeprecationWarning
.
@@ -1042,7 +1042,7 @@ def maybe_cast_to_datetime(value, dtype, errors='raise'): | |||
"dtype [{dtype}]".format(dtype=dtype)) | |||
|
|||
if is_scalar(value): | |||
if value == iNaT or isna(value): | |||
if np.asscalar(value) == iNaT or isna(value): |
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.
Shouldn’t value already be a scalar at this point?
closing as stale. if you'd like to continue, pls ping. |
This should fix the DeprecationWarning described in #22741 . Not sure if it's worth adding a test. What's the policy on things like these?
git diff upstream/master -u -- "*.py" | flake8 --diff