import pandas as pd
for day in range(21):
gendata = pd.read_csv("gen\\case39_day_" + str(day) + "_gen.csv", header=None, index_col=None)
maxdata = pd.read_csv("max_renewable_gen_p\\case39_day_" + str(day) + "_max_renewable_gen_p.csv", header=None,
index_col=None)
print("The day {} has began!".format(day))
for i in range(gendata.shape[0]):
for j in range(gendata.shape[1]):
if gendata.iloc[i, j] > maxdata.iloc[i, j]:
print("The {} day is over, in {}, {}, the orignal is {}, the real max is {}".format(day, i, j,
gendata.iloc[i, j],
maxdata.iloc[i, j]))
gendata.iloc[i, j] = maxdata.iloc[i, j]
gendata.to_csv("gen\\case39_day_" + str(day) + "_gen.csv", header=None, index_label=None, columns=None, index=None)
print("The day {} has corrected over!".format(day))
批量修改Excel数据
最新推荐文章于 2024-10-30 22:40:33 发布