labels
labels(data, own=None, ref=None)Readable labels for the columns of a panel (or every field of a dataset id).
Variables take their metadata title; columns written by geo.change() (<var>_2024, <var>_change…) are labelled from their variable; group columns (department) take the scale’s label.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | A panel (any DataFrame) or a dataset id | required | |
| own | dict[str, str] | None | Labels for columns of your own, {column: label}. They are stored on the table, so the figures, tables and readings of the analysis functions use them |
None |
Returns
| Name | Type | Description |
|---|---|---|
| dict | {column: label} for the columns it knows. Pass it to Plotly: px.scatter(df, x=..., y=..., labels=geo.labels(df)). |
Example
!pip install -q geo4bolivia
import geo4bolivia as geo
import plotly.express as px
df = geo.load("sdg07", variables=["sdg7_1_cae", "sdg7_1_elc"], years=2024)
px.scatter(df, x="sdg7_1_cae", y="sdg7_1_elc", labels=geo.labels(df),
title="Electricity and clean cooking, ~2024")