I would like to group df
below by Date
and ItemId
:
Id Timestamp Data ItemId Date
2012-04-21 19389576 2012-04-21 00:04:03.533 39.0 1 2012-04-21
2012-04-21 19389577 2012-04-21 00:04:04.870 38.5 1 2012-04-21
2012-04-21 19389608 2012-04-21 00:07:03.450 38.0 1 2012-04-21
...
2012-04-22 19389609 2012-04-21 00:03:04.817 37.5 2 2012-04-21
2012-04-22 19389620 2012-04-21 00:10:04.400 37.0 2 2012-04-21
...
to get all combinations of Date
and ItemId
, then select from original dataframe df
using each combination of Date
and ItemId
, for instance, Date== 2012-04-21 and ItemId==1
, Date== 2012-04-21 and ItemId==2
...
How do I select data using the 2 columns simultaneously in the for-loop?