diff --git a/pandas/core/internals/api.py b/pandas/core/internals/api.py index e6ea2c642650d..be0828f5303b8 100644 --- a/pandas/core/internals/api.py +++ b/pandas/core/internals/api.py @@ -39,7 +39,11 @@ def make_block( - Block.make_block_same_class - Block.__init__ """ - values, dtype = extract_pandas_array(values, dtype, ndim) + # error: Argument 2 to "extract_pandas_array" has incompatible type + # "Union[ExtensionDtype, str, dtype[Any], Type[str], Type[float], Type[int], + # Type[complex], Type[bool], Type[object], None]"; expected "Union[dtype[Any], + # ExtensionDtype, None]" + values, dtype = extract_pandas_array(values, dtype, ndim) # type: ignore[arg-type] if klass is None: dtype = dtype or values.dtype diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 3d2279f0b309b..ab23c67b52bcd 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -2353,10 +2353,15 @@ def extract_pandas_array( """ # For now, blocks should be backed by ndarrays when possible. if isinstance(values, ABCPandasArray): - values = values.to_numpy() + # error: Incompatible types in assignment (expression has type "ndarray", + # variable has type "ExtensionArray") + values = values.to_numpy() # type: ignore[assignment] if ndim and ndim > 1: # TODO(EA2D): special case not needed with 2D EAs - values = np.atleast_2d(values) + + # error: No overload variant of "atleast_2d" matches argument type + # "PandasArray" + values = np.atleast_2d(values) # type: ignore[call-overload] if isinstance(dtype, PandasDtype): dtype = dtype.numpy_dtype