MCPcopy Index your code
hub / github.com/plotly/plotly.py / election_geojson

Function election_geojson

plotly/data/__init__.py:181–203  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

179
180
181def 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
206def carshare(return_type="pandas"):

Callers

nothing calls this directly

Calls 2

readMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected