reduceByKey: tuple (k,v)

python

#1

[(‘1’, 1), (‘2013-07-25 00:00:00.0’, 1), (‘11599’, 1), (‘CLOSED’, 1), (‘2’, 1), (‘2013-07-25 00:00:00.0’, 1), (‘256’, 1), (‘PENDING_PAYMENT’, 1), (‘3’, 1), (‘2013-
07-25 00:00:00.0’, 1)]

add=order_tuple.reduceByKey(lambda x,y: x+y)

for i in add.takeSample(True,20): print(i)

(‘46114’, 1)
(‘21650’, 1)
(‘2884’, 6)
(‘2646’, 10)
(‘14948’, 1)
(‘40737’, 1)
(‘37127’, 1)
(‘44’, 7)
(‘8596’, 3)
(‘11540’, 6)
(‘1815’, 4)
(‘10790’, 4)

ERROR
I am only getting 3rd tuple as key and value.
please check on this.


#2

#3

Do not send private messages. You need to collaborate with community for issues related to your code by raising topics under relevant category.