I’d like to verify if there is data at least once every 6 hours per ID, and filter out the IDs that do not meet this criteria.
I try to use the same method for filtering one per day, but having trouble adapting the code.
# add day column from datetime index df['1D'] = df.index.day # reset index daily = df.reset_index() # count per ID per day. Result is per ID data of non-zero a = daily.groupby(['1D', 'id']).size() # filter by right join filtered = a.merge(df, on = id", how = 'right')
I cannot figure out how to adapt this for the following 6hr periods each day: 00:01-06:00, 06:01-12:00, 12:01-18:00, 18:01-24:00.