Field Statistics
InsightMaker.stats(fields=None, datasets=None)
Parameters:
fields
list
Optional - List of Fields objects or strings for field ids. If not provided, all fields are used.
datasets
list
Optional - List of Dataset objects or strings for dataset ids. If not provided, all fields are used.
Response:
A Stats object, either
Cast as DataFrame
Stats.to_data_frame()
Returns the field stats displayed in Pandas DataFrame format
Iterate over multiple FieldStats objects, methods:
FieldStats.id() String, Field ID
FieldStats.name() String, Field name
FieldStats.data_type() Python type object, the Python type for this field (str, datetime, int or float)
FieldStats.total() The total number of occurrences of this field
FieldStats.percentage() The total occurrences of this field as a percentage of the overall dataset(s)
FieldStats.top_values() Return a list of (top value, value count) for this field (or NaN if inappropriate)
FieldStats.max() Maximum value of this field.
FieldStats.min() Minimum value of this field.
FieldStats.average() Average value of this field (mean).
FieldStats.to_dict() The raw json from the REST response as a python dictionary.
Example: