diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index 49b7b1d1d3a9b..d8973dd2eb27a 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -327,6 +327,12 @@ def array_equivalent(left, right, strict_nan=False): left = left.view('i8') right = right.view('i8') + # if we have structured dtypes, compare first + if (left.dtype.type is np.void or + right.dtype.type is np.void): + if left.dtype != right.dtype: + return False + return np.array_equal(left, right) diff --git a/pandas/tests/io/test_gbq.py b/pandas/tests/io/test_gbq.py index 8f20fb2e75c8a..58a84ad4d47f8 100644 --- a/pandas/tests/io/test_gbq.py +++ b/pandas/tests/io/test_gbq.py @@ -92,7 +92,6 @@ def make_mixed_dataframe_v2(test_size): index=range(test_size)) -@pytest.mark.xfail(reason="gbq having issues") @pytest.mark.single class TestToGBQIntegrationWithServiceAccountKeyPath(object): diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 6e3e338ce3de3..a97747b93369f 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -1,5 +1,4 @@ import pytest -import sys import os import tempfile from contextlib import contextmanager @@ -16,7 +15,8 @@ date_range, timedelta_range, Index, DatetimeIndex, isna) -from pandas.compat import is_platform_windows, PY3, PY35, BytesIO, text_type +from pandas.compat import (is_platform_windows, is_platform_little_endian, + PY3, PY35, PY36, BytesIO, text_type) from pandas.io.formats.printing import pprint_thing from pandas.core.dtypes.common import is_categorical_dtype @@ -1042,11 +1042,10 @@ def check(format, index): with catch_warnings(record=True): check('fixed', index) + @pytest.mark.skipif(not is_platform_little_endian(), + reason="reason platform is not little endian") def test_encoding(self): - if sys.byteorder != 'little': - pytest.skip('system byteorder is not little') - with ensure_clean_store(self.path) as store: df = DataFrame(dict(A='foo', B='bar'), index=range(5)) df.loc[2, 'A'] = np.nan @@ -2887,9 +2886,6 @@ def test_index_types(self): def test_timeseries_preepoch(self): - if sys.version_info[0] == 2 and sys.version_info[1] < 7: - pytest.skip("won't work on Python < 2.7") - dr = bdate_range('1/1/1940', '1/1/1960') ts = Series(np.random.randn(len(dr)), index=dr) try: @@ -4274,13 +4270,11 @@ def test_select_as_multiple(self): ['df1', 'df3'], where=['A>0', 'B>0'], selector='df1') + @pytest.mark.skipf( + LooseVersion(tables.__version__) < '3.1.0', + "tables version does not support fix for nan selection bug: GH 4858") def test_nan_selection_bug_4858(self): - # GH 4858; nan selection bug, only works for pytables >= 3.1 - if LooseVersion(tables.__version__) < '3.1.0': - pytest.skip('tables version does not support fix for nan ' - 'selection bug: GH 4858') - with ensure_clean_store(self.path) as store: df = DataFrame(dict(cols=range(6), values=range(6)), @@ -4598,11 +4592,9 @@ def test_pytables_native_read(self): d2 = store['detector/readout'] assert isinstance(d2, DataFrame) + @pytest.mark.skipif(PY35 and is_platform_windows(), + reason="native2 read fails oddly on windows / 3.5") def test_pytables_native2_read(self): - # fails on win/3.5 oddly - if PY35 and is_platform_windows(): - pytest.skip("native2 read fails oddly on windows / 3.5") - with ensure_clean_store( tm.get_data_path('legacy_hdf/pytables_native2.h5'), mode='r') as store: @@ -4690,31 +4682,6 @@ def do_copy(f, new_f=None, keys=None, finally: safe_remove(path) - def test_legacy_table_write(self): - pytest.skip("cannot write legacy tables") - - store = HDFStore(tm.get_data_path( - 'legacy_hdf/legacy_table_%s.h5' % pandas.__version__), 'a') - - df = tm.makeDataFrame() - with catch_warnings(record=True): - wp = tm.makePanel() - - index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'], - ['one', 'two', 'three']], - labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3], - [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]], - names=['foo', 'bar']) - df = DataFrame(np.random.randn(10, 3), index=index, - columns=['A', 'B', 'C']) - store.append('mi', df) - - df = DataFrame(dict(A='foo', B='bar'), index=lrange(10)) - store.append('df', df, data_columns=['B'], min_itemsize={'A': 200}) - store.append('wp', wp) - - store.close() - def test_store_datetime_fractional_secs(self): with ensure_clean_store(self.path) as store: @@ -5260,7 +5227,7 @@ def test_read_hdf_series_mode_r(self, format): result = pd.read_hdf(path, key='data', mode='r') tm.assert_series_equal(result, series) - @pytest.mark.skipif(sys.version_info < (3, 6), reason="Need python 3.6") + @pytest.mark.skipif(not PY36, reason="Need python 3.6") def test_fspath(self): with tm.ensure_clean('foo.h5') as path: with pd.HDFStore(path) as store: diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index 3694bba594adb..38625bfb29917 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -765,7 +765,7 @@ def test_duplicated_with_nas(self): 2, 4, 1, 5, 6]), np.array([1.1, 2.2, 1.1, np.nan, 3.3, 2.2, 4.4, 1.1, np.nan, 6.6]), - pytest.mark.xfail(resaon="Complex bug. GH 16399")( + pytest.mark.xfail(reason="Complex bug. GH 16399")( np.array([1 + 1j, 2 + 2j, 1 + 1j, 5 + 5j, 3 + 3j, 2 + 2j, 4 + 4j, 1 + 1j, 5 + 5j, 6 + 6j]) ),