what shoud I buy?# Stock
p*r
1 楼
【 以下文字转载自 Programming 讨论区 】
发信人: prettier (I know), 信区: Programming
标 题: 如何让python dictionary sorting 的速度变得很快?
发信站: BBS 未名空间站 (Fri Aug 26 23:19:43 2016, 美东)
如何让python dictionary sorting 的速度变得很快?
要sort 一些 python dictionary , 找出 value 最大的key, 一个 dictionary 的长度
大概有 300,000 。 然后发现速度奇慢。真的不是一点的慢。
代码用的这个:
max(stats.iteritems(), key=operator.itemgetter(1))[0]
问一下怎样能 speed up?
发信人: prettier (I know), 信区: Programming
标 题: 如何让python dictionary sorting 的速度变得很快?
发信站: BBS 未名空间站 (Fri Aug 26 23:19:43 2016, 美东)
如何让python dictionary sorting 的速度变得很快?
要sort 一些 python dictionary , 找出 value 最大的key, 一个 dictionary 的长度
大概有 300,000 。 然后发现速度奇慢。真的不是一点的慢。
代码用的这个:
max(stats.iteritems(), key=operator.itemgetter(1))[0]
问一下怎样能 speed up?