Python 寻找numpy-ndarray指数
我有一个numpy.ndarray(数据),它有5个元素,每个元素有2042行和两列。第一列包含日期(每隔15分钟),第二列包含温度。我正在编写一个脚本,可以在24小时内找到最高温度。我有一个工作脚本Python 寻找numpy-ndarray指数,python,numpy,Python,Numpy,我有一个numpy.ndarray(数据),它有5个元素,每个元素有2042行和两列。第一列包含日期(每隔15分钟),第二列包含温度。我正在编写一个脚本,可以在24小时内找到最高温度。我有一个工作脚本 x1=0 y1=95 maxTblue=[] for i in range(int(len(data[0])/96)+1): #collect the max temp for 24-hr period maxTblue.append(max(data[0][x1:y1,1])
x1=0
y1=95
maxTblue=[]
for i in range(int(len(data[0])/96)+1):
#collect the max temp for 24-hr period
maxTblue.append(max(data[0][x1:y1,1]))
#add 96 to shift to the next 24-hr period
x1+=96
y1+=96
现在,我想能够收集每24小时内最高温度出现的日期。我尝试了下面的脚本,但它给了我错误的日期。日期应增加24小时,但当前脚本返回的是前24小时的日期
maxdateBlue=[]
locblue=[]
x3=0
y3=95
for i in range(int(len(data[0])/96)+1):
#index for the max temp
locblue.append(np.where(data[0][x3:y3,1]==maxTblue[i]))
#date where the max temp occurs
maxdateBlue.append(data[0][locblue[i],0])
x3+=96
y3+=96
如何正确使用np.where,或者如何使用另一个indexs命令来查找最高温度出现的时间?要查找numpy数组中最大值的索引,请使用要查找numpy数组中最大值的索引,请使用