On Sat, Sep 5, 2009 at 10:21 AM, kevin parks <k...@mac.com> wrote: > > Then what you would want to do is map the data to the nearest value no?
I guess it all depends on your desired level of precision! > For this particular hack, I am mostly getting useful values in the range > 30-85, so I am filtering out anything below 34 and above 83, but i don't > have 34-83 contiguous. I have a gap toothed integer grid of: > > [34, 39, 41, 42, 43, 44, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 60, 61, > 62, 63, 65, 66, 67, 68, 70, 72, 73, 75, 77, 79, 80, 82] > > I want to map each incoming integer to the closest one available. I know, > it is idiosyncratic. I also need to be able to do this with other > idiosyncratic gap toothed sets. I think the simplest way is to use a dictionary. You could, of course, use a sort to find out where to insert your data. -Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor