spatial_entropy¶
spatial_entropy
¶
spatial_entropy(vehicle_panel: DataFrame, *, grid_size_m: float = 200.0, time_col: str = 'fetched_at') -> DataFrame
Shannon entropy of the free-floating fleet's spatial distribution over time.
A free-floating system tends to collapse entropically (vehicles pile into city centres or topographic low points). Tracking the Shannon entropy of the per-snapshot distribution over a fixed metric grid objectifies that concentration without depending on administrative boundaries: high entropy is an even spread, low entropy is concentration.
For each snapshot, vehicles are binned into grid_size_m cells (equirectangular projection)
and :math:H = -\sum_i p_i \ln p_i is computed over the occupied cells, where :math:p_i is
the share of the fleet in cell :math:i. evenness normalises by :math:\ln(\text{cells})
so it is comparable across snapshots with different footprints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vehicle_panel
|
DataFrame
|
A history of canonical |
required |
grid_size_m
|
float
|
Grid cell size in metres. |
200.0
|
time_col
|
str
|
Snapshot timestamp to group by. |
"fetched_at"
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per snapshot: |
See Also
spatial_center_of_mass : Where the distribution is centred.
morans_i : Autocorrelation of the same field.
Source code in src/gbfs_toolkit/spatial/analytics.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |