Python Forum
is a pandas dataframe timeseries time index in a specified range (but ignoring date)?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is a pandas dataframe timeseries time index in a specified range (but ignoring date)?
#5
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
Reply


Messages In This Thread
RE: is a pandas dataframe timeseries time index in a specified range (but ignoring date)? - by m_lotinga - Dec-12-2016, 10:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Add NER output to pandas dataframe dg3000 0 130 Apr-22-2024, 08:14 PM
Last Post: dg3000
  [Numpy] Load date/time from .txt to 'datetime64' type. water 4 627 Mar-01-2024, 11:16 PM
Last Post: Gribouillis
  Parsing and summing time deltas (duration) onto bar + pie charts using pandas - - DRY Drone4four 2 600 Feb-10-2024, 06:04 PM
Last Post: Drone4four
  Grouping in pandas/multi-index data frame Aleqsie 3 696 Jan-06-2024, 03:55 PM
Last Post: deanhystad
  HTML Decoder pandas dataframe column mbrown009 3 1,061 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  Index out of range error standenman 0 1,103 May-22-2023, 10:35 PM
Last Post: standenman
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,718 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  Use pandas to obtain cartesian product between a dataframe of int and equations? haihal 0 1,131 Jan-06-2023, 10:53 PM
Last Post: haihal
  Pandas Dataframe Filtering based on rows mvdlm 0 1,449 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Pandas dataframe: calculate metrics by year mcva 1 2,329 Mar-02-2022, 08:22 AM
Last Post: mcva

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020