We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb5f8cf commit b578b6fCopy full SHA for b578b6f
pandas/core/dtypes/dtypes.py
@@ -2277,6 +2277,12 @@ def name(self) -> str: # type: ignore[override]
2277
@cache_readonly
2278
def numpy_dtype(self) -> np.dtype:
2279
"""Return an instance of the related numpy dtype"""
2280
+ if pa.types.is_duration(self.pyarrow_dtype):
2281
+ # pa.duration(unit).to_pandas_dtype() returns ns units
2282
+ # regardless of the pyarrow duration units
2283
+ # This can be removed if/when pyarrow addresses it:
2284
+ # https://github.com/apache/arrow/issues/34462
2285
+ return np.dtype(f"timedelta64[{self.pyarrow_dtype.unit}]")
2286
if pa.types.is_string(self.pyarrow_dtype) or pa.types.is_large_string(
2287
self.pyarrow_dtype
2288
):
0 commit comments