You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the thinkstats.py module, the Trim function creates a (documented) side
effect of sorting the sequence that is passed in as a parameter. Instead of
using the sort() method on the list, use the sorted builtin to sort the values
into another array.
Existing code --
def Trim(t, p=0.01):
t.sort()
n = int(p * len(t))
t = t[n:-n]
return t
Proposed code --
def Trim(t, p=0.01):
sorted_t = sorted(t)
n = int(p * len(sorted_t))
return sorted_t[n:-n]
Of course, the comments and documentation would have to be updated as well.
Original issue reported on code.google.com by gbre...@gmail.com on 7 Sep 2012 at 2:47
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
gbre...@gmail.com
on 7 Sep 2012 at 2:47The text was updated successfully, but these errors were encountered: