✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Unexpected value NaN parsing height attribute

I’m getting this error in my console for some choropleth figures, but not for others.

Here is the error I’m getting:

image

And here is one of the figures that created this errror:

Choropleth({
    'colorscale': [[0.0, 'rgb(151, 217, 189)'], [0.25, 'rgb(96, 196, 153)'], [0.5,
                   'rgb(62, 168, 123)'], [0.75, 'rgb(51, 137, 100)'], [1.0,
                   'rgb(36, 97, 71)']],
    'locationmode': 'USA-states',
    'locations': [AL, AK, AZ, AR, CA, CO, CT, DE, DC, FL, GA, HI, ID, IL, IN, IA,
                  KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM,
                  NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,
                  WV, WI, WY, GU, PR, VI],
    'z': [43,170.00, 57,750.00, 48,160.00, 40,530.00, 57,190.00, 54,050.00,
          59,410.00, 52,200.00, 85,720.00, 44,790.00, 47,200.00, 52,050.00,
          42,240.00, 52,410.00, 43,950.00, 44,730.00, 44,570.00, 42,410.00,
          41,590.00, 45,300.00, 57,270.00, 62,110.00, 48,300.00, 52,730.00,
          38,910.00, 45,520.00, 42,400.00, 45,530.00, 45,040.00, 51,040.00,
          56,970.00, 44,840.00, 60,100.00, 46,080.00, 48,130.00, 46,950.00,
          43,340.00, 51,010.00, 48,760.00, 53,110.00, 42,240.00, 40,770.00,
          43,550.00, 48,700.00, 46,460.00, 48,840.00, 53,980.00, 57,480.00,
          41,400.00, 46,270.00, 47,650.00, 35,980.00, 28,930.00, 39,770.00]
})

I counted 54 elements in your ‘locations’ array.
Now when I look at the ‘z’ array, I technically find 108 elements.
Judging by your syntax, did you meant to use a ‘,’ to separate thousands and hundreds? (But Python interprets it as a separation in a list)

1 Like

Yes!!! Great catch!

You don’t know how long I’ve been struggling over this bug…what a relief :relieved:

2 Likes