Pandas version checks

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

  • [X] 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

Comment From: asishm-wk

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

Comment From: mroeschke

Yeah this behavior was deprecated and enforced in 2.0 so closing