Home
Sign Up
Sign In
V2EX
›
问与答
python2 里面有没有什么优雅的方法对字典相同的 key 求和
Zuckonit
·
Jul 24, 2014
· 7992 views
This topic created in 4491 days ago, the information mentioned may be changed or developed.
dict_a = {'a' : 1, 'b' : 2}
dict_b = {'a' : 2, 'b' : 3}
如何得到dict_c = {'a': 3, 'b': 5}
求和
字典
Python
4 replies
•
2014-07-24 14:43:21 +08:00
lll9p
Jul 24, 2014
1
1
http://stackoverflow.com/questions/3490738/how-to-sum-dict-elements
http://stackoverflow.com/questions/8584504/python-sum-on-keys-for-list-of-dictionaries
imn1
Jul 24, 2014
2
class collections.Counter([iterable-or-mapping])
imn1
Jul 24, 2014
3
呃,求和,反应成计数了
统计方面的习惯都交给pandas了
Zuckonit
OP
Jul 24, 2014
4
@
lll9p
@
imn1
thanks
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
972 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms ·
UTC 22:18
·
PVG 06:18
·
LAX 14:18
·
JFK 17:18
♥ Do have faith in what you're doing.
❯