group by a dataframe by values that are just less than a second off - pandas
问题 Let's say i have a pandas dataframe as below: >>> df=pd.DataFrame({'dt':pd.to_datetime(['2018-12-10 16:35:34.246','2018-12-10 16:36:34.243','2018-12-10 16:38:34.216','2018-12-10 16:42:34.123']),'value':[1,2,3,4]}) >>> df dt value 0 2018-12-10 16:35:34.246 1 1 2018-12-10 16:36:34.243 2 2 2018-12-10 16:38:34.216 3 3 2018-12-10 16:42:34.123 4 >>> I would like to group this dataframe by 'dt' column, but i want to group it in a way that it thinks the values that are less than a second different