#NEWLINE# def __getitem__( self , key ) : #NEWLINE# #INDENT# if ( self . _selection is not None ) : #NEWLINE# #INDENT# raise Exception ( ( 'Column(s) %s already selected' % self . _selection ) ) #NEWLINE# #UNINDENT# if isinstance ( key , ( list , tuple , com . ABCSeries , com . ABCIndex , np . ndarray ) ) : #NEWLINE# #INDENT# if ( len ( self . obj . columns . intersection ( key ) ) != len ( key ) ) : #NEWLINE# #INDENT# bad_keys = list ( set ( key ) . difference ( self . obj . columns ) ) #NEWLINE# raise KeyError ( ( 'Columns not found: %s' % str ( bad_keys ) [ 1 : ( - 1 ) ] ) ) #NEWLINE# #UNINDENT# return self . _gotitem ( list ( key ) , ndim = 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not getattr ( self , 'as_index' , False ) ) : #NEWLINE# #INDENT# if ( key not in self . obj . columns ) : #NEWLINE# #INDENT# raise KeyError ( ( 'Column not found: %s' % key ) ) #NEWLINE# #UNINDENT# return self . _gotitem ( key , ndim = 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key not in self . obj ) : #NEWLINE# #INDENT# raise KeyError ( ( 'Column not found: %s' % key ) ) #NEWLINE# #UNINDENT# return self . _gotitem ( key , ndim = 1 )