# -*- coding: utf-8 -*- # @Time : 2023/5/24 15:23 # @Author : zhaoxiangpeng # @File : change_head.py import pandas as pd from typing import Union def rename_head(table_or_head: Union[pd.DataFrame, list], postfix: str = '-other') -> dict: if isinstance(table_or_head, pd.DataFrame): table_or_head = table_or_head.columns.values.tolist() new_head = {} for head in table_or_head: new_head[head] = str(head) + postfix return new_head