I have a dataframe that contains an entry for a symbol occasionally and then a count. I would like to expand the dataframe so that every symbol contains a row for the entire daterange in the dataframe. I want to enter a value of '0' for the count where there is no entry for a symbol on a certain date.
My dataframe:
dates = ['2021-01-01','2021-01-02','2021-01-03']
symbol = ['a','b','a']
count = [1,2,3]
df = pd.DataFrame({'Mention Datetime': dates,
'Symbol': symbol,
'Count':count})
Mention Datetime Symbol Count
0 2021-01-01 a 1
1 2021-01-02 b 2
2 2021-01-03 a 3
what I want it to look like:
Mention Datetime Symbol Count
0 2021-01-01 a 1
1 2021-01-02 a 0
2 2021-01-03 a 3
3 2021-01-01 b 0
4 2021-01-02 b 2
5 2021-01-03 b 0