I have a single column dataframe with column type with all possible "types":
type
enter
open
close
update
delete
I get dataframe from my database. But in that dataframe, not all "types" might be. Here is example of that table:
ID date type value
a1 2020-09-01 enter 18
a1 2020-09-01 close 15
a1 2020-09-02 enter 4
a2 2020-09-01 close 10
b1 2020-09-02 update 10
As you see ID a1 has only two types: enter and close. a2 has only close, b1 has only update.
I want to bind these two tables in that way, so "types" which were not in my table have value zero for each ID and date. So, how to bind these two tables to get this:
ID date type value
a1 2020-09-01 enter 18
a1 2020-09-01 open 0
a1 2020-09-01 close 15
a1 2020-09-01 update 0
a1 2020-09-01 delete 0
a1 2020-09-02 enter 4
a1 2020-09-02 open 0
a1 2020-09-02 close 0
a1 2020-09-02 update 0
a1 2020-09-02 delete 0
a2 2020-09-01 enter 0
a2 2020-09-01 open 0
a2 2020-09-01 close 10
a2 2020-09-01 update 0
a2 2020-09-01 delete 0
b1 2020-09-01 enter 0
b1 2020-09-01 open 0
b1 2020-09-01 close 0
b1 2020-09-01 update 10
b1 2020-09-01 delete 0
How could i do that?