Saturday 15 March 2014

python - deleting numbers from a list if they are too close to the preceding number -


I need to prepare a list of numbers (which will represent time points) that show the pseudon distribution and then the list Go back and delete any number after the previous number (60/300).

So far I have created this code:

  a = range (1,20000,100) b = boundary (1,4500,10) list_of_numbers = [ ] I am in: J: B: I = float (random. Exposure (j) * 10000) list_of_numbers.append (i) list_of_numbers.sort () max_diff_between_numbers = float (60/300) final_number_list = [(x, y ) For X, y in zip (list_of_numbers [1:], list_of_numbers [: - 1]) if (xy)> gt; Max_diff_between_numbers]   

Currently, this zip function is returning xy as 0.0, every xy and I can not seem to repair it. Thanks

Your max_diff_between_numbers is set to 0:

  & gt; & Gt; & Gt; Float (60/300) 0.0   

What you might want:

  & gt; & Gt; & Gt; 60 / Float (300) 0.2    

No comments:

Post a Comment