diff --git a/ci/run_tests.sh b/ci/run_tests.sh index e6de5caf955fc..5bff8bb412947 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -24,7 +24,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then XVFB="xvfb-run " fi -PYTEST_CMD="${XVFB}pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET" +PYTEST_CMD="${XVFB}pytest -v -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET" if [[ "$PATTERN" ]]; then PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\"" diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 7494a8a54f9bb..fd123122197c5 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -513,7 +513,7 @@ def f(c, v): f = np.in1d else: - common = np.find_common_type([values.dtype, comps_array.dtype], []) + common = np.result_type(values.dtype, comps_array.dtype) values = values.astype(common, copy=False) comps_array = comps_array.astype(common, copy=False) f = htable.ismember diff --git a/pandas/core/arrays/sparse/dtype.py b/pandas/core/arrays/sparse/dtype.py index eaed6257736ba..e6591a5b7dc4f 100644 --- a/pandas/core/arrays/sparse/dtype.py +++ b/pandas/core/arrays/sparse/dtype.py @@ -413,4 +413,4 @@ def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: ) np_dtypes = [x.subtype if isinstance(x, SparseDtype) else x for x in dtypes] - return SparseDtype(np.find_common_type(np_dtypes, []), fill_value=fill_value) + return SparseDtype(np.result_type(*np_dtypes), fill_value=fill_value) diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index 02fae6a5d618b..7f82390f147ab 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -1496,7 +1496,7 @@ def find_common_type(types): if is_integer_dtype(t) or is_float_dtype(t) or is_complex_dtype(t): return np.dtype("object") - return np.find_common_type(types, []) + return np.result_type(*types) def construct_2d_arraylike_from_scalar( diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 0592db8ad608d..929175244e0aa 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -144,7 +144,7 @@ def concat_arrays(to_concat: list) -> ArrayLike: target_dtype = to_concat_no_proxy[0].dtype elif all(x.kind in ["i", "u", "b"] and isinstance(x, np.dtype) for x in dtypes): # GH#42092 - target_dtype = np.find_common_type(list(dtypes), []) + target_dtype = np.result_type(*dtypes) else: target_dtype = find_common_type([arr.dtype for arr in to_concat_no_proxy]) diff --git a/pandas/io/parsers/c_parser_wrapper.py b/pandas/io/parsers/c_parser_wrapper.py index c1f2e6ddb2388..918568b0324c6 100644 --- a/pandas/io/parsers/c_parser_wrapper.py +++ b/pandas/io/parsers/c_parser_wrapper.py @@ -364,14 +364,7 @@ def _concatenate_chunks(chunks: list[dict[int, ArrayLike]]) -> dict: # TODO: shouldn't we exclude all EA dtypes here? numpy_dtypes = {x for x in dtypes if not is_categorical_dtype(x)} if len(numpy_dtypes) > 1: - # error: Argument 1 to "find_common_type" has incompatible type - # "Set[Any]"; expected "Sequence[Union[dtype[Any], None, type, - # _SupportsDType, str, Union[Tuple[Any, int], Tuple[Any, - # Union[int, Sequence[int]]], List[Any], _DTypeDict, Tuple[Any, Any]]]]" - common_type = np.find_common_type( - numpy_dtypes, # type: ignore[arg-type] - [], - ) + common_type = np.result_type(*numpy_dtypes) if common_type == np.dtype(object): warning_columns.append(str(name)) diff --git a/pandas/tests/dtypes/cast/test_find_common_type.py b/pandas/tests/dtypes/cast/test_find_common_type.py index 8484b5525a92a..8df06a2eded14 100644 --- a/pandas/tests/dtypes/cast/test_find_common_type.py +++ b/pandas/tests/dtypes/cast/test_find_common_type.py @@ -142,8 +142,8 @@ def test_period_dtype_mismatch(dtype2): ] -@pytest.mark.parametrize("left", interval_dtypes) -@pytest.mark.parametrize("right", interval_dtypes) +@pytest.mark.parametrize("left", interval_dtypes, ids=repr) +@pytest.mark.parametrize("right", interval_dtypes, ids=repr) def test_interval_dtype(left, right): result = find_common_type([left, right]) diff --git a/pandas/tests/dtypes/test_inference.py b/pandas/tests/dtypes/test_inference.py index 50fe8379ffa06..9b50ef1ca86b2 100644 --- a/pandas/tests/dtypes/test_inference.py +++ b/pandas/tests/dtypes/test_inference.py @@ -959,9 +959,7 @@ def test_maybe_convert_objects_itemsize(self, data0, data1): data = [data0, data1] arr = np.array(data, dtype="object") - common_kind = np.find_common_type( - [type(data0), type(data1)], scalar_types=[] - ).kind + common_kind = np.result_type(type(data0), type(data1)).kind kind0 = "python" if not hasattr(data0, "dtype") else data0.dtype.kind kind1 = "python" if not hasattr(data1, "dtype") else data1.dtype.kind if kind0 != "python" and kind1 != "python":