group¶
- class AnnotatedGroup(trajectories, *, target, observations, categories, background_category)¶
Bases:
Group,AnnotatedSampleableMixinAnnotated group.
- Parameters:
trajectories (
Iterable[Trajectory] |Mapping[str|int,Trajectory]) – Individual trajectories to be included in the group.target (
Literal['individual','dyad']) – The target of the group.observations (
DataFrame) – Observations for the group.categories (
tuple[str,...]) – Categories of the observations.background_category (
str) – Background category of the observations.
- class Group(trajectories, *, target)¶
Bases:
NestedSampleableMixin,SampleableMixinA group is a collection of individuals (
Individual) or dyads (Dyad), depending on the target.- Parameters:
trajectories (
Iterable[Trajectory] |Mapping[str|int,Trajectory]) – A mapping of individual identifiers to trajectories.target (
Literal['individual','dyad']) – The target type of the dataset.
- classmethod REQUIRED_COLUMNS(target=None)¶
Returns the required columns for annotations with the given target.
- Parameters:
target (default:
None) – The target type for the annotations.- Return type:
tuple[Literal['actor'],Literal['category'],Literal['start'],Literal['stop']] |tuple[Literal['actor'],Literal['recipient'],Literal['category'],Literal['start'],Literal['stop']]- Returns:
The required columns for annotations.
- annotate(observations, *, categories, background_category)¶
Annotates the group with the given observations.
- classmethod from_group(group, *, individuals, subset_actors_only)¶
Create a new group as a subset of the original group.
- Parameters:
group (
Self) – The original group to create a subset from.individuals (
Sequence[str|int]) – The individuals to include in the new group.subset_actors_only (
bool) – Only applicable whentarget="dyad". Whether to drop dyads with non-included individuals as actors or recipients, or only when they are actors.
- Return type:
Self- Returns:
A new group containing only the specified individuals.