I have minute data and I want to convert that data into my own customized time frames (let's say 13:00 to 13:07)enter image description here
Asked
Active
Viewed 28 times
-1
-
1you want to see just the times between 1 and 1:07pm? please include a small reproducible example that provides a sample dataframe and what you expect? an image is just going to get you downvotes ... – Joran Beasley Jun 20 '22 at 19:43
-
I mean I just want the rows of 1 and 1:07 pm – spiispree Jun 20 '22 at 19:45
-
Please provide the sample data in a [text format](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). Edit your post to contain this information. – BrokenBenchmark Jun 21 '22 at 01:14
1 Answers
0
I guess this
df.set_index('Date').between_time('13:00','13:07')
but its just sort of a guess based on that image ¯\(ツ)/¯
to handle your other request just do
mask_1_and_107 = df['DateTime'].dt.time.isin([datetime.time(13),datetime.time(13,7)])
print(df[mask_1_and_107])

Joran Beasley
- 110,522
- 12
- 160
- 179
-
thanks you! it's working and I'm getting the rows from 13:00 to 13:07. Can you tell how to just get the rows of only 13:00 and 13:07 (i don't need rows of 13:02 to13:06) – spiispree Jun 20 '22 at 20:06
-
thank you one more thing if i want all the values before 1:07(suppose) can we do something like that where we just give the ending point not the starting point? – spiispree Jun 20 '22 at 20:16
-
that makes no sense there is always a starting point ... you can pick some default sure ... or you can remember the last ending spot or something else... it would be helpful to add an actual example input and desired output... as ive covered a few of them now... – Joran Beasley Jun 20 '22 at 20:17