Suppose I have a df which has columns of \'ID\', \'col_1\', \'col_2\'. And I define a function :
df
\'ID\', \'col_1\', \'col_2\'
f = lambda x, y : my_function_expres
My example to your questions:
def get_sublist(row, col1, col2): return mylist[row[col1]:row[col2]+1] df.apply(get_sublist, axis=1, col1='col_1', col2='col_2')