Skip to content

Commit 84c7a7f

Browse files
authored
Fix fill_value for timedelta, datetime (#452)
1 parent f3793b9 commit 84c7a7f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flox/xrdtypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ def _get_fill_value(dtype, fill_value):
196196
if fill_value == NA:
197197
if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating):
198198
return np.nan
199-
# This is madness, but npg checks that fill_value is compatible
200-
# with array dtype even if the fill_value is never used.
201-
elif np.issubdtype(dtype, np.integer):
202-
return get_neg_infinity(dtype, min_for_int=True)
203199
elif np.issubdtype(dtype, np.timedelta64):
204200
return np.timedelta64("NaT")
205201
elif np.issubdtype(dtype, np.datetime64):
206202
return np.datetime64("NaT")
203+
# This is madness, but npg checks that fill_value is compatible
204+
# with array dtype even if the fill_value is never used.
205+
elif np.issubdtype(dtype, np.integer):
206+
return get_neg_infinity(dtype, min_for_int=True)
207207
else:
208208
return None
209209
return fill_value

0 commit comments

Comments
 (0)