#NEWLINE# def bin_data( ) : #NEWLINE# #INDENT# global time_period , grouped , group_count , counter , times , groups #NEWLINE# grouped = df . groupby ( [ grouped . hour , ( times . minute // time_period ) ] ) #NEWLINE# groups = sorted ( grouped . groups . keys ( ) , key = ( lambda r : ( r [ 0 ] , r [ 1 ] ) ) ) #NEWLINE# group_count = len ( groups ) #NEWLINE# counter = 0