import csv
file=open("F:/zhengwangwork/test csv/2.csv")
reader=csv.reader(file)
data=[]
data1=[]
data2=[]
data3=[]
data4=[]
data5=[]
a=[]
#读取文件数据列
for row in reader:
# column = eval(row[0])
column = row[0]
# min=min(column)
column1 = row[1]
column2= row[2]
column3 = row[3]
column4 = row[4]
column5 = row[5]
data.append(column)
data1.append(column1)
data2.append(column2)
data3.append(column3)
data4.append(column4)
data5.append(column5)
# print(data)
# print(min)
#求取第一列的最小值并相减输出
for i in range(0,len(data)):
q = min(data)
# print(min)
w=eval(data[i])-eval(q)
# print(w)
a.append(w)
# print(q)
print(a)
#将数据列重新写入csv文件中
filePath='F:/zhengwangwork/test csv/3.csv'
rows=zip(a,data1,data2,data3,data4,data5)
with open(filePath,"w",newline='') as f:
writer=csv.writer(f)
for row in rows:
writer.writerow(row)