So I am trying to find out whether the previous number in a numpy array in a dataframe is greater than a number. So here is the code:
import pandas as pd
import numpy as np
arr_1 = np.array([7, 1, 6, 9, 2, 4])
arr_2 = np.array([5, 8, 9, 10, 2, 3])
arr_3 = np.array([1, 9, 3, 4, 5, 1])
dict_of_arrs = {
'arr' : [arr_1, arr_2, arr_3]
}
df = pd.DataFrame(dict_of_arrs)
df
Which has an output of:
arr
0 [7, 1, 6, 9, 2, 4]
1 [5, 8, 9, 10, 2, 3]
2 [1, 9, 3, 4, 5, 1]
So my questions is what code would be able to find out, if the secound number in each array for each row is greater than the first, and if the third is greater than the secound and so on for each number in each array. Where the code has an output that is True if the number is greater or False if the number is not in each array. Thank you.