How to show percentage change?

Viewed 47
PS_data = data[4:11,1]
PNS_data = data[4:11,2]
PRS_data = data[4:11,3]
PRNS_data = data[4:11,4]


def change(a,b):
    
    answer = np.diff(PS_data) / PS_data[0] * 100
    return answer

print(change(PS_data,0))

This is the code but it only gives me the correct answer for the first percentage change. If i change the '0' to '1', it will show me the correct answer for only the 2nd answer.

0 Answers
Related