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

Custom Choropleth Map with time slider (plotly express)

Hi all,

I am trying to construct a simple choropleth map using that has a time slider. I am able to display a static map, but would like to discern the change in spatial distributions trends over time. I’ve referred to
this link regarding animated choropleths, but I don’t think I need to do anything that involved. This is because in this solution, it appears to be fairly simple. However, when I reconstruct that code with my geojson and dataframe, it times out (in fact, crashing my Jupyter notebook). Eventually, I would like to use choropleth_mapbox() to draw a basemap, but for now I was hoping to get the basic implementation to work.

Here is my code:
First imports:

import pandas as pd
import numpy as np
import as px
import geopandas as gpd
from geojson_rewind import rewind
import json

I then load my dataframe and load/rewind my shape file:

predictions = predictions_all=pd.read_csv("~/predictions_all.csv")
hucs = gpd.read_file(path+"HUC.geojson")
hucs = json.loads(hucs.to_json())

hucs_rewind = rewind(hucs, rfc7946=False)

And finally create the choropleth (hopefully):

variable = "Predicted PRBT"
fig = px.choropleth(predictions_all,
                    #animation_group='huc12',       #Uncommenting line this does nothing
                    center={"lat":48.25674, "lon":-114.14640},
                    labels={variable:'Predicted % Hybridization for RBT'})

I would greatly appreciate the help, even if it is just informing me that this task will not be as simple as I thought.

My dataframe and shapefile are available to download here and here.