I have a sensor that measures data every ~60seconds. There is a little bit of delay between calls, so the data might look like this:
timestamp, value
12:01:45, 100
12:02:50, 90
12:03:55, 87
# 12:04 missing
12:05:00, 91
I only need precision to the minute, not seconds. Since this gathers data all day long, there should be 1440 entries (1440 minutes per day), however, there are some missing timestamps.
I'm loading this into a pd.DataFrame, and I'd like to have 1440 rows no matter what. How could I squeeze in None values to any missing timestamps?
timestamp, value
12:01:45, 100
12:02:50, 90
12:03:55, 87
12:04:00, None # Squeezed in a None value
12:05:00, 91
Additionally, some data is missing for several HOURS, but I'd still like to fill those with None.
Ultimately, I wish to plot the data using matplotlib, with the x-axis ranging between (0, 1440), and the y-axis ranging between (0, 100).
asfreqmaybe?timestampas index and usereindexwith a custom list of the times you want (checktimedelta_range)