import pandas as pd
 
def seg_zerobased (df, threshold):    
    """
    df : The dataframe that you want to proceed (make sure you use IS NOT NUll query); 
         dataframe format/structure
          ______________________________________________
         |DataSavedTime(datetime64) | Item/value(float) |
         |                          |                   |
    thres (default=0.1) : the threshold value for wave selection (in seconds)
    """    
    idx_group =  df["DataSavedTime"].diff().dt.total_seconds().gt(threshold).cumsum()
    df["id"] = df.groupby(idx_group, as_index=False).ngroup()   
    return df