def xx_pandas(duiying_path, input_path=None, output_path=None):
    data = pd.read_excel(duiying_path, sheetname='name')
    en_ch = {}  # 英文字段到中文字段的映射
    col1 = data['数据库名称'.decode('utf8')]
    col2 = data['字段名称'.decode('utf8')]
    for i in range(len(col1)):
        if str(col1[i]) == 'nan':
            continue
        en_ch[col1[i]] = col2[i].strip()
    old_data = pd.read_excel(input_path, sheetname='Sheet1')
    ch_names = {}
    index = []
    for l in old_data.index:
        ch_name = ''
        if l in en_ch:
            ch_name = en_ch[l]
        ch_names[l] = ch_name
        index.append(l)
    s = Series(ch_names, name='数据库字段')
    old_data.insert(0, '数据库字段', s)
    print old_data.head(100)
    old_data.to_excel(output_path)

 

相关文章:

  • 2021-09-14
  • 2021-11-13
  • 2021-11-07
  • 2021-07-21
  • 2021-07-17
  • 2021-07-23
猜你喜欢
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案