I have data from a log file in which products were tested periodically. The data is sampled at 125 samples/sec. Products are tested a few minutes apart. This results in a lot of zeros between the data I want to analyze. The data I want to keep is greater than 0.0.
I created a DataFrame by ...
df = pd.read_csv('file.log')
This yields a single column of data. Mostly zeros, but there are periodic groupings of values greater 0.0 which represent test data.
data
0 0.0
1 0.0
2 0.0
3 0.0
4 0.0
... ...
34527 0.0
34528 0.0
34529 0.0
34530 0.0
34531 0.0
34532 rows × 1 columns
I want to find each test sample in the data and create either a groupby object or a new dataframe with each column representing a test sample ['test1', 'test2', etc.]. Somehow I need to iterate through the data, identify a group of test data, and give it a unique label. I've got to imagine this has been solved already, but I've been unsuccessful at finding a similar solution.
Any suggestions would be greatly appreciated.
Edit: Here is an image of the data, if that helps.