@@ -491,37 +491,23 @@ def maybe_casted_values(
491491 if codes is not None :
492492 mask : np .ndarray = codes == - 1
493493
494- # we can have situations where the whole mask is -1,
495- # meaning there is nothing found in codes, so make all nan's
496494 if mask .size > 0 and mask .all ():
495+ # we can have situations where the whole mask is -1,
496+ # meaning there is nothing found in codes, so make all nan's
497+
497498 dtype = index .dtype
498499 fill_value = na_value_for_dtype (dtype )
499500 values = construct_1d_arraylike_from_scalar (fill_value , len (mask ), dtype )
501+
500502 else :
501503 values = values .take (codes )
502504
503- # TODO(https://github.com/pandas-dev/pandas/issues/24206)
504- # Push this into maybe_upcast_putmask?
505- # We can't pass EAs there right now. Looks a bit
506- # complicated.
507- # So we unbox the ndarray_values, op, re-box.
508- values_type = type (values )
509- values_dtype = values .dtype
510-
511- from pandas .core .arrays .datetimelike import DatetimeLikeArrayMixin
512-
513- if isinstance (values , DatetimeLikeArrayMixin ):
514- values = values ._data # TODO: can we de-kludge yet?
515-
516505 if mask .any ():
517506 if isinstance (values , np .ndarray ):
518507 values , _ = maybe_upcast_putmask (values , mask , np .nan )
519508 else :
520509 values [mask ] = np .nan
521510
522- if issubclass (values_type , DatetimeLikeArrayMixin ):
523- values = values_type (values , dtype = values_dtype )
524-
525511 return values
526512
527513
0 commit comments