Dec-12-2016, 10:51 PM
Thanks, I like this idea as it's quite practical.
One issue I'm finding is that my datetimeindex is an immutable array of datetime objects. there doesn't seem to be any simple way to convert this directly to a mutable array to do the addition.
So far I've tried copying the whole datetimeindex to a dummy array but not managed to get this to work as python seems very resistant to datetime gymnastics. I've also tried stepping through each value in the datetimeindex to convert to timestamp, which works, but I can't seem to compile the Boolean values into a single mask array to then apply back on to the index. In your example above, 'between' returns individual values at each loop iteration.
I found a class someone created on github for these types of problems, which may explain why I'm finding issues. But I'm trying to minimise dependancies!
https://github.com/tgs/nptime/blob/master/nptime.py
One issue I'm finding is that my datetimeindex is an immutable array of datetime objects. there doesn't seem to be any simple way to convert this directly to a mutable array to do the addition.
So far I've tried copying the whole datetimeindex to a dummy array but not managed to get this to work as python seems very resistant to datetime gymnastics. I've also tried stepping through each value in the datetimeindex to convert to timestamp, which works, but I can't seem to compile the Boolean values into a single mask array to then apply back on to the index. In your example above, 'between' returns individual values at each loop iteration.
I found a class someone created on github for these types of problems, which may explain why I'm finding issues. But I'm trying to minimise dependancies!
https://github.com/tgs/nptime/blob/master/nptime.py