'Error on my laptop. TypeError: 'numpy.float64' object cannot be interpreted as an integer
The error below is what I get when I run the code. It works on another persons computer but not mine. I have 3.9.7 python and numpy version 1.20. How do I fix the code?
p_ren_t1 = get_renovation_cycles(time_interval, no_cycles,ren_mean_cycle= ren_mean,
ren_rel_deviation = ren_rel_std, distribution='norm', show = True)
ren_mean = 50
ren_rel_std = 0.25
p_ren_t2 = get_renovation_cycles(time_interval, no_cycles,ren_mean_cycle= ren_mean,
ren_rel_deviation = ren_rel_std, loc = 6, distribution='lognorm', show = True)
The error shows up in line 21.
TypeError Traceback (most recent call last)
5
----> 6 p_ren_t1 = get_renovation_cycles(time_interval, no_cycles,ren_mean_cycle= ren_mean,
ren_rel_deviation = ren_rel_std, distribution='norm', show = True)
7
8 ren_mean = 50
~\AppData\Local\Temp/ipykernel_25696/608447137.py in get_renovation_cycles(time_interval,
no_cycles, ren_mean_cycle, ren_rel_deviation, loc, distribution, show)
19
20
---> 21 times_t= np.linspace(time_interval[0], time_interval[1], time_interval[1]-
time_interval[0]+1)
22 times_t = times_t.astype(int)
23 ren_cycles = np.zeros(np.shape(times_t))
<__array_function__ internals> in linspace(*args, **kwargs)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
