Python Forum
Loop for comparing 2 following datablocks in long Array - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Loop for comparing 2 following datablocks in long Array (/thread-7180.html)



Loop for comparing 2 following datablocks in long Array - Sw1p3 - Dec-25-2017

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


RE: Loop for comparing 2 following datablocks in long Array - j.crater - Dec-25-2017

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.


RE: Loop for comparing 2 following datablocks in long Array - Skaperen - Dec-26-2017

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.