Assume that we have the following pandas dataframe:
test_df = pd.DataFrame({'start':[1,2,3,4], 'end':[2,3,4,5] ,'signal':[1,2,3,4]},columns=['start','end','signal'])
Can we update a numpy array in a vectorized way?
nparray = np.zeros(4)
Using the compute method below?
def compute(nparray,start,end,signal):
nparray[start:end] += signal
Right now, it gives the following error:
nparray[start:end] += signal
TypeError: slice indices must be integers or None or have an __index__ method