|
21 | 21 | CategoricalIndex, DatetimeIndex, TimedeltaIndex,
|
22 | 22 | PeriodIndex)
|
23 | 23 | from pandas.util.testing import assert_almost_equal
|
| 24 | +from pandas.compat.numpy_compat import np_datetime64_compat |
24 | 25 |
|
25 | 26 | import pandas.core.config as cf
|
26 | 27 |
|
@@ -250,18 +251,18 @@ def test_constructor_dtypes(self):
|
250 | 251 |
|
251 | 252 | for idx in [Index(np.array([1, 2, 3], dtype=int), dtype='category'),
|
252 | 253 | Index([1, 2, 3], dtype='category'),
|
253 |
| - Index(np.array([np.datetime64('2011-01-01'), |
254 |
| - np.datetime64('2011-01-02')]), dtype='category'), |
| 254 | + Index(np.array([np_datetime64_compat('2011-01-01'), |
| 255 | + np_datetime64_compat('2011-01-02')]), dtype='category'), |
255 | 256 | Index([datetime(2011, 1, 1), datetime(2011, 1, 2)], dtype='category')]:
|
256 | 257 | self.assertIsInstance(idx, CategoricalIndex)
|
257 | 258 |
|
258 |
| - for idx in [Index(np.array([np.datetime64('2011-01-01'), |
259 |
| - np.datetime64('2011-01-02')])), |
| 259 | + for idx in [Index(np.array([np_datetime64_compat('2011-01-01'), |
| 260 | + np_datetime64_compat('2011-01-02')])), |
260 | 261 | Index([datetime(2011, 1, 1), datetime(2011, 1, 2)])]:
|
261 | 262 | self.assertIsInstance(idx, DatetimeIndex)
|
262 | 263 |
|
263 |
| - for idx in [Index(np.array([np.datetime64('2011-01-01'), |
264 |
| - np.datetime64('2011-01-02')]), dtype=object), |
| 264 | + for idx in [Index(np.array([np_datetime64_compat('2011-01-01'), |
| 265 | + np_datetime64_compat('2011-01-02')]), dtype=object), |
265 | 266 | Index([datetime(2011, 1, 1),
|
266 | 267 | datetime(2011, 1, 2)], dtype=object)]:
|
267 | 268 | self.assertNotIsInstance(idx, DatetimeIndex)
|
@@ -442,8 +443,8 @@ def test_nanosecond_index_access(self):
|
442 | 443 |
|
443 | 444 | self.assertEqual(
|
444 | 445 | first_value,
|
445 |
| - x[Timestamp(np.datetime64('2013-01-01 00:00:00.000000050+0000', |
446 |
| - 'ns'))]) |
| 446 | + x[Timestamp(np_datetime64_compat('2013-01-01 00:00:00.000000050+0000', |
| 447 | + 'ns'))]) |
447 | 448 |
|
448 | 449 | def test_comparators(self):
|
449 | 450 | index = self.dateIndex
|
|
0 commit comments