#NEWLINE# def create_panels_append( cls , panels ) : #NEWLINE# #INDENT# ' return an append list of panels ' #NEWLINE# panels = [ a for a in panels if ( a is not None ) ] #NEWLINE# if ( len ( panels ) == 0 ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( panels ) == 1 ) : #NEWLINE# #INDENT# return panels [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( len ( panels ) == 2 ) and ( panels [ 0 ] == panels [ 1 ] ) ) : #NEWLINE# #INDENT# return panels [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# def joint_index_for_axis( panels , axis ) : #NEWLINE# #INDENT# s = set ( ) #NEWLINE# for p in panels : #NEWLINE# #INDENT# s . update ( list ( getattr ( p , axis ) ) ) #NEWLINE# #UNINDENT# return sorted ( list ( s ) ) #NEWLINE# #UNINDENT# def reindex_on_axis( panels , axis , axis_reindex ) : #NEWLINE# #INDENT# new_axis = joint_index_for_axis ( panels , axis ) #NEWLINE# new_panels = [ p . reindex ( ** { #NEWLINE# #INDENT# axis_reindex : new_axis , #NEWLINE# 'copy' : False , #NEWLINE# #UNINDENT# } ) for p in panels ] #NEWLINE# return ( new_panels , new_axis ) #NEWLINE# #UNINDENT# major = joint_index_for_axis ( panels , 'major_axis' ) #NEWLINE# ( panels , minor ) = reindex_on_axis ( panels , 'minor_axis' , 'minor' ) #NEWLINE# ( panels , items ) = reindex_on_axis ( panels , 'items' , 'items' ) #NEWLINE# try : #NEWLINE# #INDENT# values = np . concatenate ( [ p . values for p in panels ] , axis = 1 ) #NEWLINE# #UNINDENT# except Exception as detail : #NEWLINE# #INDENT# raise Exception ( ( "cannot append values that dont' match dimensions! -> [%s] %s" % ( ',' . join ( [ ( '%s' % p ) for p in panels ] ) , str ( detail ) ) ) ) #NEWLINE# #UNINDENT# p = Panel ( major , items = items , major_axis = major , minor_axis = minor ) #NEWLINE# return p