Вот простое руководство, как это сделать:
from pandas import DataFrame
if __name__ == '__main__':
data1 = {'Starting DOY': [3.0, 3.0, 13.0],
'Ending DOY': [6.0, 6.0, 15.0]}
data2 = {'YEAR': [1975, 1975, 1975],
'DOY': [1.0, 3.0, 6.0],
'HR': [0, 1, 2],
'By': [-7.5, -4.0, -3.6],
'Bz': [0.2, 2.4, -2.3],
'Nsw': [999.9, 6.2, 5.9],
'Vsw': [9999.0, 476.0, 482.0],
'AE': [181, 138, 86]}
df1 = DataFrame(data1, columns=['Starting DOY',
'Ending DOY'])
df2 = DataFrame(data2, columns=['YEAR', 'DOY',
'HR', 'By', 'Bz',
'Nsw', 'Vsw', 'AE'])
for doy in df1.values:
start_doy = doy[0]
end_doy = doy[1]
for val in df2.values:
year = val[0]
current_doy = val[1]
hr = val[2]
By = val[3]
Bz = val[4]
Nsw = val[5]
Vsw = val[6]
AE = val[7]
if start_doy <= current_doy <= end_doy:
print("For DOY {}".format(current_doy))
print("By: {}".format(By))
print("Bz: {}".format(Bz))
print("Vsw: {}".format(Vsw))
print("--------------------")
Результат:
For DOY 3.0
By: -4.0
Bz: 2.4
Vsw: 476.0
--------------------
For DOY 6.0
By: -3.6
Bz: -2.3
Vsw: 482.0
--------------------
For DOY 3.0
By: -4.0
Bz: 2.4
Vsw: 476.0
--------------------
For DOY 6.0
By: -3.6
Bz: -2.3
Vsw: 482.0
--------------------