I have a DataFrame with 3 columns. I want to convert this DataFrame to a python tuple cause CoGroupByKey only accept this type. I want the elements of first column be keys and the elements of other columns in same row be values. And can sink it to BigQuery cause BigQuery only accept json format schema
| peakid | bcdate | smtdate |
|---|---|---|
| TKRG | 3/6/10 | 3/12/10 |
| AMPG | 4/5/10 | |
| AMAD | 9/5/10 | 4/21/10 |
And I expect result like this:
[('TKRG',
{'bcdate': ['3/6/10'],
'smtdate': ['3/12/10']}),
('AMPG',
{'bcdate': ['4/5/10'],
'smtdate': []}),
('AMAD',
{'bcdate': ['9/5/10'],
'smtdate': ['4/21/10']})
]
Reference: https://beam.apache.org/documentation/programming-guide/#cogroupbykey