import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import torch
import os
base = r'C:\Users\Fan\PycharmProjects\pythonProject2\数据\wew'
base1 = r'C:\Users\Fan\PycharmProjects\pythonProject2\数据\wewe'
def findAllFile(base):
list = []
for root, ds, fs in os.walk(base):
for f in fs:
fullname = os.path.join(root, f)
list.append(fullname) # 将每一次获取到的数据存放到总的列表中
return list
def addlist(lista):
list1 = []
for h in lista:
read_res = pd.read_excel(h)
list1.append(read_res.iloc[-1])
return list1
hua = findAllFile(base)
saa = addlist(hua)
hua_array = np.array(saa, dtype=int)
print(hua_array)
akesu = findAllFile(base1)
aks = addlist(akesu)
a_array = np.array(aks, dtype=int)
print(a_array)
array_data = np.concatenate((hua_array,a_array),axis=0)
print(array_data)
pd.DataFrame(array_data).to_excel('data.xlsx')
这个是将采集曲线的最终结果也就是最后一行拿出来,放到一个新的excel里面