def __getitem__(self, key):
        """Convenience method for obtaining metadata.
        
        Maps to pandas DataFrame.loc method.
        
        Examples
        --------
        ::
        
            meta['name']
            
            meta[ 'name1', 'units' ]

            for higher order data
            
            meta[ 'name1', 'subvar', 'units' ]
        
        """
        # if key is a tuple, looking at index, column access pattern
        if isinstance(key, tuple):
            # if tuple length is 2, index, column
            if len(key) == 2:
                new_index = self.var_case_name(key[0])
                new_name = self.attr_case_name(key[1])
                return self.data.loc[new_index, new_name]
            # if tuple length is 3, index, child_index, column
            elif len(key) == 3:
                new_index = self.var_case_name(key[0])
                new_child_index = self.var_case_name(key[1])
                new_name = self.attr_case_name(key[2])
                return self.ho_data[new_index].data.loc[new_child_index, new_name]
        else:
            # ensure variable is present somewhere
            if key in self:
                # get case preserved string for variable name
                new_key = self.var_case_name(key)
                # if new_key in self.keys():
                # don't need to check if in lower, all variables
                # are always in the lower metadata
                meta_row = self.data.loc[new_key]
                if new_key in self.keys_nD():
                    meta_row.at['children'] = self.ho_data[new_key].copy()
                else:
                    # empty_meta = Meta()
                    # self.apply_default_labels(empty_meta)
                    meta_row.at['children'] = None #empty_meta
                return meta_row
                # else:
                #     return pds.Series([self.ho_data[new_key].copy()], index=['children'])
            else:
                raise KeyError('Key not found in MetaData')
def __getitem__ ( self , key ) : if isinstance ( key , tuple ) : if len ( key ) == 2 : new_index = self . var_case_name ( key [ 0 ] ) new_name = self . attr_case_name ( key [ 1 ] ) return self . data . loc [ new_index , new_name ] elif len ( key ) == 3 : new_index = self . var_case_name ( key [ 0 ] ) new_child_index = self . var_case_name ( key [ 1 ] ) new_name = self . attr_case_name ( key [ 2 ] ) return self . ho_data [ new_index ] . data . loc [ new_child_index , new_name ] else : if key in self : new_key = self . var_case_name ( key ) meta_row = self . data . loc [ new_key ] if new_key in self . keys_nD ( ) : meta_row . at [ 'children' ] = self . ho_data [ new_key ] . copy ( ) else : meta_row . at [ 'children' ] = None return meta_row else : raise KeyError ( 'Key not found in MetaData' )
Convenience method for obtaining metadata.
        
        Maps to pandas DataFrame.loc method.
        
        Examples
        --------
        ::
        
            meta['name']
            
            meta[ 'name1', 'units' ]

            for higher order data
            
            meta[ 'name1', 'subvar', 'units' ]