I have a DataFrame with employee time sheets, total hour worked as well as overtime hours.
example = pd.DataFrame({'Employee': ["Alex", "Alex", "Alex", "Bob", "Peter", "Peter"], 'date': ['2021-01-01', '2021-01-01', '2021-01-03', '2021-01-02', '2021-01-01', '2021-01-02'],
'Total Hour': [1.5, 2.2, 7, 1, 3, 6], 'Overtime': [1.5, 0, 1.2, 2.3, 1.7, 5]})
print(example)
Employee date Total Hour Overtime
0 Alex 2021-01-01 1.5 1.5
1 Alex 2021-01-01 2.2 0.0
2 Alex 2021-01-03 7.0 1.2
3 Bob 2021-01-02 1.0 2.3
4 Peter 2021-01-01 3.0 1.7
5 Peter 2021-01-02 6.0 5.0
I want to create a monthly DataFrame with all the days of the month and fill only available timesheets in it, something like this:
2021-01-01 2021-01-02 2021-01-03 2021-01-04 2021-01-05 ... 2021-01-31
Employee
0 Alex Total Hour 3.7 7.0
1 Alex Overtime 1.5 1.2
2 Bob Total Hour 1
3 Bob Overtime 2.3
4 Peter Total Hour 3.0 6
5 Peter Overtime 1.7 5
So as employees enter their hours, this will become more complete.
I tried to figure it out but I think I am missing something very fundamental here.