Bootstrap

工作中 python 如何获取 excel 表格中数据所在的行和列,并对应写到相应表格中...

import re
import pandas
import pandas as pd
import numpy as np


def get_coordinates(data: pandas.DataFrame, target: str, order_id):
    """
    根据要查找的目标,返回其在excel中的位置
    data: excel数据,
    target: 要查找的目标
    return: 返回坐标列表
    """
    data_list = np.array(data).tolist()
    for i in range(len(data_list)):
        for j in range(len(data_list[i])):
            if data_list[i][j] == target:
                ints=([i + 1, j + 1])
                print(ints)
                get_x_y(ints,order_id)
                return [i + 1, j + 1]
    return []


def get_x_y(ints,order_id):
    print(ints[0],ints[1] + 2)
    from openpyxl import load_workbook
    wb = load_workbook('.\weid2.xlsx')
    # 激活excel表
    sheet = wb.active

    # 向excel中写入表头
    sheet['j1'] =
;