-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Cannot Animate Plot by pandas.Timestamp #1737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Having dug a little deeper, the issue around animating by pandas.Timestamp goes beyond the code segment I addressed above. Is animating by date supported functionality? If not, would this be better as a feature request? |
I have the same issue workaround that works for me:
Then in px.scatter use |
Thank you toships, |
I have this problem too. A simpler workaround that worked for me is passing: |
This works perfectly! Thank you! |
Is there any plan to fix this issue? |
Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson |
Attempting to animate a plot using a pandas Timestamp column results in an exception.
Using Python 3.6.8, plotly_express==0.4.1, plotly==4.1.0
Code to replicate:
Exception & stack trace:
I found the cause of the issue, in _core.py:847
Pandas
.unique()
method returns a NumPy array, and as given in the examples section, it will convert apandas.Timestamp
to anumpy.datetime64
.The
uniques
list defined at _core.py:847 uses the.unique()
method, converting the series ofpandas.Timestamp
into an array ofnumpy.datetime64
This distinction is relevant on line 857:
Which causes the ValueError when
.index()
does not find a matching element due to this behavior of pandas.Timestamp and numpy.datetime64 seen here:The text was updated successfully, but these errors were encountered: