There is lists :
l_figure_s= [5, 9, 21, 25, 30, 34, 43]
l_figure_e= [8, 16, 24, 28, 33, 37, 46]
Of lists created dataframe :
df1 = pd.DataFrame.from_dict({'starts':l_figure_s,'ends':l_figure_e},dtype=int,orient='index').transpose()
You need to check elements by condition:
df1[ df1['starts']<df1['ends'] & df1['starts'].shift(-1)>=df['ends'] ]
The error occurs on the last line,
I think the interpreter sees this condition : Nan >= 46
How to exclude condition check beyond the last line ?
Maybe you need a calculator for df[‘ends’] ?
>Solution :
You have to use parenthesis:
df1[(df1['starts']<df1['ends']) & (df1['starts'].shift(-1)>=df1['ends'])]