pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.76k stars 17.96k forks source link

option to collapse gaps in tsplots #1476

Closed changhiskhan closed 8 years ago

changhiskhan commented 12 years ago

Actually this isn't done. What I meant here was, for example, make the next day's open immediately after today' close.

We could:

  1. Use positional integer index values instead of the period ordinals on the x-axis and then map to the dates in the Index. Though I haven't thought about how to cleanly map x-axis values outside of the Index.
  2. Create custom "business hours" frequencies, but there will be too many individualized open/close times.
  3. General parameterized Periods - really hairy
  4. Use Intervals (define 9:00am-4:30pm intervals) - just add an "is_regular" to IntervalIndex if all the Intervals are of the same length so can regularize and optimize computations.

@dalejung, you also emailed the mailing list regarding this issue. I'm sorry I didn't get back to you on it. Would you like to continue to discussion here?

dalejung commented 12 years ago

@changhiskhan I totally didn't see this issue.

I don't see how to do this well without the int index. I think that index needs to be stored somewhere. I do it explicitly in a figure object, but that's probably not necessary. Attaching an index with the proper DateLocator and DateFormatter to a matplotlib object would work. All those objects need to stay around as long as the mpl figure sticks around since the user can resize/zoom.

I also did a quick test with https://github.com/pydata/pandas/issues/1579 and the int-index does superb for plotting performance.