I have a pandas dataframe:
df = pd.DataFrame({'start': [50, 100, 50000, 50030, 100000],
'end': [51, 101, 50001, 50031, 100001],
'value': [1, 2, 3, 4, 5]},
index=['id1', 'id2', 'id3', 'id4', 'id5'])
>>> df
start end value
id1 50 51 1
id2 100 101 2
id3 50000 50001 3
id4 50030 50031 4
id5 100000 100001 5
Now I would like to extract groups of all rows within the size range of 150 in column "start". The output should look like:
group group_start group_end min_val max_value id_count
1 50 101 1 2 2
2 50000 50031 3 4 2
3 100000 100001 5 5 1
How to extract those groups?
