> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Spatially Stratified Sampling Python Module

Spatially stratified sampling partitions the data into a grid and randomly samples each partition independently.

## `spatially_stratified_sample`

Spatially stratified sampling of a DataFrame containing spatial data.

Each dimension will be rounded to the nearest integer.

```python theme={"system"}
def spatially_stratified_sample(dataframe: DataFrame, fraction: float, partition_count: int, geometry: Optional[str], seed: int)
```

### Parameters

<ParamField path="dataframe" type="DataFrame" required>
  DataFrame containing spatial data to be sampled. Must contain a geometry column.
</ParamField>

<ParamField path="fraction" type="float" required>
  Sampling rate between 0 and 1
</ParamField>

<ParamField path="partition_count" type="int" required>
  Number of partitions to divide the data into. If not a perfect square, the number of partitions
</ParamField>

<ParamField path="geometry" type="Optional[str]">
  Column containing the geometry data. Default is "geometry"
</ParamField>

<ParamField path="seed" type="int" required>
  Seed for sampling the data
</ParamField>

### Returns

The input DataFrame sampled down to the specified rate.

### Usage Examples

```python theme={"system"}
from spatially_stratified_sampling import *

# Example usage of spatially_stratified_sample
result = spatially_stratified_sample(dataframe=example_value, fraction=example_value, partition_count=example_value)
```
