diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 2ac9b9e2c875c..ab62abe3bfeff 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -12,6 +12,7 @@ import warnings from pandas._typing import F +from pandas.compat.numpy import is_numpy_dev PY38 = sys.version_info >= (3, 8) PY39 = sys.version_info >= (3, 9) @@ -118,3 +119,8 @@ def get_lzma_file(lzma): "might be required to solve this issue." ) return lzma.LZMAFile + + +__all__ = [ + "is_numpy_dev", +] diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index 46db9100b8b93..353062abec974 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -3,6 +3,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.common import is_list_like import pandas as pd @@ -252,6 +254,7 @@ def test_compare_length_mismatch_errors(self, op, other_constructor, length): with pytest.raises(ValueError, match="Lengths must match to compare"): op(array, other) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") @pytest.mark.parametrize( "constructor, expected_type, assert_func", [ diff --git a/pandas/tests/base/test_misc.py b/pandas/tests/base/test_misc.py index d02078814f60f..9391aae639a4c 100644 --- a/pandas/tests/base/test_misc.py +++ b/pandas/tests/base/test_misc.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from pandas.compat import IS64, PYPY +from pandas.compat import IS64, PYPY, is_numpy_dev from pandas.core.dtypes.common import is_categorical_dtype, is_object_dtype @@ -116,6 +116,9 @@ def test_searchsorted(index_or_series_obj): # See gh-14833 pytest.skip("np.searchsorted doesn't work on pd.MultiIndex") + if is_object_dtype(obj) and is_numpy_dev: + pytest.skip("GH#39089 Numpy changed dtype inference") + max_obj = max(obj, default=0) index = np.searchsorted(obj, max_obj) assert 0 <= index <= len(obj) diff --git a/pandas/tests/extension/base/methods.py b/pandas/tests/extension/base/methods.py index 472e783c977f0..bfca150f01c34 100644 --- a/pandas/tests/extension/base/methods.py +++ b/pandas/tests/extension/base/methods.py @@ -3,6 +3,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.common import is_bool_dtype import pandas as pd @@ -392,6 +394,9 @@ def test_hash_pandas_object_works(self, data, as_frame): b = pd.util.hash_pandas_object(data) self.assert_equal(a, b) + @pytest.mark.xfail( + is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False + ) def test_searchsorted(self, data_for_sorting, as_series): b, c, a = data_for_sorting arr = type(data_for_sorting)._from_sequence([a, b, c]) diff --git a/pandas/tests/frame/apply/test_frame_apply.py b/pandas/tests/frame/apply/test_frame_apply.py index 9ec56c3429b22..9e5d1dcdea85c 100644 --- a/pandas/tests/frame/apply/test_frame_apply.py +++ b/pandas/tests/frame/apply/test_frame_apply.py @@ -5,6 +5,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd @@ -582,6 +584,7 @@ def test_apply_dict(self): tm.assert_frame_equal(reduce_false, df) tm.assert_series_equal(reduce_none, dicts) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_applymap(self, float_frame): applied = float_frame.applymap(lambda x: x * 2) tm.assert_frame_equal(applied, float_frame * 2) diff --git a/pandas/tests/frame/indexing/test_indexing.py b/pandas/tests/frame/indexing/test_indexing.py index 3b1a8ebcb13d0..6a16b93c8da2f 100644 --- a/pandas/tests/frame/indexing/test_indexing.py +++ b/pandas/tests/frame/indexing/test_indexing.py @@ -5,6 +5,7 @@ import pytest from pandas._libs import iNaT +from pandas.compat import is_numpy_dev from pandas.core.dtypes.common import is_integer @@ -254,6 +255,8 @@ def inc(x): ) def test_setitem_same_column(self, cols, values, expected): # GH 23239 + if cols == ["C", "D", "D", "a"] and is_numpy_dev: + pytest.skip("GH#39089 Numpy changed dtype inference") df = DataFrame([values], columns=cols) df["a"] = df["a"] result = df["a"].values[0] diff --git a/pandas/tests/frame/methods/test_drop.py b/pandas/tests/frame/methods/test_drop.py index 747ee25e97331..58e1bd146191f 100644 --- a/pandas/tests/frame/methods/test_drop.py +++ b/pandas/tests/frame/methods/test_drop.py @@ -3,6 +3,7 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev from pandas.errors import PerformanceWarning import pandas as pd @@ -107,6 +108,7 @@ def test_drop_names(self): expected = Index(["a", "b", "c"], name="first") tm.assert_index_equal(dropped.index, expected) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_drop(self): simple = DataFrame({"A": [1, 2, 3, 4], "B": [0, 1, 2, 3]}) tm.assert_frame_equal(simple.drop("A", axis=1), simple[["B"]]) diff --git a/pandas/tests/frame/methods/test_isin.py b/pandas/tests/frame/methods/test_isin.py index 5e50e63016f26..985ebd168461e 100644 --- a/pandas/tests/frame/methods/test_isin.py +++ b/pandas/tests/frame/methods/test_isin.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, MultiIndex, Series import pandas._testing as tm @@ -32,6 +34,7 @@ def test_isin_empty(self, empty): result = df.isin(empty) tm.assert_frame_equal(result, expected) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_isin_dict(self): df = DataFrame({"A": ["a", "b", "c"], "B": ["a", "e", "f"]}) d = {"A": ["a"]} diff --git a/pandas/tests/frame/methods/test_replace.py b/pandas/tests/frame/methods/test_replace.py index 1b570028964df..a5c9cbdd388a7 100644 --- a/pandas/tests/frame/methods/test_replace.py +++ b/pandas/tests/frame/methods/test_replace.py @@ -6,6 +6,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, date_range import pandas._testing as tm @@ -1508,6 +1510,7 @@ def test_replace_no_replacement_dtypes(self, dtype, value): result = df.replace(to_replace=[None, -np.inf, np.inf], value=value) tm.assert_frame_equal(result, df) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") @pytest.mark.parametrize("replacement", [np.nan, 5]) def test_replace_with_duplicate_columns(self, replacement): # GH 24798 diff --git a/pandas/tests/frame/methods/test_to_csv.py b/pandas/tests/frame/methods/test_to_csv.py index 4cf0b1febf0af..e76b9c5d773ad 100644 --- a/pandas/tests/frame/methods/test_to_csv.py +++ b/pandas/tests/frame/methods/test_to_csv.py @@ -5,6 +5,7 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev from pandas.errors import ParserError import pandas as pd @@ -181,6 +182,7 @@ def test_to_csv_cols_reordering(self): tm.assert_frame_equal(df[cols], rs_c, check_names=False) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_to_csv_new_dupe_cols(self): import pandas as pd diff --git a/pandas/tests/frame/test_nonunique_indexes.py b/pandas/tests/frame/test_nonunique_indexes.py index 8dcf6f2188058..bbcfd8b1aea1b 100644 --- a/pandas/tests/frame/test_nonunique_indexes.py +++ b/pandas/tests/frame/test_nonunique_indexes.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, MultiIndex, Series, date_range import pandas._testing as tm @@ -14,6 +16,7 @@ def check(result, expected=None): class TestDataFrameNonuniqueIndexes: + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_column_dups_operations(self): # assignment @@ -310,6 +313,7 @@ def test_column_dups2(self): result = df.dropna(subset=["A", "C"], how="all") tm.assert_frame_equal(result, expected) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_getitem_boolean_series_with_duplicate_columns(self): # boolean indexing # GH 4879 @@ -337,6 +341,7 @@ def test_getitem_boolean_frame_with_duplicate_columns(self): result = df[df > 6] check(result, expected) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_getitem_boolean_frame_unaligned_with_duplicate_columns(self): # `df.A > 6` is a DataFrame with a different shape from df dups = ["A", "A", "C", "D"] diff --git a/pandas/tests/groupby/test_function.py b/pandas/tests/groupby/test_function.py index 8d7fcbfcfe694..00467af83c59c 100644 --- a/pandas/tests/groupby/test_function.py +++ b/pandas/tests/groupby/test_function.py @@ -4,6 +4,7 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev from pandas.errors import UnsupportedFunctionCall import pandas as pd @@ -1004,6 +1005,7 @@ def test_frame_describe_unstacked_format(): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") @pytest.mark.filterwarnings( "ignore:" "indexing past lexsort depth may impact performance:" diff --git a/pandas/tests/groupby/test_quantile.py b/pandas/tests/groupby/test_quantile.py index c8d6d09577c2b..ad32956b6053a 100644 --- a/pandas/tests/groupby/test_quantile.py +++ b/pandas/tests/groupby/test_quantile.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, Index import pandas._testing as tm @@ -71,6 +73,7 @@ def test_quantile_array(): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_quantile_array2(): # https://github.com/pandas-dev/pandas/pull/28085#issuecomment-524066959 df = DataFrame( @@ -106,6 +109,7 @@ def test_quantile_array_no_sort(): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_quantile_array_multiple_levels(): df = DataFrame( {"A": [0, 1, 2], "B": [3, 4, 5], "c": ["a", "a", "a"], "d": ["a", "a", "b"]} @@ -216,6 +220,8 @@ def test_quantile_missing_group_values_correct_results( @pytest.mark.parametrize("q", [0.5, [0.0, 0.5, 1.0]]) def test_groupby_quantile_nullable_array(values, q): # https://github.com/pandas-dev/pandas/issues/33136 + if isinstance(q, list): + pytest.skip("GH#39089 Numpy changed dtype inference") df = DataFrame({"a": ["x"] * 3 + ["y"] * 3, "b": values}) result = df.groupby("a")["b"].quantile(q) @@ -256,6 +262,7 @@ def test_groupby_timedelta_quantile(): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_columns_groupby_quantile(): # GH 33795 df = DataFrame( diff --git a/pandas/tests/indexes/base_class/test_indexing.py b/pandas/tests/indexes/base_class/test_indexing.py index fd04a820037b9..1c38903631724 100644 --- a/pandas/tests/indexes/base_class/test_indexing.py +++ b/pandas/tests/indexes/base_class/test_indexing.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas import Index import pandas._testing as tm @@ -13,6 +15,7 @@ def test_get_slice_bounds_within(self, kind, side, expected): result = index.get_slice_bound("e", kind=kind, side=side) assert result == expected + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") @pytest.mark.parametrize("kind", ["getitem", "loc", None]) @pytest.mark.parametrize("side", ["left", "right"]) @pytest.mark.parametrize( diff --git a/pandas/tests/indexes/base_class/test_where.py b/pandas/tests/indexes/base_class/test_where.py index 0c8969735e14e..76bc3fbfc5b81 100644 --- a/pandas/tests/indexes/base_class/test_where.py +++ b/pandas/tests/indexes/base_class/test_where.py @@ -1,10 +1,14 @@ import numpy as np +import pytest + +from pandas.compat import is_numpy_dev from pandas import Index import pandas._testing as tm class TestWhere: + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_where_intlike_str_doesnt_cast_ints(self): idx = Index(range(3)) mask = np.array([True, False, True]) diff --git a/pandas/tests/indexes/categorical/test_indexing.py b/pandas/tests/indexes/categorical/test_indexing.py index 13e622a61b4bd..06cbcd3857c75 100644 --- a/pandas/tests/indexes/categorical/test_indexing.py +++ b/pandas/tests/indexes/categorical/test_indexing.py @@ -1,6 +1,7 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev from pandas.errors import InvalidIndexError import pandas as pd @@ -129,6 +130,7 @@ def test_take_invalid_kwargs(self): class TestGetLoc: + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_get_loc(self): # GH 12531 cidx1 = CategoricalIndex(list("abcde"), categories=list("edabc")) diff --git a/pandas/tests/indexes/interval/test_interval.py b/pandas/tests/indexes/interval/test_interval.py index 02ef3cb0e2afb..51bbf6c6cca2e 100644 --- a/pandas/tests/indexes/interval/test_interval.py +++ b/pandas/tests/indexes/interval/test_interval.py @@ -4,6 +4,7 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev from pandas.errors import InvalidIndexError import pandas as pd @@ -916,6 +917,9 @@ def test_searchsorted_different_argument_classes(klass): tm.assert_numpy_array_equal(result, expected) +@pytest.mark.xfail( + is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False +) @pytest.mark.parametrize( "arg", [[1, 2], ["a", "b"], [Timestamp("2020-01-01", tz="Europe/London")] * 2] ) diff --git a/pandas/tests/indexes/period/test_constructors.py b/pandas/tests/indexes/period/test_constructors.py index 75c8c766b0e67..fee7d57a76f97 100644 --- a/pandas/tests/indexes/period/test_constructors.py +++ b/pandas/tests/indexes/period/test_constructors.py @@ -2,6 +2,7 @@ import pytest from pandas._libs.tslibs.period import IncompatibleFrequency +from pandas.compat import is_numpy_dev from pandas.core.dtypes.dtypes import PeriodDtype @@ -304,6 +305,7 @@ def test_constructor_incompat_freq(self): ) ) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_constructor_mixed(self): idx = PeriodIndex(["2011-01", NaT, Period("2011-01", freq="M")]) exp = PeriodIndex(["2011-01", "NaT", "2011-01"], freq="M") diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 1eca7f7a5d261..c635eb583f3b9 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -9,7 +9,7 @@ import pytest from pandas._libs.tslib import Timestamp -from pandas.compat import IS64 +from pandas.compat import IS64, is_numpy_dev from pandas.compat.numpy import np_datetime64_compat from pandas.util._test_decorators import async_mark @@ -1358,6 +1358,7 @@ def test_slice_float_locs(self, dtype): assert index2.slice_locs(8.5, 1.5) == (2, 6) assert index2.slice_locs(10.5, -1) == (0, n) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_slice_locs_dup(self): index = Index(["a", "a", "b", "c", "d", "d"]) assert index.slice_locs("a", "d") == (0, 6) @@ -1397,6 +1398,9 @@ def test_slice_locs_na_raises(self): with pytest.raises(KeyError, match=""): index.slice_locs(end=1.5) + @pytest.mark.xfail( + is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False + ) @pytest.mark.parametrize( "in_slice,expected", [ diff --git a/pandas/tests/indexes/test_engines.py b/pandas/tests/indexes/test_engines.py index 9ea70a457e516..97a5e0a7bd291 100644 --- a/pandas/tests/indexes/test_engines.py +++ b/pandas/tests/indexes/test_engines.py @@ -4,6 +4,7 @@ import pytest from pandas._libs import algos as libalgos, index as libindex +from pandas.compat import is_numpy_dev import pandas as pd import pandas._testing as tm @@ -198,6 +199,7 @@ def test_is_unique(self): engine = self.engine_type(lambda: arr, len(arr)) assert engine.is_unique is False + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_get_loc(self): # unique arr = np.array(self.values, dtype=self.dtype) diff --git a/pandas/tests/indexes/timedeltas/test_delete.py b/pandas/tests/indexes/timedeltas/test_delete.py index 63f2b450aa818..77223348951f7 100644 --- a/pandas/tests/indexes/timedeltas/test_delete.py +++ b/pandas/tests/indexes/timedeltas/test_delete.py @@ -1,3 +1,7 @@ +import pytest + +from pandas.compat import is_numpy_dev + from pandas import TimedeltaIndex, timedelta_range import pandas._testing as tm @@ -60,6 +64,7 @@ def test_delete_slice(self): assert result.name == expected.name assert result.freq == expected.freq + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_delete_doesnt_infer_freq(self): # GH#30655 behavior matches DatetimeIndex diff --git a/pandas/tests/indexing/multiindex/test_getitem.py b/pandas/tests/indexing/multiindex/test_getitem.py index 6c0d1c285acf3..0ad9f947d2039 100644 --- a/pandas/tests/indexing/multiindex/test_getitem.py +++ b/pandas/tests/indexing/multiindex/test_getitem.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas import DataFrame, Index, MultiIndex, Series import pandas._testing as tm from pandas.core.indexing import IndexingError @@ -261,6 +263,7 @@ def test_frame_mi_access(dataframe_with_duplicate_index, indexer): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_frame_mi_access_returns_series(dataframe_with_duplicate_index): # GH 4146, not returning a block manager when selecting a unique index # from a duplicate index @@ -272,6 +275,7 @@ def test_frame_mi_access_returns_series(dataframe_with_duplicate_index): tm.assert_series_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_frame_mi_access_returns_frame(dataframe_with_duplicate_index): # selecting a non_unique from the 2nd level df = dataframe_with_duplicate_index diff --git a/pandas/tests/indexing/multiindex/test_loc.py b/pandas/tests/indexing/multiindex/test_loc.py index 37153bef8d77b..ba01caba544f4 100644 --- a/pandas/tests/indexing/multiindex/test_loc.py +++ b/pandas/tests/indexing/multiindex/test_loc.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series import pandas._testing as tm @@ -144,6 +146,7 @@ def test_loc_multiindex_list_missing_label(self, key, pos): with pytest.raises(KeyError, match="not in index"): df.loc[key] + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_loc_multiindex_too_many_dims_raises(self): # GH 14885 s = Series( diff --git a/pandas/tests/indexing/multiindex/test_partial.py b/pandas/tests/indexing/multiindex/test_partial.py index c203d986efd23..79a0d1125a4a3 100644 --- a/pandas/tests/indexing/multiindex/test_partial.py +++ b/pandas/tests/indexing/multiindex/test_partial.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas import ( DataFrame, Float64Index, @@ -96,6 +98,7 @@ def test_fancy_slice_partial( expected = ymd[(lev >= 1) & (lev <= 3)] tm.assert_frame_equal(result, expected) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_getitem_partial_column_select(self): idx = MultiIndex( codes=[[0, 0, 0], [0, 1, 1], [1, 0, 1]], diff --git a/pandas/tests/indexing/test_chaining_and_caching.py b/pandas/tests/indexing/test_chaining_and_caching.py index 90fa6e94d1bc8..0047b396c68b0 100644 --- a/pandas/tests/indexing/test_chaining_and_caching.py +++ b/pandas/tests/indexing/test_chaining_and_caching.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import DataFrame, Series, Timestamp, date_range, option_context import pandas._testing as tm @@ -347,6 +349,7 @@ def test_detect_chained_assignment_warnings_errors(self): with pytest.raises(com.SettingWithCopyError, match=msg): df.loc[0]["A"] = 111 + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_detect_chained_assignment_warnings_filter_and_dupe_cols(self): # xref gh-13017. with option_context("chained_assignment", "warn"): diff --git a/pandas/tests/indexing/test_scalar.py b/pandas/tests/indexing/test_scalar.py index ce48fd1e5c905..60b199ff5f616 100644 --- a/pandas/tests/indexing/test_scalar.py +++ b/pandas/tests/indexing/test_scalar.py @@ -4,6 +4,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas import DataFrame, Series, Timedelta, Timestamp, date_range import pandas._testing as tm from pandas.tests.indexing.common import Base @@ -128,6 +130,7 @@ def test_imethods_with_dups(self): result = df.iat[2, 0] assert result == 2 + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_frame_at_with_duplicate_axes(self): # GH#33041 arr = np.random.randn(6).reshape(3, 2) diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index da3ac81c4aa17..100705cc5bd9c 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -5,6 +5,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.common import is_categorical_dtype, is_object_dtype from pandas.core.dtypes.dtypes import CategoricalDtype @@ -2037,6 +2039,7 @@ def test_merge_suffix(col1, col2, kwargs, expected_cols): tm.assert_frame_equal(result, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") @pytest.mark.parametrize( "how,expected", [ diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 5dc0c40ef42dd..055117680c8b9 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -6,7 +6,7 @@ import pytz from pandas._libs.tslibs import iNaT -import pandas.compat as compat +from pandas.compat import PY38, is_numpy_dev from pandas.core.dtypes.common import is_datetime64_any_dtype @@ -59,6 +59,7 @@ def test_nat_fields(nat, idx): assert result is False +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_nat_vector_field_access(): idx = DatetimeIndex(["1/1/2000", None, None, "1/4/2000"]) @@ -134,7 +135,7 @@ def test_round_nat(klass, method, freq): pytest.param( "fromisocalendar", marks=pytest.mark.skipif( - not compat.PY38, + not PY38, reason="'fromisocalendar' was added in stdlib datetime in python 3.8", ), ), @@ -310,7 +311,7 @@ def test_overlap_public_nat_methods(klass, expected): # is considered to be with Timestamp and NaT, not Timedelta. # "fromisocalendar" was introduced in 3.8 - if klass is Timestamp and not compat.PY38: + if klass is Timestamp and not PY38: expected.remove("fromisocalendar") assert _get_overlap_public_nat_methods(klass) == expected diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py index dbc751dd614a1..43b66c0d55dc1 100644 --- a/pandas/tests/series/indexing/test_indexing.py +++ b/pandas/tests/series/indexing/test_indexing.py @@ -5,6 +5,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.common import is_scalar import pandas as pd @@ -225,6 +227,7 @@ def test_getitem_dups_with_missing(): s[["foo", "bar", "bah", "bam"]] +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_getitem_dups(): s = Series(range(5), index=["A", "A", "B", "C", "C"], dtype=np.int64) expected = Series([3, 4], index=["C", "C"], dtype=np.int64) diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index edcec386cd8ba..aee1874f41ebb 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + from pandas.core.dtypes.common import is_integer import pandas as pd @@ -347,6 +349,7 @@ def test_where_dups(): tm.assert_series_equal(comb, expected) +@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_where_numeric_with_string(): # GH 9280 s = Series([1, 2, 3]) diff --git a/pandas/tests/series/methods/test_clip.py b/pandas/tests/series/methods/test_clip.py index 5a5a397222b87..8e04b331d0066 100644 --- a/pandas/tests/series/methods/test_clip.py +++ b/pandas/tests/series/methods/test_clip.py @@ -1,6 +1,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd from pandas import Series, Timestamp, isna, notna import pandas._testing as tm @@ -18,6 +20,7 @@ def test_clip(self, datetime_series): tm.assert_series_equal(result, expected) assert isinstance(expected, Series) + @pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference") def test_clip_types_and_nulls(self): sers = [