-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
BugExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsNon-Nanodatetime64/timedelta64 with non-nanosecond resolutiondatetime64/timedelta64 with non-nanosecond resolutionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
Code to reproduce:
import numpy as np
import pandas as pd
np_datetimes = np.array([datetime.date(2010, 1, 1)], dtype="datetime64[D]")
other = pd.array(["a", "b"], dtype="category")
pd.core.dtypes.concat.concat_categorical([np_datetimes, other])
# outputs:
# array([Timestamp('1970-01-01 00:00:00.000014610'), 'a', 'b'], dtype=object)
# expected either one of
# a) array([Timestamp('2010-01-01 00:00:00'), 'a', 'b'], dtype=object)
# b) array([datetime.date(2010, 1, 1), 'a', 'b'], dtype=object)
This happens as concat_datetime
/ _convert_datetimelike_to_object
assumes that datetimes are nanoseconds only.
Metadata
Metadata
Assignees
Labels
BugExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsNon-Nanodatetime64/timedelta64 with non-nanosecond resolutiondatetime64/timedelta64 with non-nanosecond resolutionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode