I'm analysing some data with Apriori algorithm. This requires me to convert the dataframe into an array of tuples( groupby col"c1"), with each tuple corresponding to a "row" of the dataframe. If there's only one value in the tuple, I want an "," behind it cuz I need to keep it as a tuple.
In [1]: data
Out[1]:
c1 c2
0 r1 aa
1 r1 bb
2 r1 cc
3 r2 dd
4 r2 ee
5 r3 ff
I expect the data like this:
[('aa','bb','cc'),('dd','ee'),('ff',)]