diff --git a/pandas/tseries/tests/test_converter.py b/pandas/tseries/tests/test_converter.py index 37d9c35639c32..1317f8e977234 100644 --- a/pandas/tseries/tests/test_converter.py +++ b/pandas/tseries/tests/test_converter.py @@ -3,7 +3,7 @@ import nose import numpy as np -from pandas import Timestamp, Period +from pandas import Timestamp, Period, Index from pandas.compat import u import pandas.util.testing as tm from pandas.tseries.offsets import Second, Milli, Micro @@ -104,7 +104,7 @@ def test_dateindex_conversion(self): for freq in ('B', 'L', 'S'): dateindex = tm.makeDateIndex(k=10, freq=freq) rs = self.dtc.convert(dateindex, None, None) - xp = converter.dates.date2num(dateindex._mpl_repr()) + xp = Index(converter.dates.date2num(dateindex._mpl_repr())) tm.assert_almost_equal(rs, xp, decimals) def test_resolution(self): diff --git a/pandas/tseries/tests/test_period.py b/pandas/tseries/tests/test_period.py index fe0d28dd9c508..dae1554c0930e 100644 --- a/pandas/tseries/tests/test_period.py +++ b/pandas/tseries/tests/test_period.py @@ -3521,8 +3521,8 @@ def test_map(self): tm.assert_index_equal(result, expected) result = index.map(lambda x: x.ordinal) - exp = np.array([x.ordinal for x in index], dtype=np.int64) - tm.assert_numpy_array_equal(result, exp) + exp = Index([x.ordinal for x in index]) + tm.assert_index_equal(result, exp) def test_map_with_string_constructor(self): raw = [2005, 2007, 2009] @@ -3534,20 +3534,17 @@ def test_map_with_string_constructor(self): types += text_type, for t in types: - expected = np.array(lmap(t, raw), dtype=object) + expected = Index(lmap(t, raw)) res = index.map(t) - # should return an array - tm.assertIsInstance(res, np.ndarray) + # should return an Index + tm.assertIsInstance(res, Index) # preserve element types self.assertTrue(all(isinstance(resi, t) for resi in res)) - # dtype should be object - self.assertEqual(res.dtype, np.dtype('object').type) - # lastly, values should compare equal - tm.assert_numpy_array_equal(res, expected) + tm.assert_index_equal(res, expected) def test_convert_array_of_periods(self): rng = period_range('1/1/2000', periods=20, freq='D') diff --git a/pandas/tseries/tests/test_timedeltas.py b/pandas/tseries/tests/test_timedeltas.py index f0d14014d6559..d1e5379071b26 100644 --- a/pandas/tseries/tests/test_timedeltas.py +++ b/pandas/tseries/tests/test_timedeltas.py @@ -1513,8 +1513,8 @@ def test_map(self): f = lambda x: x.days result = rng.map(f) - exp = np.array([f(x) for x in rng], dtype=np.int64) - self.assert_numpy_array_equal(result, exp) + exp = Int64Index([f(x) for x in rng]) + self.assert_index_equal(result, exp) def test_misc_coverage(self): diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py index beacc21912edc..9aec391b33d9d 100644 --- a/pandas/tseries/tests/test_timeseries.py +++ b/pandas/tseries/tests/test_timeseries.py @@ -3003,8 +3003,8 @@ def test_map(self): f = lambda x: x.strftime('%Y%m%d') result = rng.map(f) - exp = np.array([f(x) for x in rng], dtype='=U8') - tm.assert_almost_equal(result, exp) + exp = Index([f(x) for x in rng], dtype='