-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeTimedeltaTimedelta data typeTimedelta data type
Milestone
Description
import numpy as np
import pandas as pd
mi = pd.MultiIndex.from_product([list("ABCDE"), range(2)])
dti = pd.date_range("2016-01-01", periods=10)
ser = pd.Series(dti, index=mi)
df = ser.unstack()
index = df.index.append(pd.Index([1]))
columns = df.columns.append(pd.Index(["foo"]))
axes = {"index": index, "columns": columns}
fv = np.timedelta64("NaT", "ns")
res = df.reindex(fill_value=fv, **axes)
>>> res
>>> res
0 1 foo
A 1451606400000000000 1451692800000000000 NaT
B 1451779200000000000 1451865600000000000 NaT
C 1451952000000000000 1452038400000000000 NaT
D 1452124800000000000 1452211200000000000 NaT
E 1452297600000000000 1452384000000000000 NaT
1 NaT NaT NaT
The underlying problem here is numpy/numpy#12550
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeTimedeltaTimedelta data typeTimedelta data type