next_df = df.shift(-1)
next_waypt = next_df.values.tolist()
waypt=df.values.tolist()
So I have these 2 lists of lists from a dataframe in pandas. I want to create a new list using values from those 2 lists in a function. I do not know how to iterate over the first index however
y = [math.sin(waypt[:1][1] - next_waypt[:1][1])*math.cos(next_waypt[:1][0]) for y in waypt]
For this input I get the error "list index out of range".
y = [math.sin(waypt[y][1] - next_waypt[y][1])*math.cos(next_waypt[y][0]) for y in waypt]
for this input I get "list indices must be integers or slices". Any help would be greatly appreciated. I could just pull each column as a seperate list however it reduces code readability. I am relatively new to python so if you all think that is the best solution please let me know.