I have DataFrame that looks like this:
   id   datetime
0   a   2022-01-18
1   a   2022-01-19
2   a   2022-01-20
3   b   2022-01-20
4   b   2022-01-20
5   c   2022-01-18
and I want a DataFrame that looks something like:
    id  2022-01-20  2022-01-19   2022-01-18
0   a   1           1            1
1   b   2           0            0
2   c   0           0            1
I've tried
    df.groupby(['id', 'datetime']).size()
    
id  datetime
a   2022-01-18   1
    2022-01-19   1
    2022-01-20   1
b   2022-01-20   2
c   2022-01-18   1
It returns a series not a DataFrame which is close but still not what I want. Please help
 
     
    