mesa_frames.Grid.place_agents#

Grid.place_agents(agents: int | Collection[int] | Series | DataFrame | AbstractAgentSet | AbstractAgentSetRegistry | Collection[AbstractAgentSet] | Collection[AbstractAgentSetRegistry], pos: int | DataFrame | Sequence[int] | float | Sequence[float] | Collection[int | DataFrame] | Sequence[int | slice | Sequence[int]] | Collection[int | Sequence[int] | DataFrame] | Sequence[float | Sequence[float]] | Collection[float | Sequence[float] | DataFrame], inplace: bool = True) Self#

Place agents in the space according to the specified coordinates. If some agents are already placed, raises a RuntimeWarning.

Parameters:
  • agents (IdsLike | AbstractAgentSet | AbstractAgentSetRegistry | Collection[AbstractAgentSet] | Collection[AbstractAgentSetRegistry]) – The agents to place in the space

  • pos (SpaceCoordinate | SpaceCoordinates) – The coordinates for each agents. The length of the coordinates must match the number of agents.

  • inplace (bool, optional) – Whether to perform the operation inplace, by default True

Return type:

Self

Raises:
  • RuntimeWarning – If some agents are already placed in the space.

  • ValueError

    • If some agents are not part of the model.

    • If agents is IdsLike and some agents are present multiple times.