I have two variables of data (BxHPF and ByHPF), which are equall in number of data. I would like to make a loop, which takes first value of BxHPF and ByHPF compute them, then take next one from BxHPF and ByHPF and so on. For now I have:

So I though about this way:

Computing = (float(BxHPF[0])/float(ByHPF[0]))
Dat1 = math.degrees(Computing)*(-1)

In fact those equations give me correct result. But as I wrote I need to make a loop, which will count every pair from BxHPF and ByHPF with using those two variables Computing and Dat1.

To be exact BxHPF and ByHPF contain 266150 records each.

  • $\begingroup$ I am afraid that the way this question is posed makes it off-topic for DSP.SE. But, having said that, I also struggle to see what exactly is the difficulty here (?). The question seems to be "How do I express an interation in Python?" and there are already resources out there that do an excellent job at that. A native iteration might be slow for you and you might have to use the iteration tools of some underlying library (like pandas for example) but even in that case, you are better off consulting the manual of that library. $\endgroup$
    – A_A
    Jan 31, 2018 at 9:07

1 Answer 1

result = [math.degrees(x/y)*(-1) for x,y in zip(BxHPF,ByHPF)]

It seems that I have found an answer. Maybe it will help someone.


Not the answer you're looking for? Browse other questions tagged or ask your own question.