Each feature represents an electoral district in the 2013 Montreal mayoral election. Returns ------- A GeoJSON-formatted `dict` with 58 polygon or multi-polygon features whose `id` is an electoral district numerical ID and whose `district` property is the ID and
()
| 179 | |
| 180 | |
| 181 | def election_geojson(): |
| 182 | """ |
| 183 | Each feature represents an electoral district in the 2013 Montreal mayoral election. |
| 184 | |
| 185 | Returns |
| 186 | ------- |
| 187 | A GeoJSON-formatted `dict` with 58 polygon or multi-polygon features whose `id` |
| 188 | is an electoral district numerical ID and whose `district` property is the ID and |
| 189 | district name. |
| 190 | """ |
| 191 | import gzip |
| 192 | import json |
| 193 | import os |
| 194 | |
| 195 | path = os.path.join( |
| 196 | os.path.dirname(os.path.dirname(__file__)), |
| 197 | "package_data", |
| 198 | "datasets", |
| 199 | "election.geojson.gz", |
| 200 | ) |
| 201 | with gzip.GzipFile(path, "r") as f: |
| 202 | result = json.loads(f.read().decode("utf-8")) |
| 203 | return result |
| 204 | |
| 205 | |
| 206 | def carshare(return_type="pandas"): |