Python Forum

Full Version: Loop for comparing 2 following datablocks in long Array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hallo everybody,

i search for an solution for following problem:

x=[1,2,3,4,5]
block_length=2
save=[]

for i in range (len(x)):

If np.std(Block i) > np.std(Block i-1):
np.append(save,np.max(,Block i))



This is just an example for what i´m programming in general.
If I do this in pur Python, without any tricks, it would be to tooo slow.

Sorry for the bad code discrption but i think it can be understand.
I know its no correct code

Thanks for every answer.

Greats
Sw1p3
Hello, please edit your post so that the code is put within Python code tags. Also, use ctrl+shift+v when copying code, that will preserve indentation. You can find help here.
if you are worried about a program being slow then you should do one of these two things:

1. use a better algorithm that works in fewer steps.

2. use a language other than Python since Python is intended for other purposes like faster coding and cleaner more clear code.