HabitatFeaturePanel

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class HabitatFeaturePanel(frame: DataFrame, subject_column: str = 'subject', habitat_column: str = 'habitat', feature_column: str = 'feature', value_column: str = 'value')[source]

Bases: object

Long table of one value per subject x habitat x feature.

frame

Columns named by the four *_column fields.

Type:

pandas.core.frame.DataFrame

subject_column

Subject identifier column.

Type:

str

habitat_column

Habitat id column (integer labels).

Type:

str

feature_column

Feature name column.

Type:

str

value_column

Numeric measurement column. Absent habitats are omitted (not filled with zero).

Type:

str

__post_init__() → None[source]

Validate that the declared columns exist and habitats are integer.

property n_subjects: int

Number of distinct subjects in the panel.

property habitat_ids: Tuple[int, ...]

Sorted habitat ids that have at least one finite value.

property feature_names: Tuple[str, ...]

Feature names in first-seen order.

for_subject(subject_id: str) → HabitatFeaturePanel[source]

Return a panel containing only subject_id.

Parameters:

subject_id – Subject identifier to keep.

Returns:

A new panel with one subject.

Raises:

HABITAPIError – If the subject is absent.

__init__(frame: DataFrame, subject_column: str = 'subject', habitat_column: str = 'habitat', feature_column: str = 'feature', value_column: str = 'value') → None