Python Pandas: Table Manipulation With Slices As Variables
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,
define your function this way
def fun(slices):
return [df.low.loc[s].tolist() for s in slices]
And apply over the slices column
df['slices_low'] = df.slices.apply(fun)
df
Post a Comment for "Python Pandas: Table Manipulation With Slices As Variables"