Skip to content

Commit af7605d

Browse files
committed
one more
1 parent e50e694 commit af7605d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pandas/core/dtypes/cast.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,7 @@ def maybe_cast_to_datetime(
11951195

11961196
# TODO: _from_sequence would raise ValueError in cases where
11971197
# _ensure_nanosecond_dtype raises TypeError
1198-
# Incompatible types in assignment (expression has type "Union[dtype[Any],
1199-
# ExtensionDtype]", variable has type "Optional[dtype[Any]]")
1200-
dtype = _ensure_nanosecond_dtype(dtype) # type: ignore[assignment]
1198+
_ensure_nanosecond_dtype(dtype)
12011199

12021200
if is_timedelta64_dtype(dtype):
12031201
res = TimedeltaArray._from_sequence(value, dtype=dtype)
@@ -1235,12 +1233,11 @@ def sanitize_to_nanoseconds(values: np.ndarray, copy: bool = False) -> np.ndarra
12351233
return values
12361234

12371235

1238-
def _ensure_nanosecond_dtype(dtype: DtypeObj) -> DtypeObj:
1236+
def _ensure_nanosecond_dtype(dtype: DtypeObj) -> None:
12391237
"""
12401238
Convert dtypes with granularity less than nanosecond to nanosecond
12411239
12421240
>>> _ensure_nanosecond_dtype(np.dtype("M8[us]"))
1243-
dtype('<M8[us]')
12441241
12451242
>>> _ensure_nanosecond_dtype(np.dtype("M8[D]"))
12461243
Traceback (most recent call last):
@@ -1277,7 +1274,6 @@ def _ensure_nanosecond_dtype(dtype: DtypeObj) -> DtypeObj:
12771274
f"dtype={dtype} is not supported. Supported resolutions are 's', "
12781275
"'ms', 'us', and 'ns'"
12791276
)
1280-
return dtype
12811277

12821278

12831279
# TODO: other value-dependent functions to standardize here include

0 commit comments

Comments
 (0)