8
8
9
9
from pandas ._config import get_option
10
10
11
- from pandas ._libs import NaT , Timedelta , Timestamp , iNaT , lib
11
+ from pandas ._libs import NaT , Timedelta , iNaT , lib
12
12
from pandas ._typing import ArrayLike , Dtype , DtypeObj , F , Scalar
13
13
from pandas .compat ._optional import import_optional_dependency
14
14
@@ -330,7 +330,7 @@ def _na_ok_dtype(dtype: DtypeObj) -> bool:
330
330
return not issubclass (dtype .type , np .integer )
331
331
332
332
333
- def _wrap_results (result , dtype : DtypeObj , fill_value = None ):
333
+ def _wrap_results (result , dtype : np . dtype , fill_value = None ):
334
334
""" wrap our results if needed """
335
335
if result is NaT :
336
336
pass
@@ -340,15 +340,11 @@ def _wrap_results(result, dtype: DtypeObj, fill_value=None):
340
340
# GH#24293
341
341
fill_value = iNaT
342
342
if not isinstance (result , np .ndarray ):
343
- tz = getattr (dtype , "tz" , None )
344
343
assert not isna (fill_value ), "Expected non-null fill_value"
345
344
if result == fill_value :
346
345
result = np .nan
347
346
348
- if tz is not None :
349
- # we get here e.g. via nanmean when we call it on a DTA[tz]
350
- result = Timestamp (result , tz = tz )
351
- elif isna (result ):
347
+ if isna (result ):
352
348
result = np .datetime64 ("NaT" , "ns" )
353
349
else :
354
350
result = np .int64 (result ).view ("datetime64[ns]" )
0 commit comments