Given a df as follow
time_interval dvalue
0 (0, 5] 1
1 (5, 10] 2
2 (10, 15] 4
3 (15, 20] 5
4 (20, 25] 6
5 (25, 30] 7
6 (30, 35] 8
I would like to split the column time_interval, which of type interval[int64, right] as the following
dvalue l u
0 1 0 5
1 2 5 10
2 4 10 15
3 5 15 20
4 6 20 25
5 7 25 30
6 8 30 35
The full code to reproduce the df is as follow
ls = range(0, 100, 5)
df=pd.DataFrame([1,2,4,5,6,7,8],columns=['dvalue'])
df.index = pd.IntervalIndex.from_breaks(ls[:len(df) + 1])
df.reset_index(inplace=True)
df.rename(columns={'index':'time_interval'},inplace=True)