mesa_frames.AgentSet.sort#

AgentSet.sort(by: str | Sequence[str], ascending: bool | Sequence[bool] = True, inplace: bool = True, **kwargs) Self[source]#

Sort agents by one or more columns.

Parameters:
  • by (str | Sequence[str]) – Column name(s) to sort on.

  • ascending (bool | Sequence[bool], optional) – Sort order per column, by default True.

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

  • **kwargs (Any) – Backend-specific keyword arguments forwarded to the concrete sorter.

Returns:

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

Return type:

Self