KeyError: <class 'numpy.float64'>

I upgraded from streamlit 0.62.1 to 0.65.2 and switched from 32 bit conda to 64 bit

I am now getting this error when switching to the slider input at https://breastcancer-predictor.herokuapp.com/

Line 184: https://github.com/batmanscode/breastcancer-predictor/blob/c0c1c74acc77ca9a48c12e79e6ec101a07e0daeb/app.py#L184

I’m a little lost on what might be wrong. Any suggestions would be much appreciated! :slight_smile:

I found a fix! Added float() to the value argument for the sliders. If anyone knows why this was’t a problem earlier please do let me know :slight_smile:

example error:

    BMI = st.sidebar.slider('BMI (kg/m2)',
                min_value=10.0,
                max_value=50.0,
                value=data['BMI'][0],
                step=0.01)

fix:

    BMI = st.sidebar.slider('BMI (kg/m2)',
                min_value=10.0,
                max_value=50.0,
                value=float(data['BMI'][0]),
                step=0.01)
2 Likes

I wonder if there is a silent cast on the pandas side, where data['BMI'][0] was 10.0 or something and it silently became an int.

2 Likes

That might be the case. One of the other sliders was doing a conversion and I had to specify but that happened throughout. This particular issue came out of nowhere :joy: and I’m not sure what changes I made that caused it :face_with_monocle: