def test_ndarray_compat(self):

        # test numpy compat with Series as sub-class of NDFrame
        tsdf = DataFrame(np.random.randn(1000, 3), columns=['A', 'B', 'C'],
                         index=date_range('1/1/2000', periods=1000))

        def f(x):
            return x[x.argmax()]

        result = tsdf.apply(f)
        expected = tsdf.max()
        assert_series_equal(result, expected)

        # .item()
        s = Series([1])
        result = s.item()
        self.assertEqual(result, 1)
        self.assertEqual(s.item(), s.iloc[0])

        # using an ndarray like function
        s = Series(np.random.randn(10))
        result = np.ones_like(s)
        expected = Series(1, index=range(10), dtype='float64')
        # assert_series_equal(result,expected)

        # ravel
        s = Series(np.random.randn(10))
        tm.assert_almost_equal(s.ravel(order='F'), s.values.ravel(order='F'))

        # compress
        # GH 6658
        s = Series([0, 1., -1], index=list('abc'))
        result = np.compress(s > 0, s)
        assert_series_equal(result, Series([1.], index=['b']))

        result = np.compress(-1 < s, s)
        # result empty Index(dtype=object) as the same as original
        exp = Series([], dtype='float64', index=Index([], dtype='object'))
        assert_series_equal(result, exp)

        s = Series([0, 1., -1], index=[.1, .2, .3])
        result = np.compress(s > 0, s)
        assert_series_equal(result, Series([1.], index=[.2]))

        result = np.compress(s < -1, s)
        # result empty Float64Index as the same as original
        exp = Series([], dtype='float64', index=Index([], dtype='float64'))
        assert_series_equal(result, exp)
dataset/ETHPy150Open pydata/pandas/pandas/tests/series/test_misc_api.py/TestSeriesMisc.test_ndarray_compat/swapped operands of `<`