Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental DataFrame support #113

Merged
merged 4 commits into from
Aug 1, 2022
Merged

experimental DataFrame support #113

merged 4 commits into from
Aug 1, 2022

Conversation

jhgjeraker
Copy link
Member

@jhgjeraker jhgjeraker commented Aug 1, 2022

Overview

Experimental function to convert a list of events to DataFrame.
Requires the installation of additional packages.

pip install disruptive[extra]

The pandas package is not, and will not, be a dependency of
the core disruptive package. However, supporting DataFrames is a
significant enough convenience that we're experimenting with it here.
May be removed in the future if we decide that this is not a good idea.

The columns device_id, event_id, and event_type are static, then
one additional column is concatenated for every eventData field.


Changes to EventHistory.list_events()

Before:
EventHistory.list_events() output was list[Event].

Now:
EventHistory.list_events() output is EventHistory, the instance of a class that itself inherits the list type. This allows us to add functionality like to_dataframe() while preserving all the previous behavior expected from a list.

For an list_events() output events, the check

isinstance(events, list)

still holds and should not affect previous implementations.

@jhgjeraker jhgjeraker merged commit acc5841 into main Aug 1, 2022
@jhgjeraker jhgjeraker deleted the events-dataframe branch August 1, 2022 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant