arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Add Support For Custom span_range values

Open davidlohle opened this issue 10 years ago • 6 comments

Need to create a function to grab all data points between time span ranges. It would be pretty cool to allow for span_ranges of 'minutes=90', or something of the sort.

davidlohle avatar Apr 28 '15 19:04 davidlohle

+1

vsnig avatar May 01 '15 12:05 vsnig

+1

JamesMura avatar Nov 22 '15 04:11 JamesMura

This would be nice to add to the lib. Welcome any PR attempts

andrewelkins avatar Dec 31 '16 23:12 andrewelkins

My classmate and I would like to take a look at this issue, if it is still relevant. We were thinking about implementing the solution using the shift() function, but wanted to get an opinion and see if it is even a possible approach. Let me know! Thanks!

EDIT: We figured the shift() function would help with using custom ranges

kdeodhar16 avatar Apr 15 '20 23:04 kdeodhar16

Hello @kdeodhar16, thank you for your interest in contributing to arrow.

A quick look over the code points to span_range using span under the hood. Messing around with the count arg gave me something similar to what we'd like to accomplish in span_range.

(arrow) chris@ThinkPad:~/arrow$ python
Python 3.7.4 (default, Sep 19 2019, 11:01:37) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import arrow
>>> start=arrow.utcnow().floor('hour')
>>> start
<Arrow [2020-04-16T15:00:00+00:00]>
>>> start.span('minute', count=90)
(<Arrow [2020-04-16T15:00:00+00:00]>, <Arrow [2020-04-16T16:29:59.999999+00:00]>)

Maybe we can use this as a solution, but I'm interested to hear your idea for using shift.

systemcatch avatar Apr 16 '20 16:04 systemcatch

Hi @systemcatch, I am working with @kdeodhar16 on this task as well and was actually thinking something similar to this! Looking at how span_range works using span, it seemed to me like the best way to accomplish this is to create a new function that uses .span in the way you did up there and we are now testing what we have to see if it works properly. Thanks!

amylavar1 avatar Apr 17 '20 16:04 amylavar1