Skip to content

Support dictionary protocol in StatsManager for easier Pandas DataFrame conversion #507

@fusi3

Description

@fusi3

Hi, thank you for your work on this project. I have been playing around with it at work and it has been very useful and fun to learn from.

I was working on an implementation where I wanted to selected the best scene from a frame based on the content value that comes from stats manager. The way I went about it was calling the save_to_csv function then reading that into a dataframe and then filtering the dataframe between timestamps.

Eventually, I wanted to move away from saving a csv and wanted to get to the dataframe directly. I got this working by essentially recreating the save_to_csv function by appending rows to a dataframe rather than writing to a csv. However in that process I noticed in lines 191 to 193 in stats_manager.py that when get_frames is called for the frame_key, a +1 is added.

I assume this is for readability purposes? However when I print the df that I create from the save_to_csv, the Frame_Number that is printed begins from 2 and not 1. When I remove the +1 in my function I get the Frame_Number to being from 1.

I am wondering if there is a reason for this as it affects downstream applications based on frame numbers

I can provide some screenshots if you need

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions