Let us Assume, I have a key value pair in Spark, such as the following.
[ (Key1, Value1), (Key1, Value2), (Key1, Vaue3), (Key2, Value4), (Key2, Value5) ]
Now I want to reduce this, to something like this.
[ (Key1, [Value1, Value2, Value3]), (Key2, [Value4, Value5]) ]
That is, from Key-Value to Key-List of Values.
How can I do that using the map and reduce functions in python?