whylogs.core.statistics.datatypes.stringtracker

Module Contents

Classes

StringTracker

Track statistics for strings

Attributes

MAX_ITEMS_SIZE

MAX_SUMMARY_ITEMS

logger

whylogs.core.statistics.datatypes.stringtracker.MAX_ITEMS_SIZE = 128
whylogs.core.statistics.datatypes.stringtracker.MAX_SUMMARY_ITEMS = 100
whylogs.core.statistics.datatypes.stringtracker.logger
class whylogs.core.statistics.datatypes.stringtracker.StringTracker(count: int = None, items: datasketches.frequent_strings_sketch = None, theta_sketch: whylogs.core.statistics.thetasketch.ThetaSketch = None)

Track statistics for strings

Parameters
  • count (int) – Total number of processed values

  • items (frequent_strings_sketch) – Sketch for tracking string counts

  • theta_sketch (ThetaSketch) – Sketch for approximate cardinality tracking

update(self, value: str)

Add a string to the tracking statistics.

If value is None, nothing will be done

merge(self, other)

Merge the values of this string tracker with another

Parameters

other (StringTracker) – The other StringTracker

Returns

new – Merged values

Return type

StringTracker

to_protobuf(self)

Return the object serialized as a protobuf message

Returns

message

Return type

StringsMessage

static from_protobuf(message: whylogs.proto.StringsMessage)

Load from a protobuf message

Returns

string_tracker

Return type

StringTracker

to_summary(self)

Generate a summary of the statistics

Returns

summary – Protobuf summary message.

Return type

StringsSummary