I am trying to practice some Kafka producing / consuming and am trying to set up a simulated 'stream' of data. I have tried looping through with time.sleep(0.0000001) but it is too slow to catch the entries. Here is what I am trying to do:
offsets = acc_df.offset.unique()
time_start = time.time()
for x in offsets:
while time.time() - time_start != x:
if time.time() - time_start == x:
send_df = acc_df[acc_df['offset'] == x].to_dict()
for x in send_df:
send_data('accelerations', x)
else:
time.sleep(0.0000001)
If I am going about this the wrong way, please let me know!! Basically, once the elapsed time has reached the offset, I want to dump those rows to my Kafka topic.
Thanks in advance!
Edit: Here is some raw data that was requested instead of a picture
id ride_id uuid timestamp offset x y z timelapse filename
58682c5d48cad9d9e103431d773615bf c9a2b46c9aa515b632eddc45c4868482 19b9aa10588646b3bf22c9b4865a7995 25:03.9 0.822061 -0.994 0.045 -0.036 FALSE e2f795a7-6a7d-4500-b5d7-4569de996811.mov
58682c5d48cad9d9e103431d773615bf c9a2b46c9aa515b632eddc45c4868482 19b9aa10588646b3bf22c9b4865a7995 25:03.9 0.842061 -0.998 0.046 -0.04 FALSE e2f795a7-6a7d-4500-b5d7-4569de996811.mov
58682c5d48cad9d9e103431d773615bf c9a2b46c9aa515b632eddc45c4868482 19b9aa10588646b3bf22c9b4865a7995 25:03.9 0.862061 -0.999 0.047 -0.036 FALSE e2f795a7-6a7d-4500-b5d7-4569de996811.mov
58682c5d48cad9d9e103431d773615bf c9a2b46c9aa515b632eddc45c4868482 19b9aa10588646b3bf22c9b4865a7995 25:03.9 0.882061 -0.999 0.045 -0.034 FALSE e2f795a7-6a7d-4500-b5d7-4569de996811.mov
58682c5d48cad9d9e103431d773615bf c9a2b46c9aa515b632eddc45c4868482 19b9aa10588646b3bf22c9b4865a7995 25:03.9 0.902061 -0.999 0.048 -0.033 FALSE e2f795a7-6a7d-4500-b5d7-4569de996811.mov