#NEWLINE# def _get_time_bins( self , ax ) : #NEWLINE# #INDENT# if ( not isinstance ( ax , DatetimeIndex ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'axis must be a DatetimeIndex, but got an instance of %r' % type ( ax ) . __name__ ) ) #NEWLINE# #UNINDENT# if ( len ( ax ) == 0 ) : #NEWLINE# #INDENT# binner = labels = DatetimeIndex ( data = [ ] , freq = self . freq , name = ax . name ) #NEWLINE# return ( binner , [ ] , labels ) #NEWLINE# #UNINDENT# ( first , last ) = ( ax . min ( ) , ax . max ( ) ) #NEWLINE# ( first , last ) = _get_range_edges ( first , last , self . freq , closed = self . closed , base = self . base ) #NEWLINE# tz = ax . tz #NEWLINE# binner = labels = DatetimeIndex ( freq = self . freq , start = first , end = last , tz = tz , name = ax . name ) #NEWLINE# trimmed = False #NEWLINE# if ( ( len ( binner ) > 2 ) and ( binner [ ( - 2 ) ] == last ) and ( self . closed == 'right' ) ) : #NEWLINE# #INDENT# binner = binner [ : ( - 1 ) ] #NEWLINE# trimmed = True #NEWLINE# #UNINDENT# ax_values = ax . asi8 #NEWLINE# ( binner , bin_edges ) = self . _adjust_bin_edges ( binner , ax_values ) #NEWLINE# bins = lib . generate_bins_dt64 ( ax_values , bin_edges , self . closed , hasnans = ax . hasnans ) #NEWLINE# if ( self . closed == 'right' ) : #NEWLINE# #INDENT# labels = binner #NEWLINE# if ( self . label == 'right' ) : #NEWLINE# #INDENT# labels = labels [ 1 : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self ) : #NEWLINE# #INDENT# labels = labels [ : ( - 1 ) ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . label == 'right' ) : #NEWLINE# #INDENT# labels = labels [ 1 : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not trimmed ) : #NEWLINE# #INDENT# labels = labels [ : ( - 1 ) ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ax . hasnans : #NEWLINE# #INDENT# binner = binner . insert ( 0 , tslib . NaT ) #NEWLINE# labels = labels . insert ( 0 , tslib . NaT ) #NEWLINE# #UNINDENT# if ( len ( bins ) < len ( labels ) ) : #NEWLINE# #INDENT# labels = labels [ : len ( bins ) ] #NEWLINE# #UNINDENT# return ( binner , bins , labels )