#NEWLINE# def test_timedelta64_analytics( self ) : #NEWLINE# #INDENT# from pandas import date_range #NEWLINE# td = ( Series ( date_range ( '2012-1-1' , periods = 3 , freq = 'D' ) ) - Timestamp ( '20120101' ) ) #NEWLINE# result = td . idxmin ( ) #NEWLINE# self . assertEqual ( result , 0 ) #NEWLINE# result = td . idxmax ( ) #NEWLINE# self . assertEqual ( result , 2 ) #NEWLINE# td [ 0 ] = np . nan #NEWLINE# result = td . idxmin ( ) #NEWLINE# self . assertEqual ( result , 1 ) #NEWLINE# result = td . idxmax ( ) #NEWLINE# self . assertEqual ( result , 2 ) #NEWLINE# s1 = Series ( date_range ( '20120101' , periods = 3 ) ) #NEWLINE# s2 = Series ( date_range ( '20120102' , periods = 3 ) ) #NEWLINE# expected = Series ( ( s2 - s1 ) ) #NEWLINE# result = ( s1 - s2 ) . abs ( ) #NEWLINE# assert_series_equal ( result , expected ) #NEWLINE# result = td . max ( ) #NEWLINE# expected = Timedelta ( '2 days' ) #NEWLINE# self . assertEqual ( result , expected ) #NEWLINE# result = td . min ( ) #NEWLINE# expected = Timedelta ( '1 days' ) #NEWLINE# self . assertEqual ( result , expected )