I have a data that goes something like this:
apple 873 8695 913 1084
apple 873 8695 3953 4498
apple 873 8695 4549 8639
peach 22087 23527 22956 23034
peach 22087 23527 22799 22898
peach 22087 23527 22634 22722
peach 22087 23527 22456 22553
orange 10731 23193 22799 22932
orange 10731 23193 22634 22722
orange 10731 23193 22084 22553
orange 10731 23193 21965 22023
As you can see, for each kind of fruit, 2nd and 3rd columns are same but 4th and 5th are different. I want to write a python script that merges these lines and list everything in 4th and 5th column in one row separated by comma.
So something like this:
apple 873 8695 913,1084,3953,4498,4549,8639
peach 22087 23527 22956,23034,22799,22898,22634,22722,22456,22533
orange 10731 23193 22799,22932,22634,22722,22084,22553,21965,22023
Can someone help me on how to start on this? I had a very complex data set that i simplified to this format. Now all I need to do is this step. It seems that solution will be very simple but I am not even sure how to search for how to do this. Thus my title sounds very awkward as well. I would appreciate for any help.