timeflux.helpers.port


A set of Port helpers.

port

timeflux.helpers.port.make_event(label, data={}, serialize=True)[source]

Create an event DataFrame

Parameters:
  • label (str) – The event label.

  • data (dict) – The optional data dictionary.

  • serialize (bool) – Whether to JSON serialize the data or not.

Returns:

Dataframe

timeflux.helpers.port.match_events(port, label)[source]

Find the given label in an event DataFrame

Parameters:
  • port (Port) – The event port.

  • label (str) – The string to look for in the label column.

Returns:

The list of matched events, or None if there is no match.

Return type:

DataFrame

timeflux.helpers.port.get_meta(port, keys, default=None)[source]

Find a deep value in a port’s meta

Parameters:
  • port (Port) – The event port.

  • keys (tuple|str) – The hiearchical list of keys.

  • default – The default value if not found.

Returns:

The value, or default if not found.

timeflux.helpers.port.traverse(dictionary, keys, default=None)[source]

Find a deep value in a dictionary

Parameters:
  • dictionary (dict) – The event port.

  • keys (tuple|str) – The hiearchical list of keys.

  • default – The default value if not found.

Returns:

The value, or default if not found.