Skip to content
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: Reintroduced #47844 #53019

Closed
2 of 3 tasks
jesusch opened this issue May 1, 2023 · 2 comments
Closed
2 of 3 tasks

BUG: Reintroduced #47844 #53019

jesusch opened this issue May 1, 2023 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@jesusch
Copy link

jesusch commented May 1, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

pandas master branch:

import pandas as pd
import numpy
>>> pd.Series(['1970-01-01', '1970-01-01', '1970-01-01'], dtype="datetime64[ns]").astype(numpy.datetime64, copy=False)
*** TypeError: Cannot cast DatetimeArray to dtype datetime64

Issue Description

Actually this is a duplicate of #47844
While I don't have the power to reopen this ticket
Yet I wanted to create visibility

Expected Behavior

>>> import pandas as pd
>>> import numpy
>>> pd.Series(['1970-01-01', '1970-01-01', '1970-01-01'], dtype="datetime64[ns]").astype(numpy.datetime64, copy=False)
0   1970-01-01
1   1970-01-01
2   1970-01-01
dtype: datetime64[ns]

Installed Versions

pandas-2.0.0

@jesusch jesusch added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 1, 2023
@asishm-wk
Copy link

This behavior was deprecated. Running this on pandas 1.5.3 gives a FutureWarning. The deprecation was enforced in 2.0

Enforced deprecation disallowing unit-less "datetime64" dtype in :meth:Series.astype and :meth:DataFrame.astype (:issue:47844)

from the 2.0 release notes - #49391

@mroeschke
Copy link
Member

Yeah this behavior was deprecated and enforced in 2.0 so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

3 participants