code: def rename_cols(df,names,renames=None,prefix=None,suffix=None):
      
      if not prefix is None:
          renames=[ "%s%s" % (prefix,s) for s in names]
      if not suffix is None:    
          renames=[ "%s%s" % (s,suffix) for s in names]
      if not renames is None:
          for i,name in enumerate(names):
  #             names=[renames[i] if s==names[i] else s for s in names]    
              rename=renames[i]    
              df.loc[:,rename]=df.loc[:,name]
          df=df.drop(names,axis=1)
          return df
docs: rename columns of a pandas table
  
      :param df: pandas dataframe
      :param names: list of new column names