I have a table such as follow (in black). I would like to create an additional column such as visible in red, to the right. Basically for each slice variable in the "slice" column, I want retrieve the corresponding values from the "low" column.
I have tried countless ways of doing that, I already posted a question here trying to address one of the approach i though would work:
Python Pandas: Function doesn't work when used with apply()
One of the respondents to that question suggested that i simply ask how to achieve it, hence here I am.
I also repost below the code to reconstruct that dataframe:
df = pd.DataFrame(dict, columns=["low", "slices"])
{'low': {0: 1207.25,
1: 1207.5,
2: 1205.75,
3: 1206.0,
4: 1201.0,
5: 1202.75,
6: 1203.75},
'slices': {0: [slice(1, 1, None)],
1: [slice(1, 2, None), slice(2, 2, None)],
2: [slice(1, 3, None), slice(2, 3, None), slice(3, 3, None)],
3: [slice(1, 4, None),
slice(2, 4, None),
slice(3, 4, None),
slice(4, 4, None)],
4: [slice(1, 5, None),
slice(2, 5, None),
slice(3, 5, None),
slice(4, 5, None),
slice(5, 5, None)],
5: [slice(1, 6, None),
slice(2, 6, None),
slice(3, 6, None),
slice(4, 6, None),
slice(5, 6, None),
slice(6, 6, None)],
6: [slice(1, 7, None),
slice(2, 7, None),
slice(3, 7, None),
slice(4, 7, None),
slice(5, 7, None),
slice(6, 7, None),
slice(7, 7, None)]}}