#NEWLINE# def max_range( ranges ) : #NEWLINE# #INDENT# '\n    Computes the maximal lower and upper bounds from a list bounds.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# with warnings . catch_warnings ( ) : #NEWLINE# #INDENT# warnings . filterwarnings ( 'ignore' , 'All-NaN (slice|axis) encountered' ) #NEWLINE# values = [ r for r in ranges for v in r if ( v is not None ) ] #NEWLINE# if ( pd and all ( ( isinstance ( v , pd . tslib . Timestamp ) for r in values for v in r ) ) ) : #NEWLINE# #INDENT# values = [ ( v1 . to_datetime64 ( ) , v2 . to_datetime64 ( ) ) for ( v1 , v2 ) in values ] #NEWLINE# #UNINDENT# arr = np . array ( arr ) #NEWLINE# if ( arr . dtype . kind in 'M' ) : #NEWLINE# #INDENT# return ( arr [ : , 0 ] . min ( ) , arr [ : , 1 ] . max ( ) ) #NEWLINE# #UNINDENT# return ( np . nanmin ( arr [ : , 0 ] ) , np . nanmax ( arr [ : , 1 ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# return ( np . NaN , np . NaN )