id source Date CVI
67092 10365 sat 2016-11-20 00:00:00 1.9
67093 10365 nel-2 2016-11-20 00:00:00 1.5
67094 10365 sat 2016-12-06 00:00:00 1.436964
67095 10365 sat 2016-12-22 00:00:00 NaN
67096 10365 sat 2017-01-07 00:00:00 4.835949
67097 10365 sat 2017-01-23 00:00:00 10.033607
... ... ... ... ...
723 84650 nel-2 2020-04-03 00:00:00 5.085851
724 84650 nel-2 2020-04-08 00:00:00 4.375207
725 84650 nel-2 2020-04-13 00:00:00 0.040688
726 84650 nel-2 2020-04-18 00:00:00 3.151000
From the dataframe above, I would like to create a new dataframe where id
for same Date
and different source
are in same row. e.g. the output should look like:
id Date sat_CVI nel-2_CVI
0 10365 2016-11-20 00:00:00 1.9 1.5
I tried using groupby but it does not do what I want. Please note that the resulting table has only those rows where the same id
has a CVI
value for the same Date
for both the source