Choropleth Map with plotly.express doesn't show map, just legend
You executed the code either inside a cell of a jupyter notebook or in jupyter lab. That explains why no graph was shown.
If you would ran the same code as a pure python script it shows the graph properly.
Plotly provides two different solutions for getting it running inside jupyter:
Plotting Inline
Please search for Plotting Inline on that page to find the paragraph that explains the solution en detail.
Proper running example purePython and Jupyter Notebook
I just let it ran as it is also as purePython and as Jupyter Notebook cell:
import plotly.express as px

df = px.data.election()
geojson = px.data.election_geojson()

fig = px.choropleth(df, geojson=geojson, color=&quot;Bergeron&quot;,
                    locations=&quot;district&quot;, featureidkey=&quot;properties.district&quot;,
                    projection=&quot;mercator&quot;
                   )
fig.update_geos(fitbounds=&quot;locations&quot;, visible=False)
fig.update_layout(margin={&quot;r&quot;:0,&quot;t&quot;:0,&quot;l&quot;:0,&quot;b&quot;:0})
fig.show()