-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
0.24.0rc1: infer_dtype(DatetimeIndex) returns "datetime64" not "datetime64[ns]" #24739
Comments
these are not designed to be dtypes, rather a type indication of what’s actually inside a non strongly typed array (object); so this is correct |
The behaviour of We should maybe deprecate that first instead of directly raising an error. |
So to clarify, we actually deprecated that before for Series, but appararently we did not do that for Index: On 0.23.4:
|
OK. pyarrow stops using |
@jorisvandenbossche based on your post in IMO, we should ensure that |
This deprecates passing dtypes without a precision to DatetimeIndex and TimedeltaIndex ```python In [2]: pd.DatetimeIndex(['2000'], dtype='datetime64') /Users/taugspurger/.virtualenvs/pandas-dev/bin/ipython:1: FutureWarning: Passing in 'datetime64' dtype with no precision is deprecated and will raise in a future version. Please pass in 'datetime64[ns]' instead. #!/Users/taugspurger/Envs/pandas-dev/bin/python3 Out[2]: DatetimeIndex(['2000-01-01'], dtype='datetime64[ns]', freq=None) ``` Previously, we ignored the precision, so that things like ``` In [3]: pd.DatetimeIndex(['2000'], dtype='datetime64[us]') Out[3]: DatetimeIndex(['2000-01-01'], dtype='datetime64[ns]', freq=None) ``` worked. That is deprecated as well. Closes pandas-dev#24739 Closes pandas-dev#24753
Code Sample, a copy-pastable example if possible
Problem description
We can't use dtype inferred from
DatetimeIndex
to convert anIndex
toDatetimeIndex
with pandas 0.24.0rc1.pyarrow uses this logic to convert Arrow objects to pandas objects.
FYI: Here are related codes:
FYI: Here is an error in pyarrow test: https://travis-ci.org/kszucs/crossbow/builds/478558634#L2724-L2788
#24478 introduces a validation for
datetime64
. Butpd.api.types.infer_dtype
still returns'datetime64'
forDatetimeIndex
.The following change fixes this problem. But I'm not sure whether this is a regression or pyarrow's use case is wrong.
Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: