1 year ago

#376440

test-img

Philipp s

Max&min of a sinus DF ; TypeError: 'function' object does not support item assignment

I try to get the min & max spots of a Dataframe that is sinusoidal. The Frequency is in 400er steps. I wanted to define the function amplitude and collect the data in an array. Amp1 is an abs max value that should be collected and added to the list. After trying this code :

node1 = np.load( '1_v2_n.npy')
node2 = np.load( '2_v2_n.npy')
node3 = np.load( '3_v2_n.npy')
node4 = np.load( 'T_v2_n.npy')

At this part I get the failure :

def amplitude(array):
    for i in range (0,len(array),400):
        amp1[array]= abs(max(array[i:i+400]))
    return amp1[array]

print(amplitude(node1[0]))   

I get the following output

TypeError                                 Traceback (most recent call last)
<ipython-input-132-d803767af22f> in <module>
      9     return amp1[array]
     10 
---> 11 print(amplitude(node1[0]))
     12 
     13 

<ipython-input-132-d803767af22f> in amplitude(array)
      6 def amplitude(array):
      7     for i in range (0,len(array),400):
----> 8         amp1[array]= abs(max(array[i:i+400]))
      9     return amp1[array]
     10 

TypeError: 'function' object does not support item assignment

I tried to vary the return on different spots but it does not help.

python

for-loop

max

min

amplitude

0 Answers

Your Answer

Accepted video resources