I am currently writing a script to filter csv output data from cycles of an automated machine. What I want is to provide indexes of the start and stop of a cycle and check if the machine 'state' column contains an int value 12. I am looking at the first two cycles and running the exact same code but different indexes for the smaller L dataframe. For the first cycle [0:16], v returns true as expected. However, the second cycle returns v as False even though the state column contains 12. The goal is to eventually find the indexes of every cycle (when key == 102) in a list and loop through to find out if state 12 executed or not in every cycle.
Here is a snapshot of the dataframe first cycle: first cycle
Here is a snapshot of the first half of the second cycle: second cycle
Both dataframe have a value of 12 in the state column. So it should return True if I use 'in'.
L = df[0:16]
#exists = 12 in L.state
v = 12 in L.state
print(v)
The above returns True as expected.
L = df[16:51]
#exists = 12 in L.state
v = 12 in L.state
print(v)
The above returns False which is confusing me.
Since the same dataframe is used to make the smaller L dataframe and the same 12 in L.state call to return a bool. Does anyone know what I missing as to why is this code executing differently on the second set of indexes?