88
99from pandas ._config import get_option
1010
11- from pandas ._libs import NaT , Timedelta , Timestamp , iNaT , lib
11+ from pandas ._libs import NaT , Timedelta , iNaT , lib
1212from pandas ._typing import ArrayLike , Dtype , DtypeObj , F , Scalar
1313from pandas .compat ._optional import import_optional_dependency
1414
@@ -330,7 +330,7 @@ def _na_ok_dtype(dtype: DtypeObj) -> bool:
330330 return not issubclass (dtype .type , np .integer )
331331
332332
333- def _wrap_results (result , dtype : DtypeObj , fill_value = None ):
333+ def _wrap_results (result , dtype : np . dtype , fill_value = None ):
334334 """ wrap our results if needed """
335335 if result is NaT :
336336 pass
@@ -340,15 +340,11 @@ def _wrap_results(result, dtype: DtypeObj, fill_value=None):
340340 # GH#24293
341341 fill_value = iNaT
342342 if not isinstance (result , np .ndarray ):
343- tz = getattr (dtype , "tz" , None )
344343 assert not isna (fill_value ), "Expected non-null fill_value"
345344 if result == fill_value :
346345 result = np .nan
347346
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 ):
352348 result = np .datetime64 ("NaT" , "ns" )
353349 else :
354350 result = np .int64 (result ).view ("datetime64[ns]" )
0 commit comments