mesa_frames.AgentSet.set#

AgentSet.set(attr_names: str | Collection[str] | dict[str, Any] | None = None, values: Any | None = None, mask: Sequence[int] | int | Literal['all', 'active'] | None | Expr | Series | DataFrame = None, inplace: bool = True) Self[source]#

Update agent attributes, optionally on a masked subset.

Parameters:
  • attr_names (str | Collection[str] | dict[str, Any] | None, optional) – Attribute(s) to assign. When None, concrete implementations may derive targets from values.

  • values (Any | None, optional) – Replacement value(s) aligned with attr_names.

  • mask (AgentMask | None, optional) – Subset selector limiting which agents are updated.

  • inplace (bool, optional) – Whether to mutate in place or return an updated copy, by default True.

Returns:

The updated AgentSet (or a modified copy when inplace=False).

Return type:

Self