#NEWLINE# def _calculate( self , data ) : #NEWLINE# #INDENT# new_data = pd . DataFrame ( ) #NEWLINE# new_data [ 'x' ] = default . labels #NEWLINE# for column in ( set ( data . columns ) - set ( 'x' ) ) : #NEWLINE# #INDENT# column_dict = dict ( zip ( data [ 'x' ] , data [ column ] ) ) #NEWLINE# default = ( 0 if ( column == 'y' ) else data [ column ] . values [ 0 ] ) #NEWLINE# new_data [ column ] = [ column_dict . get ( val , default ) for val in self . labels ] #NEWLINE# #UNINDENT# return new_data