Black Lives Matter. Please consider donating to Black Girls Code today.

Creating a map visualization is taking a really long time for my specific need. Please help


I am trying to visualize some geospatial data using Plotly Express in Python. The data is the Digital Boundary of the Census Tracts shapefile available here ( My issue is that it is just taking too long as the file size increases (and I mean time it takes to draw the data increases exponentially).

Now I have written some code and for whatever reason i have no idea why it is taking so long. I have been mapping some smaller shapefiles suing the exact same code and they work just fine. I can use a sample of just a few polygons and it works, but I want to see the entire dataset. I believe the issue is in the featureidkey and just how long it takes the merge the data back together. Can there be a better way if the data is a geopandas dataframe, instead of having to provide a separate dataset for the tabular data and the geojson. Can someone please help me understand what my issue is and how I can better map Shapefiles using Plotly? My code is below:

import numpy as np
import pandas as pd
import geopandas as gpd
import datetime as dt
import as px

shp_census_tracts = gpd.read_file("lct_000a16a_e/lct_000a16a_e.shp")

# shp_census_tracts.plot() # this just maps as an image to verify that the dataframe is geospatial

fig = px.choropleth_mapbox(shp_census_tracts,
                           center={"lat": 43.798625, "lon": -79.479050},