Skip to content

Commit 024a838

Browse files
CI: mypy fixup (#40370)
1 parent 3cf05ed commit 024a838

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pandas/core/internals/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ def make_block(
3939
- Block.make_block_same_class
4040
- Block.__init__
4141
"""
42-
values, dtype = extract_pandas_array(values, dtype, ndim)
42+
# error: Argument 2 to "extract_pandas_array" has incompatible type
43+
# "Union[ExtensionDtype, str, dtype[Any], Type[str], Type[float], Type[int],
44+
# Type[complex], Type[bool], Type[object], None]"; expected "Union[dtype[Any],
45+
# ExtensionDtype, None]"
46+
values, dtype = extract_pandas_array(values, dtype, ndim) # type: ignore[arg-type]
4347

4448
if klass is None:
4549
dtype = dtype or values.dtype

pandas/core/internals/blocks.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,10 +2353,15 @@ def extract_pandas_array(
23532353
"""
23542354
# For now, blocks should be backed by ndarrays when possible.
23552355
if isinstance(values, ABCPandasArray):
2356-
values = values.to_numpy()
2356+
# error: Incompatible types in assignment (expression has type "ndarray",
2357+
# variable has type "ExtensionArray")
2358+
values = values.to_numpy() # type: ignore[assignment]
23572359
if ndim and ndim > 1:
23582360
# TODO(EA2D): special case not needed with 2D EAs
2359-
values = np.atleast_2d(values)
2361+
2362+
# error: No overload variant of "atleast_2d" matches argument type
2363+
# "PandasArray"
2364+
values = np.atleast_2d(values) # type: ignore[call-overload]
23602365

23612366
if isinstance(dtype, PandasDtype):
23622367
dtype = dtype.numpy_dtype

0 commit comments

Comments
 (0)