Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ENH/BUG: support TimedeltaIndex plotting #8711
Comments
jreback
added Bug Enhancement Visualization Timedelta
labels
Nov 2, 2014
jreback
added this to the
0.16.0
milestone
Nov 2, 2014
|
I don't think that matplotlib already has a converter for But writing a basic converter should not be that difficult I think (and if it also works for |
|
Timedelta is s. subclass of datetime.timedelta |
This was referenced Nov 28, 2014
|
I just encountered a MemoryError when attempting to plot a TimedeltaIndex!
|
jreback
modified the milestone: 0.16.0, Next Major Release
Mar 6, 2015
|
Working on this. Doesn't look too bad. |
|
As an update, it's a bit worse than I thought. I think it was @changhiskhan who put in a ton of heuristics for figuring out what to resolution to draw when plotting datetimes. I wasn't sure if we'd need that for timedeltas, and then I got busy with other thing. My branch is here |
|
As a workaround, the following works with master: plt.plot(s.index,s.values) |
jreback
referenced
this issue
Jul 22, 2015
Closed
Memory error when plotting simple time series #10650
|
I don't think freq adjustment of different timedeltas is mandatory at initial version. If ok, I'll try. |
jorisvandenbossche
referenced
this issue
Oct 20, 2015
Closed
Irregular TimedeltaIndex points being spaced regularly along x-axis #11378
lucasb-eyer
commented
Nov 11, 2015
|
Coming here from #10650, and adding a little more info just in case it can help. In my case, the bug manifests in
allocates a gigantic array. To be specific, when doing:
the values of |
|
@lucas-eyer is the |
lucasb-eyer
commented
Nov 12, 2015
|
I don't know what appropriate would be, but it's Edit: |
Liam3851
commented
Jan 13, 2016
|
I also just ran into this issue on 0.17.1. I'm not very familiar with the code, but it appears the issue is in The issue is that
But downstream in _daily_finder the
Replacing the final line above with
appears to fix the issue. |
|
@Liam3851 glad you have tracked this down! Any chance you're interested in making a pull request with the fix? :) |
Liam3851
commented
Jan 13, 2016
|
Sure, I just have to figure out how to do it lol. Longtime pandas user but kinda new on this github thingy. I'll head over to the FAQ. |
|
Great! Give it a try and let us know if you have any questions :). On Wed, Jan 13, 2016 at 11:48 AM, Liam3851 notifications@github.com wrote:
|
|
Lots of love from me too @Liam3851! |
Liam3851
commented
Jan 14, 2016
|
Hmm, ok still slightly more complicated. Was testing the fix and the bounds are now right and the graphs themselves look correct but the axis labels don't always work properly (sometimes they disappear)-- probably something related to how the labels are interpreted. I'm busy these next few days but I'll try to get around to making the fix sound. |
|
Just guessing, but you could be hitting what I ran into. I can't remember how much progress if any I made on that. |
Liam3851
commented
Jan 14, 2016
|
@TomAugspurger Hmm.. I'll try your version to see what it does. From the diff it looks like we're taking slightly different paths. It looks like you were building a TimedeltaConverter that worked parallel to DatetimeConverter and TimeConverter; I've been trying to fix the codepath the timedeltas are currently taking (through DatetimeConverter). But it's entirely possible that getting it to look just right will require going down your path. |
|
I’d say getting it somewhat functional is good enough for now. Hopefully you don’t have to go down that rabbit hole.
|
shoyer
referenced
this issue
in pydata/xarray
Aug 4, 2016
Closed
Don't convert time data to timedelta by default #940
sam-cohan
commented
Nov 15, 2016
|
Hello. I am using pandas version 0.19.0 and matplotlib version 1.5.3 with python 3 and this issue is still there: If I try to plot a Dataframe where the index is a timedelta I get |
|
@sam-cohan As you can see, the issue is still open, so it's indeed not yet solved. But any help is certainly welcome! |
sam-cohan
commented
Nov 15, 2016
|
Sorry I was looking at the wrong "Closed" :) |
|
Really wish this was fixed. I'm using datetime as a work around but stringing along 1970-01-01 to do time deltas is not fun. |
|
@TomAugspurger does your branch with a first attempt still exist? (the link above is not working anymore) |
|
So the issue here is that we are trying to use the Int64Index as a base class for TimedeltaIndex but we are trying to use the plotting routines for the PeriodIndex which relies on DatetimeIndex (matplotlib.date) underneath. Matplotlib.date scales the view interval to the selected frequency. Int64Index does not, so this explains the issues above. Options:
|
jgoppert
referenced
this issue
Jan 5, 2017
Closed
Adds custom plot formatting for TimedeltaIndex. #15067
|
@jgoppert you should take a look at |
|
@jorisvandenbossche I did consider that approach, but I think having a separate matplotlib plotting function is cleaner and will require less maintenance. We also won't have to worry about ever seeing jan 1970 on the time delta plot like we do on the period index based plots now. It seems pretty robust and I have added nano-second level precision labels. |
Seems like I deleted that branch when I was cleaning up my fork. I didn't get far beyond the |
|
@TomAugspurger can you take a look at my PR. Totally different approach but seems to work for me. |
jreback
closed this
in 1400305
Feb 22, 2017
jreback
modified the milestone: 0.20.0, Next Major Release
Feb 22, 2017
sam-cohan
commented
Feb 22, 2017
|
Does this mean the fix for this will be in next release? If so, what is the timeline for that? Thanks in advance. |
|
@sam-cohan yes it will be in 0.20.0 I think we are still about 1 month away from an rc. |
AnkurDedania
added a commit
to AnkurDedania/pandas
that referenced
this issue
Mar 21, 2017
|
|
jgoppert + AnkurDedania |
3819bc2
|
jreback commentedNov 2, 2014
This raises
This will show the timedeltas with a formatted (albeit string index)
wonder if we can just register a converter somehow? like #8614