jsanim | Javascript Animation Library | Animation library
kandi X-RAY | jsanim Summary
kandi X-RAY | jsanim Summary
[unmaintained] Javascript Animation Library
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jsanim
jsanim Key Features
jsanim Examples and Code Snippets
Community Discussions
Trending Discussions on jsanim
QUESTION
I have a question that maybe is asked before, but I couldn't find any post describing my problem.
I have two pandas dataframes, each with the same index, representing x coordinates in one dataframe and y coordinates in the other. Each colum represent a car that started a specific timestep, logged every step until it arrived, and then stopped logging.
Everytime a car starts on its route, a column is added to each dataframe and the coordinates of each step are added to each frame (every step it moves trough space therefor has new x,y coordinates), (see example for the x coordinates dataframe)
But I am trying to animate the tracks of each car by plotting the coordinates in an animated graph, but I cannot seem to get it worked. My code:
...ANSWER
Answered 2018-Oct-10 at 12:27I've reformatted your code, but I think your main issue was that your dataframes start with a index of 1, but when you're calling your animation with frames=4
, it's calling update()
with i=[0,1,2,3]
. Therefore when you do get_data_x(0)
you raise a KeyError: 'the label [0] is not in the [index]'
As per the documentation, frames=
can be passed an iterable instead of an int. Here, I simply pass the index of your dataframe, and the function will iterate and call update()
with each value. Actually, I decided to pass the intersection of your two dataframe indexes, that way, if there is one index present in one dataframe but not the other, it will not raise an Error. If you are garanteed that your two indexes are the same, then you could just do frames=df_x.index
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jsanim
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page