Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

list comprehension - Numpy - Late Binding Closures

I guess it could be a late binding closures problem.

for i,dt in enumerate(delay_list):
    accel[:,i],freq[:,i] = srs(sum)

What I actually get: 2 arrays (shape: 124,3) with all 3 columns identical (corresponding to i=2) What I expect: 2 arrays (shape: 124,3) with each column corresponding to i=0,1,2

Additional info:

srs(sum) is a function that loads a txt file (sum) with a filename that changes in accordance with the dt index.

This is my first post. I apologize in case of wrong formatting.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...