mesa_frames.Grid.sample_cells#
- Grid.sample_cells(n: int, cell_type: Literal['any', 'empty', 'available', 'full'] = 'any', with_replacement: bool = True, respect_capacity: bool = True) DataFrame#
Sample cells from the grid according to the specified cell_type.
- Parameters:
n (int) – The number of cells to sample
cell_type (Literal["any", "empty", "available", "full"], optional) – The type of cells to sample, by default “any”
with_replacement (bool, optional) – If the sampling should be with replacement, by default True
respect_capacity (bool, optional) – If the capacity of the cells should be respected in the sampling. This is only relevant if cell_type is “empty” or “available”, by default True
- Returns:
A DataFrame with the sampled cells
- Return type:
DataFrame