Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Cannot view data with mapbox #4

Open
Ali-Parandeh opened this issue Jul 11, 2019 · 6 comments
Open

Cannot view data with mapbox #4

Ali-Parandeh opened this issue Jul 11, 2019 · 6 comments

Comments

@Ali-Parandeh
Copy link

When trying to view customer density by location with a map using mapbox (and my own token), this error is given.

the JSON object must be str, bytes or bytearray, not 'int'

Need to include further code in the notebook to format data appropriately

@stevemar
Copy link
Contributor

I was able to recreate this error. Oddly enough even after converting AGE/CUST_ID/POSTALCODE (the only integer columns) to strings, I still got the same error.

The good part is that the google maps viewer works without having to change the data.

@stevemar stevemar changed the title the JSON object must be str, bytes or bytearray, not 'int' Cannot view data with mapbox Jul 12, 2019
@Ali-Parandeh
Copy link
Author

Ali-Parandeh commented Jul 13, 2019

I don't think the problem is with our data. I think the problem is with the JSON content the API is sending back.

The JSON response object received from the API in the example has integers in it (1 instead of "1").
Mapbox Geocoding API Docs

Maybe PixieDust's JSON handler is not equipped to deal with ints in the JSON object retrieved?

See here:
Pixiedust json Handlers
Pixiedust Mapbox Renderer

@stevemar
Copy link
Contributor

@vabarbosa i think you're more familiar with pixiedust than I am, can you look at this issue?

@Ali-Parandeh
Copy link
Author

I don't understand the pixidust codebase too much or the API response object to be able to rectify the issue. Do you know anyone in IBM who have worked on Pixiedust?

@stevemar
Copy link
Contributor

@Ali-Parandeh i'm hoping @vabarbosa or @DTAIEB can confirm if this is a bug in pixiedust or not.

@vabarbosa
Copy link
Member

vabarbosa commented Jul 16, 2019

@Ali-Parandeh @stevemar the PixieDust MapBox renderer does is trying to convert the DataFrame data to GeoJSON. for that, it requires/expects the selected Key fields to be a columns that represents latitude & longitude values. see the MapBox section of this PixieDust article: https://medium.com/codait/mapping-for-data-science-with-pixiedust-and-mapbox-b5aa1d9532b9

in this case, the Key field (STATE) provided does not correspond to a latitude value and the conversion is failing. the error message is misleading and could definitely be improved.

PixieDust's MapBox renderer works only with data that have columns containing latitude & longitude values. this is a current limitation. for data with State/Country names, you should use the Google Map renderer instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants