["geo_id not found at scale 'municipality': ['BO-99']",
"1 duplicate rows for ['geo_id', 'year']"]
check
check(df, scale=None, time='year', ref=None)Problems that would stop df from being a valid panel at scale (empty list = OK).
Checks: a geo_id column, ids known at the scale, one row per unit (and year) and integer years.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| df | pd.DataFrame | Your panel, e.g. from geo.link |
required |
| scale | str | None | Its scale (default: inferred from geo_id) |
None |
| time | str | None | The year column, or None for a cross-section |
'year' |
Example
!pip install -q geo4bolivia
import geo4bolivia as geo
import plotly.express as px
import pandas as pd
df = pd.DataFrame({"geo_id": ["BO-04-17-04", "BO-04-17-04", "BO-99"],
"year": [2024, 2024, 2024], "x": [1, 2, 3]})
geo.check(df, scale="municipality") # unknown id, duplicate rows