Git Product home page Git Product logo

Comments (5)

reyale avatar reyale commented on May 22, 2024

Relevant: #68 (comment)

Basically data needs to be like: [(lat,lon),(lat,lon)], so an iterable of tuples.

You could transform:

array([[ nan, nan],
[ 38., 0.],
[ 45., 0.]])) 

which I read as a np.array of np.arrays of size 2 (Nx2 matrix) by going:

data=[(d[0],d[1]) for d in data]

from gmaps.

pleabargain avatar pleabargain commented on May 22, 2024

@reyale
Thank you. I tried variations on your suggestion

mydata = np.genfromtxt("/home/dgd/Desktop/text.csv", delimiter=',')
data = mydata
data =[(d[0],d[1]) for d in data]

heatmap_layer = gmaps.Heatmap(data=data)
m.add_layer(heatmap_layer)
m

but got
InvalidPointException: (nan, nan) is not a valid latitude, longitude pair

I'm grateful for any other tips you might have to resolve my goal with gmaps.

thank you
Dennis

from gmaps.

reyale avatar reyale commented on May 22, 2024

Dennis,

My guess is that you have a blank or invalid float value in your csv, and that np.genfromtxt fills these values with np.nan. Please verify all data is not nan.

You might try:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html

missing_values : variable, optional
The set of strings corresponding to missing data.
filling_values : variable, optional
The set of values to be used as default when the data are missing.

in np.genfromtxt to automatically fill these values with valid floats.

from gmaps.

pbugnion avatar pbugnion commented on May 22, 2024

@pleabargain If you can attach the CSV to the issue (or any subset of the CSV that causes the error), we may be able to give more targeted answers.

If you do have nan values in your data, you will have to remove these as a pre-processing step beforehand.

PRs for improved error handling always welcome!

from gmaps.

pbugnion avatar pbugnion commented on May 22, 2024

Closing as likely not a problem in gmaps directly. That said, we should improve the way we notify the user that their data is invalid.

from gmaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.