I have dataframe with datetime and a column. I have to find maximum stretch of null values in a 'particular date' and replace it with zero.In example below, January 1st the maximum stretch null value is 3 times, so I have to replace this zero. Similarly, I have to replicate the process for 2nd January.
Note : Only the maximum stretch of null values has to be replaced with zero not the others.
Below is my sample data:
Datetime X
01-01-2018 00:00 1
01-01-2018 00:05 Nan
01-01-2018 00:10 2
01-01-2018 00:15 3
01-01-2018 00:20 2
01-01-2018 00:25 Nan
01-01-2018 00:30 Nan
01-01-2018 00:35 Nan
01-01-2018 00:40 4
02-01-2018 00:00 Nan
02-01-2018 00:05 2
02-01-2018 00:10 2
02-01-2018 00:15 2
02-01-2018 00:20 2
02-01-2018 00:25 Nan
02-01-2018