HistogramBin

class pyinaturalist.models.HistogramBin(id=None, uuid=None, label=None, count=0, interval=None, max_count=0) None

Bases: BaseModel

A single bin in a histogram.

The main purpose of this class is for terminal formatting with pprint().

Attributes

Name

Type

Description

id

int

Unique record ID

uuid

str

Unversally unique record ID

label

Union[date, datetime, int]

Bin label; type depends on interval

count

int

Number of observations in this bin

interval

str

Histogram interval; one of: [‘year’, ‘month’, ‘week’, ‘day’, ‘hour’, ‘month_of_year’, ‘week_of_year’]

max_count

int

Max count across all bins; used for normalization

bar_width (property)

int

A normalized count as a bar width for terminal display

interval_column_label (property)

str

Format the bin interval for display

formatted_label (property)

str

Format the bin label for display, depending on the interval

Methods

__init__(id=None, uuid=None, label=None, count=0, interval=None, max_count=0) None

Method generated by attrs for class HistogramBin.

classmethod copy(obj) BaseModel

Copy a model object. This is defined as a classmethod to easily initialize a subclass from a parent class instance. For copying an instance to the same type, copy.deepcopy() can be used.

Return type:

BaseModel

classmethod from_json(value, **kwargs) T

Initialize a single model object from an API response or response result.

Omits any invalid fields and None values, so default factories are used instead (e.g. for empty dicts and lists).

Return type:

TypeVar(T, bound= BaseModel)

classmethod from_json_file(value) List[T]

Initialize a collection of model objects from a JSON string, file path, or file-like object

Return type:

List[TypeVar(T, bound= BaseModel)]

classmethod from_json_list(value, **kwargs) List[T]

Initialize a collection of model objects from an API response or response results

Return type:

List[TypeVar(T, bound= BaseModel)]

to_dict(keys=None, recurse=True) Dict[str, Any]

Convert this object back to dict format

Parameters:
  • keys (Optional[List[str]]) – Only keep the specified keys (attribute names)

  • recurse (bool) – Recurse into nested model objects

Return type:

Dict[str, Any]