Skip to content

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

Conversation

fjetter
Copy link
Member

@fjetter fjetter commented Sep 18, 2018

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?

@pep8speaks
Copy link

Hello @fjetter! Thanks for submitting the PR.

@jreback
Copy link
Contributor

jreback commented Sep 18, 2018

i think this is covered by #22699 already

@jreback
Copy link
Contributor

jreback commented Sep 18, 2018

cc @TomAugspurger

@TomAugspurger
Copy link
Contributor

@TomAugspurger
Copy link
Contributor

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.

@@ -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`)
Copy link
Contributor

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

@fjetter fjetter force-pushed the bugfix/issue22741/numpy_deprecation_warning branch from dece94e to 331f4f9 Compare September 18, 2018 13:22
@@ -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`)
Copy link
Member

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.

@gfyoung gfyoung added Deprecate Functionality to remove in pandas Numeric Operations Arithmetic, Comparison, and Logical operations labels Sep 21, 2018
@@ -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):
Copy link
Member

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?

@jreback
Copy link
Contributor

jreback commented Nov 23, 2018

closing as stale. if you'd like to continue, pls ping.

@jreback jreback closed this Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Numpy deprecation warning when constructing Series from numpy.datetime64 value
6 participants