#NEWLINE# def _table_relabel( table , substitutions , replacements = None ) : #NEWLINE# #INDENT# '\n    Change table column names, otherwise leaving table unaltered\n\n    Parameters\n    ----------\n    substitutions\n\n    Returns\n    -------\n    relabeled : TableExpr\n    ' #NEWLINE# if ( replacements is not None ) : #NEWLINE# #INDENT# raise NotImplementedError #NEWLINE# #UNINDENT# observed = set ( ) #NEWLINE# exprs = [ ] #NEWLINE# for c in substitutions . columns : #NEWLINE# #INDENT# expr = table [ c ] #NEWLINE# if ( c in substitutions ) : #NEWLINE# #INDENT# expr = expr . name ( substitutions [ c ] ) #NEWLINE# observed . add ( c ) #NEWLINE# #UNINDENT# exprs . append ( expr ) #NEWLINE# #UNINDENT# for c in substitutions : #NEWLINE# #INDENT# if ( c not in observed ) : #NEWLINE# #INDENT# raise KeyError ( '{0!r} is not an existing column' . format ( c ) ) #NEWLINE# #UNINDENT# #UNINDENT# return table . projection ( exprs )