Это очень странно, хотя я вижу, что ключ существует, он все равно выдает мне ошибку:
import numpy as np
stim_end_time = 4000
bin_times = np.arange(0,stim_end_time+100,0.025)
time_to_fr = {bin_times[i]:0 for i in range(len(bin_times[:-1]))}
print(0.075 in time_to_fr)
print(0.075 in time_to_fr.keys())
print(np.sort(time_to_fr.keys())[:10])
time_to_fr[0.075]
False
False
[0. 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-3-d4c6a4c93742> in <module>()
6 print(0.075 in time_to_fr.keys())
7 print(np.sort(time_to_fr.keys())[:10])
----> 8 time_to_fr[0.075]
KeyError: 0.075