pandas读取int类型转换

import pandas as pdclass Excel2mysql(object):def get_dataframe_list(self,file_name):
        '''
        读取excle文件,将dataframe格式转换为特殊List
        :param file_name:文件路径
        :return:
        '''
        try:
            df = pd.read_excel(file_name,dtype={"研究院员工编号": "object"})  # dtype防止编号变为Int格式去除掉前面的0
            df1 = df[['研究院员工编号', '部所']]
            param = df1.values.tolist()
            return param
        except:
            return

 

posted @ 2021-08-03 16:37  python包包侠  阅读(231)  评论(0)    收藏  举报
1