#-*- coding: utf-8 -*- import pandas as pd import numpy as np data = pd.read_excel('data1.xlsx') #print data,把数据转化为矩阵,然后可以用矩阵的加减法 data1 = pd.DataFrame(data) data1.as_matrix() data2 = pd.DataFrame(data) data2.as_matrix() data3 = data1+data2 #还要把加减过后的结果保存回excel data3 = pd.DataFrame(data3) # create and writer pd.DataFrame to excel writer = pd.ExcelWriter('Save_Excel.xlsx') # data_df.to_excel(writer,'page_1',float_format='%.5f') # float_format 控制精度 # writer.save()
把数据转成矩阵再计算然后存储回数据
最新推荐文章于 2022-08-07 16:38:43 发布