Counter python 2.7:
import collections
Hs = [0.5, 1.0, 2.3, 0.5, 0.5]
Tm = [2.0, 2.5, 2.0, 2.0, 3.0]
pairs = zip(Hs, Tm)
, :
>>> print(list(pairs))
[(0.5, 2.0), (1.0, 2.5), (2.3, 2.0), (0.5, 2.0), (0.5, 3.0)]
So
pairs = zip(Hs, Tm)
counts = collections.Counter(pairs)
print(counts)
:
Counter({(0.5, 2.0): 2, (1.0, 2.5): 1, (0.5, 3.0): 1, (2.3, 2.0): 1})
Counter - dict, dict:
for pair, count in counts.items():
print(pair, count)
:
(1.0, 2.5) 1
(0.5, 3.0) 1
(0.5, 2.0) 2
(2.3, 2.0) 1
, , , dict:
counts[(1.0, 3.0)]
0