At this point these notes on R and statistics are mostly to myself. Hopefully over time they will evolve into something that can be more generally useful.
Thursday, September 22, 2011
sorting in python by arbitrary key
E.g. we have a list of dictionaries
x = [{'a':1,'b':3}, {'a':3,'b':2}, {'a':2,'b':1}]
x.sort(key=lambda i: i['b'])
No comments:
Post a Comment