Thank you everyone, for your input. The help is much appreciated.
Thomas Philips
--
http://mail.python.org/mailman/listinfo/python-list
En Mon, 29 Sep 2008 17:04:48 -0300, <[EMAIL PROTECTED]> escribió:
result_x = uniques_x.keys()
result_y = map(median, uniques_x.itervalues())
I think it works because keys and values are given in the same order,
but in real code I tend to avoid using such subtle things. Because if
you tr
Gerard flanagan wrote:
[EMAIL PROTECTED] wrote:
x1 = [] #unique instances of x and y
y1 = [] #median(y) for each unique value of x
for xx,yy in d.iteritems():
x1.append(xx)
l = len(yy)
if l == 1:
y1.append(yy[0])
[EMAIL PROTECTED] wrote:
x1 = [] #unique instances of x and y
y1 = [] #median(y) for each unique value of x
for xx,yy in d.iteritems():
x1.append(xx)
l = len(yy)
if l == 1:
y1.append(yy[0])
else:
[EMAIL PROTECTED]:
> My code follows, and it seems a bit clumsy - is there a cleaner way to do it?
The code doesn't look bad. I can suggest few things:
- When you have "paragraphs" of code that do something definite then
the comment before them can be written without indentation, to denote
it reg
I have coded a robust (Theil-Sen) regression routine which takes as
inputs two lists of numbers, x and y, and returns a robust estimate of
the slope and intercept of the best robust straight line fit.
In a pre-processing phase, I create two new lists, x1 and y1; x1 has
only the unique values in x,