From bc5a18c8088cdc3592076acc9eb7f46c0154ab1b Mon Sep 17 00:00:00 2001 From: Tim Cera Date: Tue, 25 Jun 2013 22:26:25 -0400 Subject: [PATCH 1/5] Initial implementation of calculation of astronomical Julian Date. * Added 'to_julian_date()' to Timestamp * Added 'to_julian_date()' to DatetimeIndex * Added tests for both methods. --- pandas/tseries/index.py | 10 ++++ pandas/tseries/tests/test_julian_date.py | 68 ++++++++++++++++++++++++ pandas/tslib.pyx | 8 +++ 3 files changed, 86 insertions(+) create mode 100644 pandas/tseries/tests/test_julian_date.py diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index a8dacbe40aac0..4dff181d4829b 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -1753,6 +1753,16 @@ def max(self, axis=None): max_stamp = self.asi8.max() return Timestamp(max_stamp, tz=self.tz) + def to_julian_date(self): + + # http://mysite.verizon.net/aesir_research/date/jdalg2.htm + year = self.year + month = self.month + day = self.day + testarr = month < 3 + year[testarr] -= 1 + month[testarr] += 12 + return day + np.fix((153*month - 457)/5) + 365*year + np.floor(year / 4) - np.floor(year / 100) + np.floor(year / 400) + 1721118.5 + (self.hour + self.minute/60.0 + self.second/3600.0 + self.microsecond/3600.0/1e+6 + self.nanosecond/3600.0/1e+9)/24.0 def _generate_regular_range(start, end, periods, offset): if isinstance(offset, Tick): diff --git a/pandas/tseries/tests/test_julian_date.py b/pandas/tseries/tests/test_julian_date.py new file mode 100644 index 0000000000000..befd56c0092e9 --- /dev/null +++ b/pandas/tseries/tests/test_julian_date.py @@ -0,0 +1,68 @@ +from datetime import datetime, time, timedelta, date +import sys +import os +import unittest + +import nose + +import numpy as np + +from pandas import Timestamp, date_range + +class TestToJulianDateTimestamp(unittest.TestCase): + + def test_compare_1700(self): + r1 = 2342145.5 + r2 = Timestamp('1700-06-23').to_julian_date() + assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + + def test_compare_2000(self): + r1 = 2451646.5 + r2 = Timestamp('2000-04-12').to_julian_date() + assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + + def test_compare_2100(self): + r1 = 2488292.5 + r2 = Timestamp('2100-08-12').to_julian_date() + assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + + def test_compare_hour01(self): + r1 = 2451768.5416666666666666 + r2 = Timestamp('2000-08-12T01:00:00').to_julian_date() + assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + + def test_compare_hour13(self): + r1 = 2451769.0416666666666666 + r2 = Timestamp('2000-08-12T13:00:00').to_julian_date() + assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + +class TestDateTimeIndex(unittest.TestCase): + def test_1700(self): + r1 = [2345897.5, 2345898.5, 2345899.5, 2345900.5, 2345901.5] + r2 = date_range(start=Timestamp('1710-10-01'), periods=5, freq='D').to_julian_date() + np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + + def test_2000(self): + r1 = [2451601.5, 2451602.5, 2451603.5, 2451604.5, 2451605.5] + r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='D').to_julian_date() + np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + + def test_hour(self): + r1 = [2451601.5, 2451601.5416666666666666, 2451601.5833333333333333, 2451601.625, 2451601.6666666666666666] + r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='H').to_julian_date() + np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + + def test_minute(self): + r1 = [2451601.5, 2451601.5006944444444444, 2451601.5013888888888888, 2451601.5020833333333333, 2451601.5027777777777777] + r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='T').to_julian_date() + np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + + def test_second(self): + r1 = [2451601.5, 2451601.500011574074074, 2451601.5000231481481481, 2451601.5000347222222222, 2451601.5000462962962962] + r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='S').to_julian_date() + np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + +if __name__ == '__main__': + import nose + nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], + exit=False) diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx index 57df3c6651ad4..42f2612d16253 100644 --- a/pandas/tslib.pyx +++ b/pandas/tslib.pyx @@ -384,6 +384,14 @@ class Timestamp(_Timestamp): or self.tzinfo is not None or self.nanosecond != 0) + def to_julian_date(self): + year = self.year + month = self.month + day = self.day + if month <= 2: + year -= 1 + month += 12 + return day + np.fix((153*month - 457)/5) + 365*year + np.floor(year / 4) - np.floor(year / 100) + np.floor(year / 400) + 1721118.5 + (self.hour + self.minute/60.0 + self.second/3600.0 + self.microsecond/3600.0/1e+6 + self.nanosecond/3600.0/1e+9)/24.0 _nat_strings = set(['NaT','nat','NAT','nan','NaN','NAN']) class NaTType(_NaT): From ff362c3e40ed430ae7a5c671234a158bf520d558 Mon Sep 17 00:00:00 2001 From: Tim Cera Date: Sun, 3 Nov 2013 14:57:11 -0500 Subject: [PATCH 2/5] TST: Stylistic changes to to_julian date tests. --- pandas/tseries/tests/test_julian_date.py | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pandas/tseries/tests/test_julian_date.py b/pandas/tseries/tests/test_julian_date.py index befd56c0092e9..574043298a153 100644 --- a/pandas/tseries/tests/test_julian_date.py +++ b/pandas/tseries/tests/test_julian_date.py @@ -12,55 +12,55 @@ class TestToJulianDateTimestamp(unittest.TestCase): def test_compare_1700(self): - r1 = 2342145.5 - r2 = Timestamp('1700-06-23').to_julian_date() - assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + r = Timestamp('1700-06-23').to_julian_date() + self.assertEqual(r, 2342145.5) def test_compare_2000(self): - r1 = 2451646.5 - r2 = Timestamp('2000-04-12').to_julian_date() - assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + r = Timestamp('2000-04-12').to_julian_date() + self.assertEqual(r, 2451646.5) def test_compare_2100(self): - r1 = 2488292.5 - r2 = Timestamp('2100-08-12').to_julian_date() - assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + r = Timestamp('2100-08-12').to_julian_date() + self.assertEqual(r, 2488292.5) def test_compare_hour01(self): - r1 = 2451768.5416666666666666 - r2 = Timestamp('2000-08-12T01:00:00').to_julian_date() - assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + r = Timestamp('2000-08-12T01:00:00').to_julian_date() + self.assertEqual(r, 2451768.5416666666666666) def test_compare_hour13(self): - r1 = 2451769.0416666666666666 - r2 = Timestamp('2000-08-12T13:00:00').to_julian_date() - assert(r1 == r2), "{0} is not equal to {1}".format(r1, r2) + r = Timestamp('2000-08-12T13:00:00').to_julian_date() + self.assertEqual(r, 2451769.0416666666666666) class TestDateTimeIndex(unittest.TestCase): def test_1700(self): r1 = [2345897.5, 2345898.5, 2345899.5, 2345900.5, 2345901.5] r2 = date_range(start=Timestamp('1710-10-01'), periods=5, freq='D').to_julian_date() - np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + self.assert_(isinstance(r2, np.ndarray)) + np.testing.assert_array_equal(r1, r2) def test_2000(self): r1 = [2451601.5, 2451602.5, 2451603.5, 2451604.5, 2451605.5] r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='D').to_julian_date() - np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + self.assert_(isinstance(r2, np.ndarray)) + np.testing.assert_array_equal(r1, r2) def test_hour(self): r1 = [2451601.5, 2451601.5416666666666666, 2451601.5833333333333333, 2451601.625, 2451601.6666666666666666] r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='H').to_julian_date() - np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + self.assert_(isinstance(r2, np.ndarray)) + np.testing.assert_array_equal(r1, r2) def test_minute(self): r1 = [2451601.5, 2451601.5006944444444444, 2451601.5013888888888888, 2451601.5020833333333333, 2451601.5027777777777777] r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='T').to_julian_date() - np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + self.assert_(isinstance(r2, np.ndarray)) + np.testing.assert_array_equal(r1, r2) def test_second(self): r1 = [2451601.5, 2451601.500011574074074, 2451601.5000231481481481, 2451601.5000347222222222, 2451601.5000462962962962] r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='S').to_julian_date() - np.testing.assert_array_equal(r1, r2), "{0} is not equal to {1}".format(r1, r2) + self.assert_(isinstance(r2, np.ndarray)) + np.testing.assert_array_equal(r1, r2) if __name__ == '__main__': import nose From 4864d4aebe105f3f80fc54bee2681953b9b809a8 Mon Sep 17 00:00:00 2001 From: Tim Cera Date: Sun, 23 Feb 2014 14:00:05 -0500 Subject: [PATCH 3/5] API: DatetimeIndex.to_julian_date now returns a Float64Index. TST: Moved to_julian_date tests from pandas/tseries/tests/test_julian_date.py into pandas/tseries/tests/test_timeseries.py DOC: Added mention of to_julian_date functionality to doc/source/release.rst and v0.14.0.txt --- doc/source/release.rst | 4 ++ doc/source/v0.14.0.txt | 2 + pandas/tseries/index.py | 21 +++++- pandas/tseries/tests/test_julian_date.py | 68 ------------------ pandas/tseries/tests/test_timeseries.py | 87 +++++++++++++++++++++++- 5 files changed, 111 insertions(+), 71 deletions(-) delete mode 100644 pandas/tseries/tests/test_julian_date.py diff --git a/doc/source/release.rst b/doc/source/release.rst index 7871e92b7953b..c0600c161e06e 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -55,6 +55,10 @@ New features - Hexagonal bin plots from ``DataFrame.plot`` with ``kind='hexbin'`` (:issue:`5478`) - Added the ``sym_diff`` method to ``Index`` (:issue:`5543`) +- Added ``to_julian_date`` to ``TimeStamp`` and ``DatetimeIndex``. The Julian + Date is used primarily in astronomy and represents the number of days from + noon, January 1, 4713 BC. Because nanoseconds are used to define the time + in PANDAS the actual range of dates that you can use is 1678 AD to 2262 AD. API Changes ~~~~~~~~~~~ diff --git a/doc/source/v0.14.0.txt b/doc/source/v0.14.0.txt index e914b2a4693d0..e7e7fba89a233 100644 --- a/doc/source/v0.14.0.txt +++ b/doc/source/v0.14.0.txt @@ -11,6 +11,8 @@ Highlights include: - MultIndexing Using Slicers - Joining a singly-indexed DataFrame with a multi-indexed DataFrame +- Added a ``to_julian_date`` function to ``TimeStamp`` and ``DatetimeIndex`` + to convert to the Julian Date used primarily in astronomy. API changes ~~~~~~~~~~~ diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index 4dff181d4829b..c326b21610858 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -9,7 +9,7 @@ from pandas.core.common import (isnull, _NS_DTYPE, _INT64_DTYPE, is_list_like,_values_from_object, _maybe_box, notnull, ABCSeries) -from pandas.core.index import Index, Int64Index, _Identity +from pandas.core.index import Index, Int64Index, _Identity, Float64Index import pandas.compat as compat from pandas.compat import u from pandas.tseries.frequencies import ( @@ -1754,6 +1754,11 @@ def max(self, axis=None): return Timestamp(max_stamp, tz=self.tz) def to_julian_date(self): + """ + Convert DatetimeIndex to Float64Index of Julian Dates. + 0 Julian date is noon January 1, 4713 BC. + http://en.wikipedia.org/wiki/Julian_day + """ # http://mysite.verizon.net/aesir_research/date/jdalg2.htm year = self.year @@ -1762,7 +1767,19 @@ def to_julian_date(self): testarr = month < 3 year[testarr] -= 1 month[testarr] += 12 - return day + np.fix((153*month - 457)/5) + 365*year + np.floor(year / 4) - np.floor(year / 100) + np.floor(year / 400) + 1721118.5 + (self.hour + self.minute/60.0 + self.second/3600.0 + self.microsecond/3600.0/1e+6 + self.nanosecond/3600.0/1e+9)/24.0 + return Float64Index(day + + np.fix((153*month - 457)/5) + + 365*year + + np.floor(year / 4) - + np.floor(year / 100) + + np.floor(year / 400) + + 1721118.5 + + (self.hour + + self.minute/60.0 + + self.second/3600.0 + + self.microsecond/3600.0/1e+6 + + self.nanosecond/3600.0/1e+9 + )/24.0) def _generate_regular_range(start, end, periods, offset): if isinstance(offset, Tick): diff --git a/pandas/tseries/tests/test_julian_date.py b/pandas/tseries/tests/test_julian_date.py deleted file mode 100644 index 574043298a153..0000000000000 --- a/pandas/tseries/tests/test_julian_date.py +++ /dev/null @@ -1,68 +0,0 @@ -from datetime import datetime, time, timedelta, date -import sys -import os -import unittest - -import nose - -import numpy as np - -from pandas import Timestamp, date_range - -class TestToJulianDateTimestamp(unittest.TestCase): - - def test_compare_1700(self): - r = Timestamp('1700-06-23').to_julian_date() - self.assertEqual(r, 2342145.5) - - def test_compare_2000(self): - r = Timestamp('2000-04-12').to_julian_date() - self.assertEqual(r, 2451646.5) - - def test_compare_2100(self): - r = Timestamp('2100-08-12').to_julian_date() - self.assertEqual(r, 2488292.5) - - def test_compare_hour01(self): - r = Timestamp('2000-08-12T01:00:00').to_julian_date() - self.assertEqual(r, 2451768.5416666666666666) - - def test_compare_hour13(self): - r = Timestamp('2000-08-12T13:00:00').to_julian_date() - self.assertEqual(r, 2451769.0416666666666666) - -class TestDateTimeIndex(unittest.TestCase): - def test_1700(self): - r1 = [2345897.5, 2345898.5, 2345899.5, 2345900.5, 2345901.5] - r2 = date_range(start=Timestamp('1710-10-01'), periods=5, freq='D').to_julian_date() - self.assert_(isinstance(r2, np.ndarray)) - np.testing.assert_array_equal(r1, r2) - - def test_2000(self): - r1 = [2451601.5, 2451602.5, 2451603.5, 2451604.5, 2451605.5] - r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='D').to_julian_date() - self.assert_(isinstance(r2, np.ndarray)) - np.testing.assert_array_equal(r1, r2) - - def test_hour(self): - r1 = [2451601.5, 2451601.5416666666666666, 2451601.5833333333333333, 2451601.625, 2451601.6666666666666666] - r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='H').to_julian_date() - self.assert_(isinstance(r2, np.ndarray)) - np.testing.assert_array_equal(r1, r2) - - def test_minute(self): - r1 = [2451601.5, 2451601.5006944444444444, 2451601.5013888888888888, 2451601.5020833333333333, 2451601.5027777777777777] - r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='T').to_julian_date() - self.assert_(isinstance(r2, np.ndarray)) - np.testing.assert_array_equal(r1, r2) - - def test_second(self): - r1 = [2451601.5, 2451601.500011574074074, 2451601.5000231481481481, 2451601.5000347222222222, 2451601.5000462962962962] - r2 = date_range(start=Timestamp('2000-02-27'), periods=5, freq='S').to_julian_date() - self.assert_(isinstance(r2, np.ndarray)) - np.testing.assert_array_equal(r1, r2) - -if __name__ == '__main__': - import nose - nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], - exit=False) diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py index d01548ee79e32..7e0703d3c24e8 100644 --- a/pandas/tseries/tests/test_timeseries.py +++ b/pandas/tseries/tests/test_timeseries.py @@ -13,7 +13,7 @@ from pandas import (Index, Series, TimeSeries, DataFrame, isnull, date_range, Timestamp, Period, DatetimeIndex, - Int64Index, to_datetime, bdate_range) + Int64Index, to_datetime, bdate_range, Float64Index) from pandas.core.daterange import DateRange import pandas.core.datetools as datetools @@ -3287,6 +3287,91 @@ def test_guess_datetime_format_for_array(self): ) self.assertTrue(format_for_string_of_nans is None) + +class TestTimestampToJulianDate(tm.TestCase): + + def test_compare_1700(self): + r = Timestamp('1700-06-23').to_julian_date() + self.assertEqual(r, 2342145.5) + + def test_compare_2000(self): + r = Timestamp('2000-04-12').to_julian_date() + self.assertEqual(r, 2451646.5) + + def test_compare_2100(self): + r = Timestamp('2100-08-12').to_julian_date() + self.assertEqual(r, 2488292.5) + + def test_compare_hour01(self): + r = Timestamp('2000-08-12T01:00:00').to_julian_date() + self.assertEqual(r, 2451768.5416666666666666) + + def test_compare_hour13(self): + r = Timestamp('2000-08-12T13:00:00').to_julian_date() + self.assertEqual(r, 2451769.0416666666666666) + + +class TestDateTimeIndexToJulianDate(tm.TestCase): + def test_1700(self): + r1 = Float64Index([2345897.5, + 2345898.5, + 2345899.5, + 2345900.5, + 2345901.5]) + r2 = date_range(start=Timestamp('1710-10-01'), + periods=5, + freq='D').to_julian_date() + self.assert_(isinstance(r2, Float64Index)) + np.testing.assert_array_equal(r1, r2) + + def test_2000(self): + r1 = Float64Index([2451601.5, + 2451602.5, + 2451603.5, + 2451604.5, + 2451605.5]) + r2 = date_range(start=Timestamp('2000-02-27'), + periods=5, + freq='D').to_julian_date() + self.assert_(isinstance(r2, Float64Index)) + np.testing.assert_array_equal(r1, r2) + + def test_hour(self): + r1 = Float64Index([2451601.5, + 2451601.5416666666666666, + 2451601.5833333333333333, + 2451601.625, + 2451601.6666666666666666]) + r2 = date_range(start=Timestamp('2000-02-27'), + periods=5, + freq='H').to_julian_date() + self.assert_(isinstance(r2, Float64Index)) + np.testing.assert_array_equal(r1, r2) + + def test_minute(self): + r1 = Float64Index([2451601.5, + 2451601.5006944444444444, + 2451601.5013888888888888, + 2451601.5020833333333333, + 2451601.5027777777777777]) + r2 = date_range(start=Timestamp('2000-02-27'), + periods=5, + freq='T').to_julian_date() + self.assert_(isinstance(r2, Float64Index)) + np.testing.assert_array_equal(r1, r2) + + def test_second(self): + r1 = Float64Index([2451601.5, + 2451601.500011574074074, + 2451601.5000231481481481, + 2451601.5000347222222222, + 2451601.5000462962962962]) + r2 = date_range(start=Timestamp('2000-02-27'), + periods=5, + freq='S').to_julian_date() + self.assert_(isinstance(r2, Float64Index)) + np.testing.assert_array_equal(r1, r2) + if __name__ == '__main__': nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], exit=False) From 9985db448058a3277efbb09df1d06620ccc1fd63 Mon Sep 17 00:00:00 2001 From: Tim Cera Date: Mon, 24 Feb 2014 05:15:14 -0500 Subject: [PATCH 4/5] DOC: Added docstring to Timestamp.to_julian() --- pandas/tslib.pyx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx index 42f2612d16253..f065ea90473c6 100644 --- a/pandas/tslib.pyx +++ b/pandas/tslib.pyx @@ -385,13 +385,29 @@ class Timestamp(_Timestamp): or self.nanosecond != 0) def to_julian_date(self): + """ + Convert TimeStamp to a Julian Date. + 0 Julian date is noon January 1, 4713 BC. + """ year = self.year month = self.month day = self.day if month <= 2: year -= 1 month += 12 - return day + np.fix((153*month - 457)/5) + 365*year + np.floor(year / 4) - np.floor(year / 100) + np.floor(year / 400) + 1721118.5 + (self.hour + self.minute/60.0 + self.second/3600.0 + self.microsecond/3600.0/1e+6 + self.nanosecond/3600.0/1e+9)/24.0 + return (day + + np.fix((153*month - 457)/5) + + 365*year + + np.floor(year / 4) - + np.floor(year / 100) + + np.floor(year / 400) + + 1721118.5 + + (self.hour + + self.minute/60.0 + + self.second/3600.0 + + self.microsecond/3600.0/1e+6 + + self.nanosecond/3600.0/1e+9 + )/24.0) _nat_strings = set(['NaT','nat','NAT','nan','NaN','NAN']) class NaTType(_NaT): From d0454d82e211307717aec652f420281ba4c9d06e Mon Sep 17 00:00:00 2001 From: Tim Cera Date: Tue, 25 Feb 2014 18:46:10 -0500 Subject: [PATCH 5/5] TST: Change to use PANDAS testing rather than numpy. --- pandas/tseries/tests/test_timeseries.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py index 7e0703d3c24e8..eeab4f46414df 100644 --- a/pandas/tseries/tests/test_timeseries.py +++ b/pandas/tseries/tests/test_timeseries.py @@ -3322,7 +3322,7 @@ def test_1700(self): periods=5, freq='D').to_julian_date() self.assert_(isinstance(r2, Float64Index)) - np.testing.assert_array_equal(r1, r2) + tm.assert_index_equal(r1, r2) def test_2000(self): r1 = Float64Index([2451601.5, @@ -3334,7 +3334,7 @@ def test_2000(self): periods=5, freq='D').to_julian_date() self.assert_(isinstance(r2, Float64Index)) - np.testing.assert_array_equal(r1, r2) + tm.assert_index_equal(r1, r2) def test_hour(self): r1 = Float64Index([2451601.5, @@ -3346,7 +3346,7 @@ def test_hour(self): periods=5, freq='H').to_julian_date() self.assert_(isinstance(r2, Float64Index)) - np.testing.assert_array_equal(r1, r2) + tm.assert_index_equal(r1, r2) def test_minute(self): r1 = Float64Index([2451601.5, @@ -3358,7 +3358,7 @@ def test_minute(self): periods=5, freq='T').to_julian_date() self.assert_(isinstance(r2, Float64Index)) - np.testing.assert_array_equal(r1, r2) + tm.assert_index_equal(r1, r2) def test_second(self): r1 = Float64Index([2451601.5, @@ -3370,7 +3370,7 @@ def test_second(self): periods=5, freq='S').to_julian_date() self.assert_(isinstance(r2, Float64Index)) - np.testing.assert_array_equal(r1, r2) + tm.assert_index_equal(r1, r2) if __name__ == '__main__': nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],