Skip to content
Advertisement

Convert Array to dataframe with Longitude, Lattitude coordinates

Imported Libraries

JavaScript

I am trying to creat a Heatmap out of my strava dataset ( which turns to be a csv file of 155479 rows with Georaphical cooridnates) I tried first to display the whole dataset on Folium using python, the problem is that Folium seemed to crash when i tried to upload the whole dataset ( it was working with a sample). Meanwhile I found this post https://towardsdatascience.com/create-a-heatmap-from-the-logs-of-your-activity-tracker-c9fc7ace1657 the code is working in displaying all the datset.

JavaScript

and creating a descent heatmap

JavaScript

However when i try to convert this below array to a Dataframe

JavaScript

​ ​I dont understand the below error

ValueError: Must pass 2-d input. shape=(1000, 1000, 4)

Advertisement

Answer

The error means that Pandas can’t organize your data into a table. By definition, tables have 2 dimensions (rows and columns), but the data you passed has 3 dimensions: 1000, 1000 and 4.

To make it work, you should reshape the data to 2 dimensions.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement