Challenges with pydeck reading csv

Hi Streamlit Community

Still getting to grips with Stramlit, but getting better. However, pydeck_chart has been giving me a few headaches. Namely, whenever I try to read a CSV I get an Unexpected token N in JSON at position 53116 error. The script will work fine on a CSV which only contains lon and lat columns, but when I add further columns to the CSV, suddenly the script fails citing the above error.

I have looked through everything I can find but still feel at a loss. Is there a specific way one should be formatting the csv?

I have attached a link to the repo that contains:

  1. the script (adapted slightly from the columnlayer tutorial)
  2. the basic version of the csv with only lon/lat data
  3. the expanded csv with the same lon/lat data, and a few more columns of number. No blank or null entries.

Any help much appreciated, even if it is just pointing to a tutorial on this topic. Apologies if this is very basic or not streamlit specific.

Check your data and the dtypes after your imported it with:

df.info()

I guess you have some null values in your data and you have to convert the object types explicitly to float, string or whatever the proper datatype is.

Thanks again Franky, this helped put me on the path to fixing the issue. The main errors were:

a. a calculation had been done on empty cells, giving a divide by zero error code
b. there were a handful of null values in the table.

Once these were resolved the layer was rendered.